chore(security): ignore RUSTSEC-2023-0071, gate jwt backend#49
Conversation
Document and suppress the "Marvin Attack" advisory (timing sidechannel in `rsa` 0.9.x) for both cargo-deny and cargo-audit: - deny.toml: ignore with full rationale - .cargo/audit.toml: mirror the ignore No fix exists (latest `rsa` is 0.10.0-rc; advisory patched:[]). We keep jsonwebtoken's pure-Rust `rust_crypto` backend over `aws_lc_rs` (C FFI), required by no-FFI consumers. RSA is used for JWT verification (public key) only, so the private-key timing attack is not reachable here. Also expose the jwt crypto backend as crate features so consumers can opt into the constant-time aws_lc_rs backend without forking: - rust_crypto (default, pure Rust) / aws_lc_rs (opt-in, C FFI) - backends are mutually exclusive; CI runs an explicit per-backend matrix instead of `--all-features` Tracking: #48
Gates CI on RustSec advisories via cargo-deny, which reads the ignore list in deny.toml (RUSTSEC-2023-0071). Operates on Cargo.lock without compiling, so it is unaffected by the mutually-exclusive jwt backends. Part of #48
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughAdds mutually exclusive ChangesDual crypto backend feature flags, compile-time guards, CI matrix, and advisory suppression
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@Cargo.toml`:
- Around line 86-97: Add compile-time guard macros in src/lib.rs to enforce
mutually exclusive JWT backend configuration. Create two compile_error! guards:
one that triggers when both rust_crypto and aws_lc_rs features are enabled
together, and another that triggers when neither feature is enabled. This
ensures invalid feature combinations are caught at compile time rather than
causing runtime panics in the jsonwebtoken crate.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 666704c0-af5d-40f2-98f4-48fa8edd5c40
📒 Files selected for processing (4)
.cargo/audit.toml.github/workflows/ci.ymlCargo.tomldeny.toml
|
| Filename | Overview |
|---|---|
| .cargo/audit.toml | New file mirroring the deny.toml advisory ignore for cargo-audit; well-documented with clear rationale |
| deny.toml | New file adding structured cargo-deny configuration; RUSTSEC-2023-0071 ignore is properly justified with inline rationale and issue link |
| Cargo.toml | Exposes jwt crypto backend as mutually exclusive crate features (rust_crypto default, aws_lc_rs opt-in); jsonwebtoken switched to default-features = false + use_pem |
| .github/workflows/ci.yml | Replaces --all-features with a per-backend matrix and adds a Security Audit job; third-party actions are correctly SHA-pinned |
| src/lib.rs | Adds compile_error! guards to turn jsonwebtoken's runtime panic on invalid backend combinations into a build-time error; doc comment updated |
Reviews (2): Last reviewed commit: "feat(auth): guard mutually-exclusive jwt..." | Re-trigger Greptile
Enabling both `rust_crypto` and `aws_lc_rs` (or neither) makes jsonwebtoken fall back to a provider that panics on first use. Turn that runtime failure into a compile_error! so a misconfigured feature set is caught at build time. Also document the backend choice in the crate-level docs. Part of #48
Summary
Document and suppress RUSTSEC-2023-0071 ("Marvin Attack", timing sidechannel in
rsa0.9.x), and add a CI gate so the decision is enforced, not implicit.Dependency chain:
rsa 0.9.10 -> jsonwebtoken (rust_crypto) -> structured-proxy.Why ignore (not fix)
rsais0.10.0-rc; the advisory haspatched: []/unaffected: []in the RustSec DB. Nothing to upgrade to.rust_cryptooveraws_lc_rs(C FFI), required by no-FFI consumers (e.g. CoordiNode ADR-013).DecodingKey+decode(),src/auth/mod.rs:115). Marvin leaks the private key via private-op timing (decrypt/sign), which never runs on the verify path. The onlyEncodingKey/encodeusage is inside#[cfg(test)]and uses Ed25519, not RSA.Changes
deny.toml: ignoreRUSTSEC-2023-0071(struct form withreason) + full rationale comment..cargo/audit.toml: mirror the ignore for standalonecargo audit.Cargo.toml: expose jwt crypto backend as crate features —rust_crypto(default, pure Rust) /aws_lc_rs(opt-in, constant-time, C FFI). Backends are mutually exclusive;jsonwebtokenis nowdefault-features = false+use_pem..github/workflows/ci.yml:--all-featureswith a per-backend matrix (both backends can't be enabled together — jsonwebtoken panics at runtime otherwise);Security Auditjob runningcargo-deny check advisories(readsdeny.toml).Testing
cargo nextest run— 121/121 passed on both backends (rust_cryptoandaws_lc_rs).cargo clippy --all-targets -Dwarnings+cargo fmt --check— clean.cargo deny check advisories→advisories ok;cargo audit→ exit 0.cargo auditfail on RUSTSEC-2023-0071; with it, it passes.Cargo.lockunchanged — default dependency graph and default backend are identical.Follow-up
Remove the ignore once RustCrypto ships a constant-time
rsastable release.Closes #48