Add rate limiter and NORAD ID validation to /norad route#3
Open
twinksanderson wants to merge 1 commit intoMrTalon63:masterfrom
Open
Add rate limiter and NORAD ID validation to /norad route#3twinksanderson wants to merge 1 commit intoMrTalon63:masterfrom
twinksanderson wants to merge 1 commit intoMrTalon63:masterfrom
Conversation
The NORAD route was missing the rate limiter middleware that all other routes (tle, json, csv) use. This allowed unlimited requests that could abuse Celestrak upstream. Also adds validation for NORAD catalog IDs — rejects NaN, negative, and out-of-range values (must be 1-999999) with a 400 response instead of forwarding garbage to Celestrak.
31914bf to
b59e991
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/norad/:idroute — it was the only route without it, allowing unlimited upstream requests to CelestrakNaN, negative, zero, and out-of-range values (must be 1–999999) with a400 Bad Requestinstead of forwarding invalid requests upstreamChanges
src/routes/norad.ts.use(limiter)— same pattern as/tle,/json,/csvroutesparseIntresult: reject ifNaN,< 1, or> 999999400with descriptive error message for invalid IDs