Skip to content

feat(signing): implement verifier conformance for negative vectors 021-027 - #687

Merged
bokelley merged 4 commits into
mainfrom
bokelley/issue-683
Apr 21, 2026
Merged

bokelley merged 4 commits into
mainfrom
bokelley/issue-683

Conversation

@bokelley

Copy link
Copy Markdown
Contributor

Summary

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). Removed NEGATIVE_VECTORS_UNIMPLEMENTED from the conformance suite. Also fixed a harness bug: the eager canonicalTargetUri(vector.request.url) threw on vector 026's U-label authority before the verifier's own parse-time check could fire — deferred until a replay_cache_entries preload actually needs it.
  • Vector 027 (webhook-authentication downgrade resistance) is new. verifyRequestSignature on the unsigned branch now rejects any request whose JSON body carries a non-empty push_notification_config.authentication anywhere in the tree — nested arrays, any parent key, Content-Type-independent. Closes the captured-bearer → hostile webhook callback path. required_for precedence is preserved.
  • DoS hardened: body size capped at 1 MB (oversized unsigned bodies fail closed since we can't prove absence of webhook auth within the pre-crypto budget); traversal depth capped at 64.
  • Builder: 027 registered as a passthrough mutator (the adversarial shape lives in the fixture body, not a programmatic mutation). Drops the upstream-added UNIMPLEMENTED_VERIFIER_RULE_VECTORS skip 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).
  • Nine new unit tests in request-signing-verifier-api.test.js covering: push_notification_config without authentication, empty authentication: {}, 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).
  • Grader e2e + MCP tests exercise the full 27-negative/12-positive vector set via real HTTP against createExpressVerifier.
  • Code review + security review (AI subagents) — findings addressed: size + depth caps, required_for precedence comment, double-recursion fix on push_notification_config subtree, tightened scan wording.

🤖 Generated with Claude Code

bokelley and others added 3 commits April 21, 2026 05:32
…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]>
@bokelley bokelley closed this Apr 21, 2026
@bokelley bokelley reopened this Apr 21, 2026
# Conflicts:
#	test/request-signing-vectors.test.js
@bokelley
bokelley merged commit 4116ea5 into main Apr 21, 2026
12 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.

request-signing: extend reference verifier to grade negative vectors 021–027

1 participant