Repository navigation
feat(signing): implement verifier conformance for negative vectors 021-027 - #687
Merged
Merged
Conversation
…1-027 Closes #683. The RFC 9421 reference verifier now enforces the full #verifier-checklist-requests + #webhook-security profile against the seven negative conformance vectors that had been skipped since #631. Vectors 021-026 were already implemented library-side (duplicate Signature-Input labels, multi-valued content-type / content-digest, unquoted string params, JWK alg/crv consistency, non-ASCII @authority); the conformance suite was skipping them via `NEGATIVE_VECTORS_UNIMPLEMENTED`. Removing that skip-list surfaced one harness bug: the test runner's eager `canonicalTargetUri(vector.request.url)` threw on vector 026's U-label authority before the verifier's own parse-time check could fire. Deferred the precompute until a `replay_cache_entries` preload actually needs it. Vector 027 (webhook-authentication downgrade resistance) required new verifier logic and builder registration: - `verifyRequestSignature` on the unsigned branch now rejects any request whose JSON body carries a non-empty `push_notification_config.authentication` anywhere in the tree — inside nested arrays, under any parent key, and regardless of `Content-Type`. Closes the captured-bearer-token -> hostile webhook callback redirect path; `required_for` precedence is preserved so an operation already on the always-sign list still gets the more specific error message. - DoS hardened: body size capped at 1 MB (oversized unsigned bodies fail closed with `request_signature_required` since we can't prove absence of webhook auth within the pre-crypto budget), traversal capped at depth 64 so pathologically nested JSON can't blow the stack. - Builder registers 027 as a passthrough mutator since the adversarial shape lives in the fixture body, not a programmatic mutation. Test coverage: nine new unit tests in `request-signing-verifier-api.test.js` lock the surface around the conformance vector — present-without-auth, empty auth, null auth, string-typed auth, array-nested auth, non-JSON body, oversized body, and signed requests carrying auth material (must reach the crypto path, not re-reject at step 0). Grader e2e + MCP tests drop the upstream-added `UNIMPLEMENTED_VERIFIER_RULE_VECTORS` skip introduced in #682; full suite 4502 pass / 0 fail / 6 skipped. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
# Conflicts: # test/request-signing-vectors.test.js
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.
Summary
Closes #683. The RFC 9421 reference verifier now enforces the full
#verifier-checklist-requests+#webhook-securityprofile against the seven negative conformance vectors that had been skipped since #631.Content-Type/Content-Digest, unquoted string params, JWK alg/crv consistency, non-ASCII@authority). RemovedNEGATIVE_VECTORS_UNIMPLEMENTEDfrom the conformance suite. Also fixed a harness bug: the eagercanonicalTargetUri(vector.request.url)threw on vector 026's U-label authority before the verifier's own parse-time check could fire — deferred until areplay_cache_entriespreload actually needs it.verifyRequestSignatureon the unsigned branch now rejects any request whose JSON body carries a non-emptypush_notification_config.authenticationanywhere in the tree — nested arrays, any parent key, Content-Type-independent. Closes the captured-bearer → hostile webhook callback path.required_forprecedence is preserved.UNIMPLEMENTED_VERIFIER_RULE_VECTORSskip from fix(signing): register vector 027 + skip in verifier conformance #682 in the grader e2e + MCP tests.Test plan
npm test— 4502 pass / 0 fail / 6 skipped (unchanged baseline).request-signing-verifier-api.test.jscovering:push_notification_configwithoutauthentication, emptyauthentication: {},authentication: null, string-typed authentication, array-nested authentication, non-JSON body, oversized body (DoS cap), and signed requests carrying auth material (must reach the crypto path, not re-reject at step 0).createExpressVerifier.push_notification_configsubtree, tightened scan wording.🤖 Generated with Claude Code