refactor: migrate from jsonwebtoken to jose v5 #1498
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.
Why this change
• jsonwebtoken is no longer actively maintained and has accumulated a large dependency tree.
• jose is a modern, actively maintained, and dependency-light alternative with better security posture.
What changed
• Updated token generation/verification logic in Danger.js to use jose.
• Adjusted the code paths to match jose’s async API and stricter type expectations.
The project’s current version (v5) is the last one that supports CommonJS; v6+ is ESM-only, which is incompatible with Danger.js’ CJS execution environment.
Verification
• All existing unit tests are passing.
• Additional validation will be required in downstream workflows, as token handling can differ subtly between libraries (expiration, algorithm defaults, error classes, etc.).
• No functional changes expected, but we should keep an eye on the next CI runs using Danger.
Benefits
• Reduced dependency footprint.
• Better long-term security and maintenance prospects.
• Aligns with current recommendations for jose/JWT handling.