fix: enable IssuedAt verification when WithIssuedAt() is used#524
Open
happysnaker wants to merge 1 commit into
Open
fix: enable IssuedAt verification when WithIssuedAt() is used#524happysnaker wants to merge 1 commit into
happysnaker wants to merge 1 commit into
Conversation
The verifyIssuedAt call in the validator was passing 'false' for the 'required' parameter, which means IssuedAt would never actually be verified even when WithIssuedAt() was used. Changed to 'true' so that the iat claim is properly validated. Fixes golang-jwt#489
itxaiohanglover
left a comment
There was a problem hiding this comment.
This is the correct fix — when verifyIat is enabled via WithIssuedAt(), the last parameter should be true to actually verify the claim. The existing tests should cover this. Any chance this could get reviewed?
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
Fixes #489
The
verifyIssuedAtcall in the validator was passingfalsefor therequiredparameter, which means IssuedAt would never actually be verified even whenWithIssuedAt()was used by the caller.Root Cause
In
validator.go, the IssuedAt check is:The third parameter
requiredcontrols whether the check is enforced. Passingfalsemeans the function only checks if the claim exists but doesn't actually validate it. Passingtrueenforces the check.Changes
Changed
falsetotrueso thatWithIssuedAt()actually enforces IssuedAt validation.This is a one-character fix.