Skip to content

fix(compliance): emit the two outlier 3.1 Signature tokens as unpadded base64url - #8245

Merged
bokelley merged 4 commits into
3.1.xfrom
conductor/fix-3-1-signature-encoding
Oct 16, 2026
Merged

bokelley merged 4 commits into
3.1.xfrom
conductor/fix-3-1-signature-encoding

Conversation

@bokelley

@bokelley bokelley commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

What

Two of the 37 signed request-signing vectors emitted their Signature token as padded standard base64 instead of the unpadded base64url the AdCP 3.1 profile requires. A strict, explicitly 3.1-pinned verifier rejects them with request_signature_header_malformed, which blocks SDK adoption.

  • positive/002-post-with-content-digest.json — failed at step 1 instead of verifying.
  • negative/018-digest-covered-when-forbidden.json — failed at step 1 for the wrong reason instead of reaching its intended request_signature_components_unexpected at step 6.

Unpinned verifiers lenient-decode both alphabets, which is why existing coverage missed it.

Nothing is re-signed

Each token decodes to the same 64 signature bytes and is re-encoded. Verified mechanically against base f4d53b8a8 for both vectors:

check result
everything except headers.Signature / $comment byte-identical ✅
signature bytes identical (64 B) ✅
token 88ch → 86ch, old matched [+/=], new matches ^[A-Za-z0-9_-]+$ ✅

Request bodies, Content-Digest, Signature-Input, expected_signature_base and the Ed25519 key material are untouched.

Why Content-Digest is not also fixed here

An earlier draft of this change claimed Content-Digest was named only by "older prose". That was wrong and is corrected in all three places it appeared (vector $comment, changeset, test comment): the same security.mdx rule names Content-Digest alongside Signature.

The real reason it is out of scope is concrete — content-digest is a covered component, so its literal field value is part of expected_signature_base. Re-encoding it would change the signed base and require a genuine re-sign, which this change deliberately does not do. It remains a separately tracked historical discrepancy; this PR neither resolves it nor claims to.

The test comment also records the corollary: a verifier rebuilds the base from the verbatim received field bytes and MUST NOT normalise Content-Digest to base64url first, or these vectors will fail to verify.

Test changes

tests/request-signing-vector-bodies.test.cjs asserted the RFC 8941 default rather than the AdCP override.

  • Strict unpadded-base64url decode with a canonical round-trip; deterministic Ed25519 re-sign compared in the same encoding.
  • New corpus guard. The grammar was previously enforced on only 2 of 37 vectors. It now runs over every Signature token in all 37 signed vectors (38 tokens), allowlisting the 3 deliberately unsigned vectors, with both counts pinned so a new vector cannot silently skip it.
  • Guard mutation-tested, not assumed: injecting a +/ token and injecting a == padded token each make it fail with the intended message. Vectors restored and re-verified byte-identical after each injection.
  • Known limit stated inline: only 17 of 38 tokens carry - or _, because many negative vectors use an alphabet-neutral dummy signature. For the other 21 the two alphabets render identically, so the guard enforces the no-padding/canonical half on them and cannot distinguish alphabets even in principle. That is inherent to those tokens, not a gap in the check.
  • Removed the tautological per-file negative controls. The standard-alphabet form of 64 bytes is always 88 chars ending ==, so comparing it against a token that already matched /^[A-Za-z0-9_-]+$/ can never fail — confirmed over 200k random signatures. What remains is the meaningful assertion that each corrected token carries a base64url-distinctive character. A future legitimate re-sign landing on a token with neither - nor _ (~6.8% of re-signs) is a fixture change needing review, not a runtime defect; the failure message says so.

No SDK parser weakening. The strict parser is the thing being satisfied, not relaxed.

Profile scope — directory, not branch

The two encoding profiles are separated by directory, not by branch:

corpus -/_ tokens standard tokens
main, legacy root positive/+negative/ 22 0
main, sibling profile-3.2/ 1 45

These root positive//negative/ directories are the legacy 3.0/3.1 corpus on both lines, and main's own positive/002 is already unpadded base64url. So this change brings 3.1.x's two outliers into line with main's root vectors rather than diverging from them.

The standard-alphabet 3.2 corpus lives in the sibling profile-3.2/ directory (on main, exercised by tests/request-signing-profile-3.2-vectors.test.cjs). This base64url grammar must not be applied to profile-3.2/, where the standard alphabet is correct. No blanket take-ours/take-theirs claim about these paths is intended.

An earlier revision of this PR claimed a branch-wide 3.2 inversion and a per-line forward-merge resolution. That was wrong — it overlooked profile-3.2/ — and is corrected in the changeset, the test comment and here. Note also that tests/request-signing-vector-bodies.test.cjs has never existed on main, so it cannot conflict there.

Scope

Three files: the changeset, positive/002 ($comment only), and the test file. The four reviewed storyboard YAMLs are untouched and byte-match .context/reviewed-tip-manifest.txt.

🤖 Generated with Claude Code

bokelley and others added 2 commits October 16, 2026 16:24
…se64url

