test+docs: hinted P-384 review tests and forward-compat documentation#31
Closed
Willyham wants to merge 1 commit into
Closed
test+docs: hinted P-384 review tests and forward-compat documentation#31Willyham wants to merge 1 commit into
Willyham wants to merge 1 commit into
Conversation
Follow-up to #28 (hinted P-384 Nitro attestation verification). Adds focused tests covering hint-verification soundness and signature/cache/replay semantics, and documents the attestation parser's forward-compatibility limitations, which were previously undocumented. Tests (added to existing files, reusing the real fixture and helpers): - HintedNitroAttestation.t.sol: non-canonical (unreduced) inverse hint is sound, modulus-confusion hint reverts, corrupted signature never accepts under any hint stream, malleable twin (r, n-s) is accepted, and there is no on-chain anti-replay. Adds a U384TestWrapper to exercise the hinted U384 primitives (modinv / moddivAssign) directly. - IndefiniteLengthCbor.t.sol: skipped forward-compat specs for unknown-key tolerance and nested indefinite-length pcrs parsing, co-located with the regression tests that pin current behaviour. - CertManager.t.sol: skipped spec documenting the verifiedParent first-writer-wins cache-griefing edge (requires a same-key-renewed CA fixture to realise). Docs: - docs/hinted-p384-nitro-attestation.md: new "Forward-compatibility" section. - README.md: forward-compatibility note under Security considerations. - NitroValidator.sol: NatSpec on _parseAttestation recording that the strict key whitelist / lack of nested indefinite-length support is liveness-only (can only revert, never a false accept) but forward-incompatible with AWS attestation-format changes. No production logic changes; src edits are NatSpec/comments only. Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
|
Superseded by #33, which rebases this onto current |
Contributor
|
Closing in favour of #33. |
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.
Follow-up to #28 (hinted P-384 Nitro attestation verification). This PR adds focused tests from a security review of the hinted change, and documents an attestation-parser forward-compatibility limitation that was previously undocumented.
Summary of the review
The hinting change is sound: every off-chain inverse is re-checked on-chain with
b·inv ≡ 1 (mod m), the moduli are prime so the inverse is unique, and every later operation reduces mod the correct modulus — so a wrong/non-canonical hint can only revert, never forge. No false-accept path was found. The substantive findings are about liveness and integrator responsibilities, not forgery.Tests (added to existing files, reusing the real fixture + helpers)
test/hinted/HintedNitroAttestation.t.soltest_UnreducedInverseHintIsSound— a non-canonical inverse hint (inv + p) passes the on-chain check and yields the identical reduced result, so it can't change the accept decision (exercised at the U384 level via a newU384TestWrapper).test_ModulusConfusionHintReverts— a hint valid modnis rejected where modpis expected.test_CorruptedSignatureNeverAccepts— no attacker hint stream (empty / garbage / original-valid / padded) makes a corrupted signature verify.test_MalleableTwinSignatureAccepted—(r, n-s)also verifies (intentional,CURVE_LOW_S_MAX = n-1); decodes to the identical attestation, so signature bytes must not be used as a uniqueness key.test_AttestationReplayHasNoOnChainProtection— the same(tbs, sig)verifies repeatedly; freshness/replay is the integrator's responsibility.test/IndefiniteLengthCbor.t.sol— twovm.skip'd forward-compat specs (unknown-key tolerance; nested indefinite-lengthpcrsparsing), co-located with the regression tests that pin current behaviour.test/CertManager.t.sol—vm.skip'd spec documenting theverifiedParentfirst-writer-wins cache-griefing edge (requires a same-key-renewed CA fixture to realise).Docs
docs/hinted-p384-nitro-attestation.md— new "Forward-compatibility (attestation format changes)" section.README.md— forward-compatibility note under Security considerations.src/NitroValidator.sol— NatSpec on_parseAttestation: the strict key whitelist and lack of nested indefinite-length support are liveness-only (can only revert, never a false accept) but forward-incompatible with AWS attestation-format changes. Tolerating unknown keys would be safe (all fields are under AWS's COSE signature).Notes
srcedits are NatSpec/comments only.🤖 Generated with Claude Code