Skip to content

fix(security): replace jwt-simple to resolve RSA vulnerability#97

Merged
JanZachmann merged 3 commits intoomnect:mainfrom
JanZachmann:fix/replace-jwt-simple-rsa-vulnerability
Feb 12, 2026
Merged

fix(security): replace jwt-simple to resolve RSA vulnerability#97
JanZachmann merged 3 commits intoomnect:mainfrom
JanZachmann:fix/replace-jwt-simple-rsa-vulnerability

Conversation

@JanZachmann
Copy link
Contributor

@JanZachmann JanZachmann commented Feb 12, 2026

Summary

This PR replaces the 'jwt-simple' library with 'jsonwebtoken' to resolve a security vulnerability in the 'rsa' crate (RUSTSEC-2023-0071) which was a transitive dependency.

Key Changes

  • Replaced 'jwt-simple' with 'jsonwebtoken' in 'src/backend'.
  • Updated 'TokenManager' (HS256) and 'KeycloakProvider' (RS256) to use the new library.
  • Updated backend unit tests to work with the new JWT implementation.
  • Cleared 'Cargo.audit.ignore' as the vulnerability is now resolved.
  • Bumped version to '1.1.1'.

crux_core TypeGen requires pnpm on PATH but never actually uses it.
Provide a no-op stub when pnpm is not installed, matching the existing
Dockerfile workaround.

Signed-off-by: Jan Zachmann <50990105+JanZachmann@users.noreply.github.com>
- Replace jwt-simple with jsonwebtoken in src/backend
- Update TokenManager and KeycloakProvider to use jsonwebtoken
- Clear Cargo.audit.ignore and bump version to 1.1.1
- Update unit tests to use new JWT implementation

Signed-off-by: Jan Zachmann <50990105+JanZachmann@users.noreply.github.com>
@JanZachmann JanZachmann merged commit e15ee65 into omnect:main Feb 12, 2026
3 checks passed
JanZachmann added a commit that referenced this pull request Feb 18, 2026
## Summary
- Fix `InvalidSignature` error in Keycloak portal token validation
caused by the `jwt-simple` → `jsonwebtoken` migration
- `DecodingKey::from_rsa_der()` does not handle the SPKI format Keycloak
returns; replaced with `from_rsa_pem()` and PEM header wrapping
- Extract key conversion into `decoding_key_from_keycloak()` pure
function and add unit tests with a real RSA keypair

## Reason
The `jwt-simple` → `jsonwebtoken` migration (#97) broke Keycloak token
verification. All existing tests mocked
`SingleSignOnProvider::verify_token()` at the trait level, so the actual
RSA key parsing and signature verification had zero test coverage.

## Verification
- `cargo test --features mock` — 3 new tests exercise real RSA key
format conversion and JWT signature verification
- Deployed to device and confirmed portal auth flow succeeds

---------

Signed-off-by: Jan Zachmann <50990105+JanZachmann@users.noreply.github.com>
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.

1 participant

Comments