Skip to content

fix(auth): replace python-jose with PyJWT to drop ecdsa dep#428

Merged
char0n merged 3 commits into
mainfrom
fix/46-replace-python-jose-with-pyjwt
May 20, 2026
Merged

fix(auth): replace python-jose with PyJWT to drop ecdsa dep#428
char0n merged 3 commits into
mainfrom
fix/46-replace-python-jose-with-pyjwt

Conversation

@char0n
Copy link
Copy Markdown
Member

@char0n char0n commented May 20, 2026

Summary

  • Replaces `python-jose[cryptography]` with `PyJWT` to eliminate the transitive `ecdsa` dependency (CVE-2024-23342 / GHSA-wj6h-64fc-37mp)
  • `python-jose` hard-depends on `ecdsa` regardless of which extra is installed; the `ecdsa` project considers side-channel attacks out of scope with no fix planned
  • The codebase uses HS256 only — PyJWT's API is a direct drop-in (`encode`/`decode` signatures are identical; `InvalidTokenError` replaces `JWTError`)
  • Removes 4 packages: `python-jose`, `ecdsa`, `pyasn1`, `rsa`

Addresses Dependabot security alert https://github.com/jentic/jentic-mini/security/dependabot/46.

Test plan

  • All 409 backend tests pass
  • `ruff check` + `ruff format` clean
  • `test_jwt_username.py` (cookie session, bearer JWT, legacy JWT fallback) all pass

🤖 Generated with Claude Code

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>
@char0n char0n requested a review from Copilot May 20, 2026 12:47
@char0n char0n self-assigned this May 20, 2026
@char0n char0n added security Security findings dependencies Pull requests that update a dependency file labels May 20, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.py from python-jose to PyJWT (including exception mapping).
  • Update JWT-related tests to generate tokens using PyJWT.
  • Update project dependencies/lockfile to remove python-jose (and transitive deps) and add PyJWT.

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.

Comment thread pyproject.toml Outdated
Comment thread pyproject.toml
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>
@char0n char0n merged commit f62b56b into main May 20, 2026
9 checks passed
@char0n char0n deleted the fix/46-replace-python-jose-with-pyjwt branch May 20, 2026 12:55
arazzoenginebuilder Bot pushed a commit that referenced this pull request May 20, 2026
## [0.13.2](v0.13.1...v0.13.2) (2026-05-20)

### Bug Fixes

* **auth:** replace python-jose with PyJWT to drop ecdsa dep ([#428](#428)) ([f62b56b](f62b56b))
* **deps:** bump idna from 3.13 to 3.15 ([#415](#415)) ([fae5b01](fae5b01))
@arazzoenginebuilder
Copy link
Copy Markdown

🎉 This PR is included in version 0.13.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file released security Security findings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants