fix: IA-1609 implement request rate-limiting per CodeQL issue #24#296
Merged
Conversation
aaronfowles
commented
Sep 3, 2025
562781f to
a817143
Compare
…service attacks This addresses a CodeQL issue which flagged that the auth routes were not covered by rate-limiting. A global limit on all routes was chosen as reasonable use of the app functionality shouldn't require many server calls (once logged in data is fetched only at the user's request). A limit of 20 requests per IP seemed suitable in order to not interfere with genuine use of the tool while providing some protection against denial-of-service.
a817143 to
5d60cfc
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.
This fixes https://github.com/alphagov/govuk-knowledge-graph-search/security/code-scanning/24.
Approach
I initially thought about just covering the
/loginroute with rate-limiting and maybe that is the best approach but just slightly more complicated - happy to discuss. The reasons I went for a global rate limiter on all routes:Testing