Skip to content

Conversation

@yoshi-taka
Copy link
Contributor

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.

Copy link
Member

@fbartho fbartho left a comment

Choose a reason for hiding this comment

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

I tried, but failed to finish assessing Jose as a library, sorry, but I wanted to post this other content.

I support a better maintained library, but this code feels relatively security sensitive, so I’m worried.

"https-proxy-agent": "^7.0.2",
"hyperlinker": "^1.0.0",
"ini": "^5.0.0",
"jose": "^5.0.0",
Copy link
Member

Choose a reason for hiding this comment

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

This seems like a relatively high-sensitivity dependency. It's good that we're working on using something more maintained.

Would you mind explaining why you're pulling in version 5.0.0 instead of the latest version? (It looks like 6.1.1 is the latest)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for your response.
This article explains the topic very clearly.
https://dev.to/silentwatcher_95/why-you-should-delete-jsonwebtoken-in-2025-1o7n

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since v6 is ESM-only, it won’t run here.

Supported Versions

Version Security Fixes 🔑 Other Bug Fixes 🐞 New Features ⭐ Runtime and Module type
v6.x [Security Policy] Universal[^universal] ESM[^cjs]
v5.x [Security Policy] Universal[^universal] CJS + ESM
v4.x [Security Policy] Universal[^universal] CJS + ESM
v2.x [Security Policy] Node.js CJS

https://github.com/panva/jose

@orta
Copy link
Member

orta commented Nov 15, 2025

This seems reasonable to me, GitHub App based Danger setups are practically non-existent to my knowledge (I added the support for Peril which hasn't seen an update in a long time) and from an eyeball this seems correct 👍🏻

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.

3 participants