positive/002-post-with-content-digest.json and
negative/018-digest-covered-when-forbidden.json were re-signed with padded
standard base64 when operation-valid bodies were backported. They were the
only 2 of 37 request-signing vectors in the standard alphabet.

docs/building/by-layer/L1/security.mdx overrides RFC 8941 for this profile:
Signature MUST be emitted as base64url without padding, and a signer emitting
+, / or = is non-conformant. Verifiers only SHOULD lenient-decode pure standard
base64, so a strict verifier may reject these with
request_signature_header_malformed - which is what the maintained SDK does on
an explicit 3.1 pin. Both tokens are pure standard rather than mixed alphabet,
so this is the emission rule, not the mixed-token rejection rule.

Effect on an explicitly 3.1-pinned verifier: positive/002 failed at step 1
instead of verifying, and negative/018 failed at step 1 for the wrong reason
instead of reaching request_signature_components_unexpected at step 6.
Unpinned verifiers accept both alphabets, which is why existing coverage
missed it.

Each token decodes to the same 64 signature bytes and is re-encoded, so
nothing is re-signed. Bodies, Content-Digest, Signature-Input,
expected_signature_base and key material are untouched. Content-Digest keeps
its historical standard-base64 form, which the maintained SDK still accepts;
the older prose that also names Content-Digest is deliberately out of scope.

positive/002's $comment asserted the padded-standard grammar, so it was a
false claim about its own bytes once re-encoded; it now states the profile
override and the Content-Digest scope. negative/018's comment makes no
encoding claim and is unchanged.

tests/request-signing-vector-bodies.test.cjs enforced the RFC 8941 default
copied from 3.2. It now checks unpadded-base64url grammar with a canonical
round-trip, uses the standard-alphabet and padded forms of the same bytes as
negative controls, and compares the deterministic Ed25519 re-sign in the same
encoding. The truthful Content-Digest check is unchanged, with its scope
stated inline.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
… signed corpus

Review follow-ups on the 3.1 Signature re-encoding. No fixture bytes change.

The earlier wording claimed Content-Digest was named only by "older prose".
That is wrong: the same security.mdx rule names Content-Digest alongside
Signature. All three places (vector $comment, changeset, test comment) now
state the true reason it is out of scope here - content-digest is a covered
component, so its literal field value is part of expected_signature_base and
re-encoding it would change the signed base and require a genuine re-sign.
The discrepancy is tracked separately; this change does not claim to resolve it.

The grammar was enforced on only 2 of 37 signed vectors. A corpus guard now
applies it to every Signature token across all 37 (38 tokens), allowlisting the
3 deliberately unsigned vectors and pinning both counts so a new vector cannot
silently skip it. Its known limit is stated inline: only 17 of 38 tokens carry
'-' or '_', so for the rest the two alphabets render identically and the guard
enforces the no-padding half of the grammar.

The two per-file negative controls were tautological (the standard form of 64
bytes is always padded). They are replaced by an assertion that each corrected
token actually carries a base64url-distinctive character, proving the re-encode
was real rather than a no-op.

Records that this is a 3.0/3.1-only profile: 3.2 inverts it and MUST reject
base64url, so this commit must not be forward-ported to 3.2/main.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@bokelley
bokelley requested a review from a team as a code owner October 16, 2026 16:55

@aao-secretariat aao-secretariat Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ladon verdict: Approve

Approve — clean, tightly-scoped 3.1.x compliance fixture fix with no blocking or medium findings.

What I checked:

  • No critical/high/medium findings (rows 1, 4, 5, 8 do not fire).
  • gated_paths: false → row 2 does not fire.
  • high_risk: false, no deleted/modified high-risk entries → rows 3, 5 do not fire.
  • No no-auto-approve team match → row 7 does not fire.
  • No prior decision → row 6 does not fire.
  • Falls through to row 9 → approve.

