chore(deps): update module github.com/golang-jwt/jwt/v4 to v5 - #161
chore(deps): update module github.com/golang-jwt/jwt/v4 to v5#161red-hat-konflux[bot] wants to merge 1 commit into
Conversation
dd677cc to
a6f9377
Compare
a6f9377 to
f6c0c8d
Compare
f6c0c8d to
92cf930
Compare
92cf930 to
f7f21ba
Compare
f7f21ba to
32fc765
Compare
32fc765 to
cebd9ce
Compare
9e86c3b to
6b40701
Compare
6b40701 to
555b910
Compare
555b910 to
904e3b1
Compare
|
🤖 Finished Review · ✅ Success · Started 10:46 PM UTC · Completed 10:54 PM UTC |
Review — ⚠ Changes RequestedPR: #161 — chore(deps): update module github.com/golang-jwt/jwt/v4 to v5 SummaryThis PR attempts to update the indirect dependency Findings1. 🔴 Missing
|
| Check | Status |
|---|---|
| Lint Go Code | ❌ failure |
| Run Tests | ❌ failure |
| Konflux build | ❌ failure |
| Validate AGENTS.md | ✅ success |
Recommendation
This PR should not be merged in its current state. The correct approach is:
- Check out this branch locally
- Run
go get github.com/golang-jwt/jwt/v5@v5.3.1(if the upgrade is desired) - Run
go mod tidyto resolve the full dependency graph - Commit both
go.modandgo.sum - Verify CI passes
Alternatively, if the upgrade isn't urgent (this is an indirect dependency with no direct security exposure in this codebase), consider closing this PR and configuring the bot to avoid cross-major-version updates for Go modules.
Previous run
Review of PR #161 — chore(deps): update module github.com/golang-jwt/jwt/v4 to v5
Verdict: ❌ Request Changes
This PR from MintMaker/Renovate attempts to update github.com/golang-jwt/jwt/v4 v4.5.2 to github.com/golang-jwt/jwt/v5 v5.3.1 by modifying a single line in go.mod. The PR is broken and CI is failing (both Lint Go Code and Run Tests jobs). Two issues must be resolved before this can merge.
Findings
1. go.sum not updated — go mod tidy was not run (high)
The PR modifies go.mod but does not update go.sum. The go.sum file still contains checksums for jwt/v4 only and has no entries for jwt/v5. This alone will cause build failures because the Go toolchain requires go.sum to be consistent with go.mod.
The project's own AGENTS.md explicitly warns: "Don't skip go mod tidy — CI will fail on inconsistent go.sum."
Remediation: Run go mod tidy after modifying go.mod and include the resulting go.sum changes in the PR.
2. Incorrect Go major version migration (high)
In Go modules, github.com/golang-jwt/jwt/v4 and github.com/golang-jwt/jwt/v5 are different modules with different import paths. This is not a simple semver version bump — it is a module replacement.
The jwt/v4 module is currently listed as // indirect, meaning it is pulled in by one or more transitive dependencies (likely through argoproj/argo-cd/v2, bradleyfalzon/ghinstallation/v2, or their dependency trees). Simply replacing the jwt/v4 line with jwt/v5 in go.mod will break the build if any transitive dependency still imports github.com/golang-jwt/jwt/v4.
The correct migration requires:
- Identifying which transitive dependency pulls in
jwt/v4(viago mod why github.com/golang-jwt/jwt/v4orgo mod graph | grep jwt) - Verifying that dependency has a version available that uses
jwt/v5 - Updating that intermediate dependency first (if needed)
- Running
go mod tidyto let Go resolve the correct dependency graph - Confirming the build succeeds
The MintMaker/Renovate bot appears to be treating this Go major version change as an ordinary semver bump, which does not work for Go modules.
Remediation: This PR needs to be regenerated with proper Go module tooling (go get, go mod tidy) rather than a text substitution in go.mod. If the transitive dependency that requires jwt/v4 hasn't migrated to jwt/v5 yet, this update cannot be performed until it does.
Summary
| # | Severity | Category | File | Description |
|---|---|---|---|---|
| 1 | high | correctness | go.mod |
go.sum not updated — go mod tidy was not run; build fails |
| 2 | high | correctness | go.mod |
Incorrect Go major version migration — jwt/v4 and jwt/v5 are different modules; transitive dependencies may still require jwt/v4 |
Both CI checks (Lint Go Code and Run Tests) are failing, confirming the PR is not buildable in its current state.
Previous run (2)
Review — request-changes
Summary
This Renovate/MintMaker PR attempts to update github.com/golang-jwt/jwt from v4.5.2 to v5.3.1 by modifying a single line in go.mod. However, this change is incomplete and will not build. Both CI jobs ("Run Tests" and "Lint Go Code") have failed, confirming the issues identified below.
Findings
1. Missing go.sum update (high)
File: go.sum
The PR modifies go.mod to reference github.com/golang-jwt/jwt/v5 v5.3.1 but does not include corresponding updates to go.sum. The go.sum file still only contains hash entries for jwt/v4:
github.com/golang-jwt/jwt/v4 v4.5.2 h1:YtQM7lnr8iZ+...
github.com/golang-jwt/jwt/v4 v4.5.2/go.mod h1:m21LjoU+...
Without jwt/v5 hash entries in go.sum, go mod download fails — breaking both the Dockerfile build (RUN go mod download) and CI test/lint steps.
Remediation: Run go mod tidy to regenerate both go.mod and go.sum with the correct dependency graph, then commit both files.
2. Invalid major version module substitution (high)
File: go.mod
In Go modules, github.com/golang-jwt/jwt/v4 and github.com/golang-jwt/jwt/v5 are different modules with different import paths. They cannot be substituted by simply changing the version in go.mod. If any transitive dependency (e.g., bradleyfalzon/ghinstallation/v2, argoproj/argo-cd/v2, or others) still imports jwt/v4, the build requires jwt/v4 to remain in go.mod regardless of whether jwt/v5 is also added.
The correct approach is:
- Run
go mod tidyto let Go resolve the actual dependency graph - If
jwt/v4is still transitively required, it cannot be removed - If all transitive consumers have migrated to
jwt/v5,go mod tidywill naturally dropjwt/v4and addjwt/v5
Remediation: Do not manually substitute major versions of Go modules. Run go mod tidy and commit the resulting go.mod and go.sum.
CI Status
| Check | Status |
|---|---|
| Run Tests | ❌ failure |
| Lint Go Code | ❌ failure |
| Validate AGENTS.md line limit | ✅ success |
Both build-critical checks confirm this PR cannot be merged as-is.
Recommendation
This PR should be regenerated with a proper go mod tidy run. If the upstream transitive dependencies have not yet migrated to jwt/v5, this update cannot be applied at this time.
Previous run (3)
Review — PR #161
Verdict: ⛔ Request Changes
This PR attempts to upgrade the indirect dependency github.com/golang-jwt/jwt from v4.5.2 to v5.3.1 by replacing the module path in go.mod. However, this change is invalid due to Go module major version semantics and will break the build.
Findings
1. 🔴 Invalid major version module replacement — build break
Severity: High · File: go.mod:78
In Go modules, github.com/golang-jwt/jwt/v4 and github.com/golang-jwt/jwt/v5 are entirely separate module paths — they are not interchangeable. This PR replaces the v4 entry with v5, but at least two upstream dependencies still require jwt/v4:
github.com/bradleyfalzon/ghinstallation/v2 v2.17.0— directly requiresgithub.com/golang-jwt/jwt/v4github.com/argoproj/argo-cd/v2 v2.14.21— also depends ongithub.com/golang-jwt/jwt/v4
Removing jwt/v4 from go.mod while these transitive dependencies still import from the jwt/v4 module path makes it impossible for the Go toolchain to satisfy the dependency graph. CI confirms this: both test and lint checks are failing.
This appears to be an automated dependency bot (Renovate/Konflux) that incorrectly treated the v4-to-v5 major version change as a simple version upgrade.
Remediation: This PR should be closed. The golang-jwt/jwt/v4 module cannot be removed until all transitive consumers (ghinstallation/v2, argo-cd/v2) release versions that depend on jwt/v5. At that point, those upstream dependencies should be updated first, and go mod tidy will naturally handle the jwt module transition.
2. 🟡 Incomplete change — go.sum not updated
Severity: Medium · File: go.sum
The PR modifies go.mod but does not update go.sum. The go.sum file (lines 204–205) contains checksums only for golang-jwt/jwt/v4 v4.5.2 and has no entries for golang-jwt/jwt/v5. Even if the module path change were valid, builds would fail because Go enforces checksum verification and the new module's checksums are missing.
Remediation: Run go mod tidy to regenerate both go.mod and go.sum consistently. Note: running go mod tidy would almost certainly restore jwt/v4 because upstream dependencies still require it.
Summary
| Severity | Count |
|---|---|
| High | 1 |
| Medium | 1 |
The automated dependency bot does not correctly handle Go major version module path semantics (/v4 → /v5 is a module path change, not a version bump). This PR will break the build and should be closed until upstream transitive dependencies migrate to jwt/v5.
Previous run (4)
Review
Findings
Critical
- [logic error]
go.mod:78— The PR replacesgithub.com/golang-jwt/jwt/v4withgithub.com/golang-jwt/jwt/v5, but in Go modules v4 and v5 are entirely different module paths. The transitive dependencygithub.com/bradleyfalzon/ghinstallation/v2 v2.17.0(line 38) importsjwt/v4, notjwt/v5. Replacing the v4 line with v5 will not satisfy the v4 import requirement. Eithergo mod tidywill re-add the v4 line (making this change a no-op), or the build will fail because the v4 module is no longer declared.
Remediation: Do not manually swap the jwt/v4 line to jwt/v5. If the goal is to remove jwt/v4, first updatebradleyfalzon/ghinstallation/v2(and any other transitive consumers) to a version that imports jwt/v5, then rungo mod tidyto let Go resolve the dependency graph correctly.
High
- [incomplete change]
go.mod:78— The PR modifies go.mod but does not update go.sum. The go.sum file still contains onlygolang-jwt/jwt/v4checksums and has no entries forgolang-jwt/jwt/v5. A valid Go dependency update must include corresponding go.sum changes; without them the module verification will fail orgo mod tidywill produce a different go.sum than what is committed.
Remediation: Rungo mod tidyafter making the correct go.mod changes and commit the resulting go.sum updates.
Low
- [architectural-impact]
go.mod:78— The update from golang-jwt/jwt v4 to v5 represents a major version bump. While this is an indirect dependency not directly imported by this project, the concrete risk is that transitive consumers (such as ghinstallation) may not yet support jwt/v5.
Previous run (5)
Review
Findings
Critical
- [api-contract]
go.mod:78— This PR changes thego.modentry fromgithub.com/golang-jwt/jwt/v4 v4.5.2togithub.com/golang-jwt/jwt/v5 v5.3.1. In Go modules, v4 and v5 are distinct module paths due to semantic import versioning. Simply editing the version string ingo.modis not valid: (1) thego.sumfile is not updated (it still references jwt/v4 checksums, with no jwt/v5 entries), sogo mod verifyand builds will fail; (2) jwt/v4 is an indirect dependency, meaning upstream modules (e.g.,ghinstallation/v2,argoproj/argo-cd/v2) import it by pathgithub.com/golang-jwt/jwt/v4in their source code — you cannot override that to v5 from the downstreamgo.modwithout those upstream libraries themselves releasing versions that import jwt/v5. This change will break the build.
Remediation: Either (a) revert this change, since you cannot force indirect transitive dependencies to a different major version module path; or (b) update all direct dependencies (ghinstallation/v2,argo-cd/v2, etc.) to versions that themselves depend on jwt/v5, then rungo mod tidyto let the resolver produce a consistentgo.modandgo.sum.
|
🤖 Finished Review · ✅ Success · Started 10:14 PM UTC · Completed 10:22 PM UTC |
|
🤖 Finished Review · ✅ Success · Started 1:51 AM UTC · Completed 1:58 AM UTC |
|
🤖 Finished Review · ✅ Success · Started 3:25 PM UTC · Completed 3:30 PM UTC |
|
🤖 Finished Review · ✅ Success · Started 1:29 AM UTC · Completed 1:34 AM UTC |
|
🤖 Finished Review · ✅ Success · Started 9:22 PM UTC · Completed 9:28 PM UTC |
| github.com/gobwas/glob v0.2.3 // indirect | ||
| github.com/gogo/protobuf v1.3.2 // indirect | ||
| github.com/golang-jwt/jwt/v4 v4.5.2 // indirect | ||
| github.com/golang-jwt/jwt/v5 v5.3.1 // indirect |
There was a problem hiding this comment.
[high] correctness
Missing go.sum update: PR modifies go.mod to reference jwt/v5 but go.sum still only contains checksums for jwt/v4. Builds, tests, and linting all fail because the Go toolchain cannot verify module integrity without the correct checksums.
Suggested fix: Run go mod tidy after the go.mod change to regenerate go.sum with the correct checksums for jwt/v5.
| github.com/gobwas/glob v0.2.3 // indirect | ||
| github.com/gogo/protobuf v1.3.2 // indirect | ||
| github.com/golang-jwt/jwt/v4 v4.5.2 // indirect | ||
| github.com/golang-jwt/jwt/v5 v5.3.1 // indirect |
There was a problem hiding this comment.
[high] correctness
Go major version module path incompatibility: jwt/v4 and jwt/v5 are distinct Go modules with different import paths. Manually swapping the go.mod entry does not update the dependency graph. If any transitive dependency still imports jwt/v4, removing it from go.mod breaks dependency resolution.
Suggested fix: Use go get github.com/golang-jwt/jwt/v5@v5.3.1 followed by go mod tidy to let Go resolve the full dependency graph, then commit both go.mod and go.sum.
| github.com/gobwas/glob v0.2.3 // indirect | ||
| github.com/gogo/protobuf v1.3.2 // indirect | ||
| github.com/golang-jwt/jwt/v4 v4.5.2 // indirect | ||
| github.com/golang-jwt/jwt/v5 v5.3.1 // indirect |
There was a problem hiding this comment.
[medium] intent-coherence
Automated dependency bot (Renovate/MintMaker) treats Go major version bump (v4→v5) as a simple version update, but Go module semantics require module path changes for major versions. The bot should be configured to run go mod tidy after go.mod changes or skip cross-major-version updates for Go modules.
Suggested fix: Configure MintMaker/Renovate postUpdateOptions to include gomodTidy, or add golang-jwt/jwt to the ignoreDeps list for major version updates.
Signed-off-by: red-hat-konflux <126015336+red-hat-konflux[bot]@users.noreply.github.com>
This PR contains the following updates:
v4.5.2→v5.3.1Warning
Some dependencies could not be looked up. Check the warning logs for more information.
Release Notes
golang-jwt/jwt (github.com/golang-jwt/jwt/v4)
v5.3.1Compare Source
What's Changed
🔐 Features
WithNotBeforeRequiredparser option and add test coverage by @equalsgibson in #456NewWithClaims()by @equalsgibson in #459ParseUnverifiedby @slickwilli in #414👒 Dependencies
New Contributors
Full Changelog: golang-jwt/jwt@v5.3.0...v5.3.1
v5.3.0Compare Source
This release is almost identical to to
v5.2.3but now correctly indicates Go 1.21 as minimum requirement.What's Changed
Full Changelog: golang-jwt/jwt@v5.2.3...v5.3.0
v5.2.3Compare Source
What's Changed
New Contributors
Full Changelog: golang-jwt/jwt@v5.2.2...v5.2.3
v5.2.2Compare Source
What's Changed
jwt.Parseexample to usejwt.WithValidMethodsby @mattt in #425New Contributors
Full Changelog: golang-jwt/jwt@v5.2.1...v5.2.2
v5.2.1Compare Source
What's Changed
New Contributors
Full Changelog: golang-jwt/jwt@v5.2.0...v5.2.1
v5.2.0Compare Source
What's Changed
NewValidatorby @oxisto in #349New Contributors
Full Changelog: golang-jwt/jwt@v5.1.0...v5.2.0
v5.1.0Compare Source
What's Changed
ErrInvalidTypeinstead ofjson.UnsupportedTypeErrorby @oxisto in #316New Contributors
Full Changelog: golang-jwt/jwt@v5.0.0...v5.1.0
v5.0.0Compare Source
🚀 New Major Version
v5🚀It's finally here, the release you have been waiting for! We don't take breaking changes lightly, but the changes outlined below were necessary to address some of the challenges of the previous API. A big thanks for @mfridman for all the reviews, all contributors for their commits and of course @dgrijalva for the original code. I hope we kept some of the spirit of your original
v4branch alive in the approach we have taken here.~@oxisto, on behalf of @golang-jwt/maintainers
Version
v5contains a major rework of core functionalities in thejwt-golibrary. This includes support for several validation options as well as a re-design of theClaimsinterface. Lastly, we reworked how errors work under the hood, which should provide a better overall developer experience.Starting from v5.0.0, the import path will be:
For most users, changing the import path should suffice. However, since we intentionally changed and cleaned some of the public API, existing programs might need to be updated. The following sections describe significant changes and corresponding updates for existing programs.
Parsing and Validation Options
Under the hood, a new
validatorstruct takes care of validating the claims. A long awaited feature has been the option to fine-tune the validation of tokens. This is now possible with severalParserOptionfunctions that can be appended to mostParsefunctions, such asParseWithClaims. The most important options and changes are:WithLeewayto support specifying the leeway that is allowed when validating time-based claims, such asexpornbf.iatclaim. Usage of this claim is OPTIONAL according to the JWT RFC. The claim itself is also purely informational according to the RFC, so a strict validation failure is not recommended. If you want to check for sensible values in these claims, please use theWithIssuedAtparser option.WithAudience,WithSubjectandWithIssuerto support checking for expectedaud,subandiss.WithStrictDecodingandWithPaddingAllowedoptions to allow previously global settings to enable base64 strict encoding and the parsing of base64 strings with padding. The latter is strictly speaking against the standard, but unfortunately some of the major identity providers issue some of these incorrect tokens. Both options are disabled by default.Changes to the
ClaimsinterfaceComplete Restructuring
Previously, the claims interface was satisfied with an implementation of a
Valid() errorfunction. This had several issues:Since all the validation functionality is now extracted into the validator, all
VerifyXXXandValidfunctions have been removed from theClaimsinterface. Instead, the interface now represents a list of getters to retrieve values with a specific meaning. This allows us to completely decouple the validation logic with the underlying storage representation of the claim, which could be a struct, a map or even something stored in a database.Supported Claim Types and Removal of
StandardClaimsThe two standard claim types supported by this library,
MapClaimsandRegisteredClaimsboth implement the necessary functions of this interface. The oldStandardClaimsstruct, which has already been deprecated inv4is now removed.Users using custom claims, in most cases, will not experience any changes in the behavior as long as they embedded
RegisteredClaims. If they created a new claim type from scratch, they now need to implemented the proper getter functions.Migrating Application Specific Logic of the old
ValidPreviously, users could override the
Validmethod in a custom claim, for example to extend the validation with application-specific claims. However, this was always very dangerous, since once could easily disable the standard validation and signature checking.In order to avoid that, while still supporting the use-case, a new
ClaimsValidatorinterface has been introduced. This interface consists of theValidate() errorfunction. If the validator sees, that aClaimsstruct implements this interface, the errors returned to theValidatefunction will be appended to the regular standard validation. It is not possible to disable the standard validation anymore (even only by accident).Usage examples can be found in example_test.go, to build claims structs like the following.
Changes to the
TokenandParserstructThe previously global functions
DecodeSegmentandEncodeSegmentwere moved to theParserandTokenstruct respectively. This will allow us in the future to configure the behavior of these two based on options supplied on the parser or the token (creation). This also removes two previously global variables and moves them to parser optionsWithStrictDecodingandWithPaddingAllowed.In order to do that, we had to adjust the way signing methods work. Previously they were given a base64 encoded signature in
Verifyand were expected to return a base64 encoded version of the signature inSign, both as astring. However, this made it necessary to haveDecodeSegmentandEncodeSegmentglobal and was a less than perfect design because we were repeating encoding/decoding steps for all signing methods. Now,SignandVerifyoperate on a decoded signature as a[]byte, which feels more natural for a cryptographic operation anyway. Lastly,ParseandSignedStringtake care of the final encoding/decoding part.In addition to that, we also changed the
Signaturefield onTokenfrom astringto[]byteand this is also now populated with the decoded form. This is also more consistent, because the other parts of the JWT, mainlyHeaderandClaimswere already stored in decoded form inToken. Only the signature was stored in base64 encoded form, which was redundant with the information in theRawfield, which contains the complete token as base64.Most (if not all) of these changes should not impact the normal usage of this library. Only users directly accessing the
Signaturefield as well as developers of custom signing methods should be affected.What's Changed
StandardClaimsin favor ofRegisteredClaimsby @oxisto in #235v5Pre-Release by @oxisto in #234DecodeSegementtoParserby @oxisto in #278Verify&Signto detail why string is not an advisable input for key by @dillonstreator in #249v5release by @oxisto in #291New Contributors
Full Changelog: golang-jwt/jwt@v4.5.0...v5.0.0
Configuration
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
To execute skipped test pipelines write comment
/ok-to-test.Documentation
Find out how to configure dependency updates in MintMaker documentation or see all available configuration options in Renovate documentation.