Skip to content
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

Encode: check for errors while setting claim fields #92

Merged
merged 1 commit into from
Jun 18, 2024

Conversation

drakkan
Copy link
Contributor

@drakkan drakkan commented Jun 9, 2024

Fixes #90

Copy link
Contributor

@VojtechVitek VojtechVitek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Thank you!

Comment on lines +289 to +292
claims[jwt.JwtIDKey] = 1
if _, _, err := TokenAuthHS256.Encode(claims); err == nil {
t.Fatal("encoding invalid claims succeeded")
}
Copy link
Contributor

@VojtechVitek VojtechVitek Jun 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This now fails correctly per RFC-7519:

The "jti" value is a case-sensitive string.  Use of this claim is OPTIONAL.

https://datatracker.ietf.org/doc/html/rfc7519#page-10

@VojtechVitek VojtechVitek merged commit b5d850b into go-chi:master Jun 18, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing error handling when set claim fields
2 participants