-
Notifications
You must be signed in to change notification settings - Fork 6
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
fix: fix time drift between client and server when redeeming v3 #711
Conversation
[puLL-Merge] - brave-intl/challenge-bypass-server@711 DescriptionThis PR introduces a number of changes related to token issuance and redemption with V3 issuers. The main changes include:
The motivation seems to be to improve the token issuance and redemption flow for V3 issuers, by making the code clearer and adding more robust validation around issuer expiration and signing key selection. ChangesChangesbtd/issuer.go
kafka/signed_token_redeem_handler.go
model/issuer.go
model/issuer_keys.go
model/*_test.go
server/issuers.go
server/tokens.go
server/tokens_test.go
Overall, the changes look good and well-tested. Using the new |
}, | ||
|
||
{ | ||
name: "evq_strict_b_leeway_a", |
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.
@evq This test case and the case below it are the two we discussed last week.
This PR adds a 1 hour leeway to the check for issuer v3 signing key, as occasionally clients might fail if requests come through around the time of key rotation.
It also fixes a bug in the v3 redemption handler where issuer expiry check would never work – it mistakenly required the expiry time be both zero and after now at the same time, which was clearly a mistake (as anywhere else that check requires the time to not be zero).
Additionally, the PR offers small refactors to improve readability and maintainability, as well as some test coverage.
For more details, please see the linked issue.