Skip to content

fix(api): catch remaining JWKS mutation survivors (#130) - #153

Merged
tradem merged 1 commit into
mainfrom
fix/130-caching-jwks-mutants
Aug 1, 2026
Merged

fix(api): catch remaining JWKS mutation survivors (#130)#153
tradem merged 1 commit into
mainfrom
fix/130-caching-jwks-mutants

Conversation

@tradem

@tradem tradem commented Aug 1, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes the six surviving mutation-testing mutants in CachingJwksProvider from issue #130.

  • Use Tokio's monotonic clock for deterministic cache-TTL tests.
  • Add a local Axum JWKS server fixture with RSA signing, encryption, non-RSA, and missing-kid keys.
  • Verify that only the valid RSA signing key is accepted and that it can validate an RS256 token.
  • Test cache reuse, exact TTL expiry, and post-expiry refresh.
  • Decode RSA JWK components as raw bytes and enable jsonwebtoken's RustCrypto backend explicitly.
  • Add the systematic implementation plan to docs/issues/remaining-6-jwks-mutants.md.

Validation

  • cargo fmt --all -- --check
  • cargo test -p api
  • cargo clippy -p api --all-targets -- -D warnings
  • cargo mutants -p api -f crates/api/src/auth/jwks.rs
    • 19 mutants tested
    • 13 caught
    • 6 unviable
    • 0 missed

Acceptance criteria

  • The six TTL and JWK-filtering mutants are caught locally.
  • The CI mutation-testing PR gate will provide the final mutate-security verification.

Co-authored-by: gpt-5.6-luna (opencode-go)

Make JWKS cache expiry deterministic with Tokio's test clock and add a realistic local JWKS server fixture. The fixture covers RSA signing-key filtering and verifies the accepted public key through an RS256 token.

Also enable jsonwebtoken's RustCrypto backend so production JWT verification has an explicit crypto provider.

Tests: cargo fmt --all -- --check
Tests: cargo test -p api
Tests: cargo clippy -p api --all-targets -- -D warnings
Tests: cargo mutants -p api -f crates/api/src/auth/jwks.rs (19 tested: 13 caught, 6 unviable)

Co-authored-by: gpt-5.6-luna (opencode-go)
Co-authored-by: pi agent <pi@agent.local>
@tradem tradem linked an issue Aug 1, 2026 that may be closed by this pull request
2 tasks
@tradem
tradem merged commit 77e688b into main Aug 1, 2026
16 checks passed
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.

Fix remaining 6 surviving mutants in CachingJwksProvider

1 participant