Skip to content

chore: update to JWT v5 to fix vulnerability GO-2025-3553 #282

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

Merged
merged 1 commit into from
Apr 1, 2025

Conversation

matthiasthomas
Copy link
Contributor

This PR updates the JWT implementation to use v5 to fix the vulnerability GO-2025-3553 related to excessive memory allocation during header parsing.

Changes:

  1. Updated to JWT v5 to fix the vulnerability
  2. Maintained backward compatibility by:
    • Using RegisteredClaims which has the same fields as StandardClaims
    • Using jwt.ClaimStrings for audience which is compatible with both string and array formats
    • Keeping the same method signatures and struct names
  3. Updated the tests to work with JWT v5
  4. Updated go.mod to use the latest JWT v5 version

All tests are passing:

  • github.com/go-oauth2/oauth2/v4: ✅
  • github.com/go-oauth2/oauth2/v4/generates: ✅
  • github.com/go-oauth2/oauth2/v4/manage: ✅
  • github.com/go-oauth2/oauth2/v4/server: ✅
  • github.com/go-oauth2/oauth2/v4/store: ✅

@matthiasthomas matthiasthomas changed the title Update to JWT v5 to fix vulnerability GO-2025-3553 chore: update to JWT v5 to fix vulnerability GO-2025-3553 Mar 27, 2025
@adrien-hearthands
Copy link

Please merge this ASAP 🙏 @LyricTian

@onshorechet
Copy link

To temporally use the PR instead of the upstream add this replace to your go.mod:

replace github.com/go-oauth2/oauth2/v4 => github.com/matthiasthomas/oauth2 a0d555dfa1525b450fe7208fe46be2eba0510e53

@andriiskripka
Copy link

Buenas. Have any updates? I'm waiting for merge this pr and download stable version. If possible merge it asap 🙏

@LyricTian LyricTian merged commit fb61132 into go-oauth2:master Apr 1, 2025
@LyricTian
Copy link
Member

Buenas. Have any updates? I'm waiting for merge this pr and download stable version. If possible merge it asap 🙏

Merge and released, please using go get -u github.com/go-oauth2/oauth2/v4/... upgrade to latest version.

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.

5 participants