Repository navigation
Conversation
rsa has an unfixed private-key timing advisory (RUSTSEC-2023-0071), so any consumer running cargo-deny/cargo-audit is flagged even if it only verifies ES256 or HMAC tokens. Make rsa, sha2 and rand_core optional under a `ps256` feature, enabled by default so existing PS256 users are unaffected; verify-only consumers can set default-features = false. Algorithm::Ps256 and VerifyingKey::Ps256 remain in all builds so alg identifiers still parse; without the feature, PS256 sign/verify return Error::InvalidAlgorithm. PS256 tests, examples and the bench are gated, and CI runs the suite with --no-default-features. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 19, 2026
zshenker
force-pushed
the
ps256-feature
branch
from
October 19, 2026 21:43
3f4f17a to
948ecfe
Compare
This was referenced Oct 19, 2026
RFC 8230 §2 defines PS256 with a salt length equal to the SHA-256 output (32 bytes). rsa 0.9.10's pss keys already default to that and refuse other lengths, but the behavior was implicit in a library default and the dependency allowed any 0.9.x. Pass the salt length explicitly when signing and verifying, require rsa >= 0.9.10, and add a regression test that signatures with 0-, 20- and 64-byte salts are refused while 32 is accepted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Problem
PS256 makes
rsaa hard dependency.rsahas an unfixed advisory, RUSTSEC-2023-0071 (Marvin, a private-key timing side channel). Every consumer runningcargo-denyorcargo-auditis flagged, even when it only verifies ES256 or HMAC tokens. That includes verify-only services such as a MoQ relay validating tokens under #8, which never sign with RSA.Change
rsa,sha2andrand_coreare now optional, behind a newps256feature. It is on by default, so existing PS256 users are unaffected.default-features = false.Algorithm::Ps256andVerifyingKey::Ps256remain in every build, so algorithm identifiers still parse and no downstreammatchchanges. Without the feature, PS256 signing and verification returnError::InvalidAlgorithm.cfg.required-features.test_ps256_without_feature_is_rejectedcovers the no-feature path.rsadefault, and the minimumrsaversion is 0.9.10. Signatures with any other salt length are refused. This was already the behavior of rsa 0.9.10, and is now explicit and tested.cargo test --no-default-features.Verification
-D warnings) pass, along with 61 unit tests and 74 doctests.--no-default-features: clippy passes, along with 54 unit tests and 74 doctests.test_ps256_requires_rfc8230_salt_lengthcovers 0-, 20-, 32- and 64-byte salts; only 32 is accepted.default-features = falsegets aCargo.lockwith norsa, andcargo auditon it is clean. This repo's own lockfile still listsrsa, because lockfiles always include optional dependencies.🤖 Generated with Claude Code