fix(auth): replace python-jose with PyJWT to drop ecdsa dep#428
Merged
Conversation
python-jose hard-depends on ecdsa which has an unfixed Minerva timing attack (CVE-2024-23342, GHSA-wj6h-64fc-37mp). The project considers side-channel attacks out of scope with no planned fix. PyJWT has no ecdsa dependency. The JWT surface is HS256-only so the migration is a direct drop-in with no API changes. Signed-off-by: Vladimir Gorej <vladimir@jentic.com>
There was a problem hiding this comment.
Pull request overview
This PR updates the backend JWT implementation by replacing python-jose with PyJWT, primarily to remove the transitive ecdsa dependency associated with a security advisory.
Changes:
- Swap JWT library usage in
src/auth.pyfrompython-josetoPyJWT(including exception mapping). - Update JWT-related tests to generate tokens using
PyJWT. - Update project dependencies/lockfile to remove
python-jose(and transitive deps) and addPyJWT.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
pyproject.toml |
Replaces python-jose[cryptography] with PyJWT in runtime dependencies. |
uv.lock |
Removes python-jose/ecdsa/rsa/pyasn1 entries and adds pyjwt. |
src/auth.py |
Switches JWT import/exception handling to PyJWT while keeping the existing encode/decode flow. |
tests/test_jwt_username.py |
Updates “legacy JWT” crafting to use PyJWT rather than python-jose. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Keeps pyproject.toml dependency names consistent with the rest of the list. pip normalizes names anyway but the manifest should be uniform. Signed-off-by: Vladimir Gorej <vladimir@jentic.com>
|
🎉 This PR is included in version 0.13.2 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Addresses Dependabot security alert https://github.com/jentic/jentic-mini/security/dependabot/46.
Test plan
🤖 Generated with Claude Code