-
Notifications
You must be signed in to change notification settings - Fork 65
Add a task to clean up expired JWT failure rate limits #380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| /// limit has been reached. This also defines the interval at which failed | ||
| /// attempts are regularly checked and expired ones are cleaned up. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also add this note to config.example.toml?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in a39fb31.
crates/signer/src/service.rs
Outdated
| .route(STATUS_PATH, get(handle_status)); | ||
|
|
||
| // Run the JWT cleaning task | ||
| //let state = state.clone(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is missed here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in a39fb31.
Co-authored-by: Manuel Iñaki Bilbao <[email protected]>
This adds a small task that runs in parallel with the Signer server and periodically cleans up the JWT auth failure map, removing any rate limiting entries that have expired. Previously the only way they got removed was if the timed out client tried to request again after the timeout period, so if lots of clients never re-requested then they'd just fill up the map for no reason.
Note that the attempt count isn't timed, so if a client fails 2/3 attempts, then waits 10 minutes, then fails a 3rd attempt, they'll trigger the lockout.