The PR re-encodes the two outlier request-signing Signature tokens (positive/002, negative/018) from padded standard base64 to unpadded base64url per the security.mdx "Binary value encoding" override. The re-encode preserves the 64 Ed25519 bytes by construction, the new corpus guard correctly rejects any +/ or = token across all 38 tokens with pinned counts, and the deterministic re-sign compares in base64url. dist/** immutable artifacts untouched; changeset present and correctly scoped patch.

bokelley and others added 2 commits October 16, 2026 17:05
…l tautology

Review follow-ups. Prose and tests only - no fixture bytes change. Signature
tokens, bodies, Content-Digest, expected_signature_base, key material and the
four reviewed scenario YAMLs are all byte-identical.

The forward-port warning rested on a false premise and is corrected. The two
encoding profiles are separated by DIRECTORY, not by branch: the root positive/
and negative/ directories are the legacy 3.0/3.1 corpus on both lines, and on
main those same root vectors are already unpadded base64url - so this change
brings 3.1.x's two outliers into line with main rather than diverging from it.
The standard-alphabet 3.2 corpus lives in the sibling profile-3.2/ directory.
The grammar must not be applied there. No blanket take-ours/take-theirs claim.

The previous commit claimed to remove tautological assertions but left one:
comparing the standard-alphabet form of 64 bytes against a token that already
matched /^[A-Za-z0-9_-]+$/ can never fail, because the standard form is always
88 chars ending '=='. Removed. The meaningful [_-] assertion is kept and now
says to re-verify by hand, since a future legitimate re-sign landing on a token
with neither character is a fixture change needing review, not a runtime defect.

The verbatim-bytes note is scoped to these two vectors, which cover
content-digest without RFC 9421's ';sf' parameter; behaviour under ';sf' is not
decided here. The Content-Digest deferral is stated as what it is - a scope
choice to keep this a pure re-encode - rather than a technical obstacle.

Accuracy fixes: the comment named Buffer.from(..., 'base64') where the code
calls 'base64url'; "canonical-length" is really canonical-trailing-bits, and the
alphabet-neutral dummies decode to 66 bytes so no length property holds for
them; the pinned counts now carry assertion messages and note that this 37 is a
different 37 from the routed-fixture count.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The sentence mixed two bases: it gave the subset excluding the two corrected
tokens (36) but the distinctive count for the full corpus (17). Measured totals
are 38 tokens = 17 base64url-distinctive + 21 alphabet-neutral; excluding the two
corrected tokens the split is 36 = 15 + 21. Replaced with the plain full-corpus
statement so the numbers share one base. Changeset prose only.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

@aao-secretariat aao-secretariat Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ladon verdict: Approve

Approve — clean subsequent pass with no blocking findings.

This PR re-encodes two 3.1 request-signing test vectors plus a changeset and test adjustment (4 files, +124/-25). The reviewer found no Critical/High/Medium findings. The delta over the prior approved run is prose/comment clarification plus a sound simplification (removing a tautological assert.notEqual in tests/request-signing-vector-bodies.test.cjs); the surviving assert.match(encodedSignature, /[_-]/) and the base64url deterministic re-sign preserve the "re-encode was real" coverage guarantee.

Gate checks: no no-auto-approve team match; gated_paths is false; high_risk is false; review_decision is APPROVED. Prior decision was also approve with no findings. No decision-table trigger (rows 1–8) fires, so the outcome falls through to row 9 = approve.

@bokelley bokelley added the ladon/force-review Force Ladon to review the next eligible PR event label Oct 16, 2026 — with conductor.build App

@aao-secretariat aao-secretariat Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ladon verdict: Approve

Approve — clean re-encode of request-signing Signature tokens.

The delta is a pure re-encode of two request-signing Signature tokens (positive/002, negative/018) from padded standard base64 to unpadded base64url (+→-, /→_, == stripped), decoding to the same 64 bytes with canonical round-trip preserved. Nothing re-signed. The test rewrite adds a decodeBase64UrlUnpadded helper with alphabet + round-trip check plus a corpus guard over all 37 signed vectors (38 tokens) with pinned counts and a correctly-scoped unsigned allowlist. No stale encoding claim remains in negative/018's $comment.

No blocking findings. No medium findings. high_risk is false, gated_paths is false, no no-auto-approve team match, and review_decision is APPROVED. No decision-table trigger (rows 1–8) fires; falls through to row 9.

@bokelley
bokelley merged commit 484d2e3 into 3.1.x Oct 16, 2026
13 checks passed
@bokelley
bokelley deleted the conductor/fix-3-1-signature-encoding branch October 16, 2026 17:33
sujanchalla0510 pushed a commit to sujanchalla0510/adcp that referenced this pull request Oct 18, 2026
…main

Merge the published v3.1.29 maintenance release (tag v3.1.29,
f082c7a, the adcontextprotocol#8247 Version Packages
merge on 3.1.x) into main as a record-only merge. v3.1.29 descends from
v3.1.28 (f4d53b8, adcontextprotocol#8069), so both releases' records come in.

The merge keeps main's tree (ours strategy) and adds only:

- dist/schemas/3.1.28/, dist/schemas/3.1.29/, dist/compliance/3.1.28/,
  dist/compliance/3.1.29/ and the signed dist/protocol/3.1.28.tgz* and
  3.1.29.tgz* tuples, byte-identical to the tag.
- CHANGELOG.md: the 3.1.29 and 3.1.28 blocks, verbatim from the tag,
  above main's 3.1.27 block.
- dist/schemas/index.json: regenerated by build:schemas; v3.1 and
  latest_by_minor 3.1 now 3.1.29. latest.json is unchanged (3.2.5).

The 3.1.27..3.1.29 source changes (adcontextprotocol#7907, adcontextprotocol#8020, adcontextprotocol#8234, adcontextprotocol#8237, adcontextprotocol#8245)
are 3.1-line adaptations of fixes main already carries in its own form
(adcontextprotocol#7580, adcontextprotocol#7583, adcontextprotocol#7617, adcontextprotocol#8235; main's root request-signing vectors are
already unpadded base64url), so no 3.1.x source, tests or tooling are
taken. The second parent records that reconciliation so the next 3.1.x
forward merge starts from v3.1.29.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ladon/force-review Force Ladon to review the next eligible PR event

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant