Skip to content

Grant signing accepts the Delegated SD-JWT layout and the newer key-binding type (#473) - #474

Merged
dzuluaga merged 24 commits into
mainfrom
fix/473-delegated-sdjwt-layout
Nov 21, 2026
Merged

dzuluaga merged 24 commits into
mainfrom
fix/473-delegated-sdjwt-layout

Conversation

@TheBlackBit

@TheBlackBit TheBlackBit commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Before and after

Signing a spending grant on the phone with a development build of the updated Multipaz Wallet (not released yet), against the same store, once running main and once running this change:

❌ Before — main: ✗ presentation carries no key-binding JWT — video
✅ After — this change: the grant is authorized, trust level device-signed — video

What a test can show: the wallet's answer from an earlier run is saved (fixtures/multipaz-delegated-presentation.json) and replayed. It proves the signing page's checks accept a real wallet answer and that a merchant's checks get as far as the agent's own step. It does not reproduce authorized, which needs the gate's secret.

In plain terms

Sam asks Claude for a $300 spending grant, opens the approve link on their phone and signs with their wallet. The wallet signed, but the page said it found no signature and the grant stayed pending. The updated wallet puts its signature in a different place and spells its type a little differently. The page now understands both the old and the new version.

Fixes #473: grant signing refused the answer of the updated Multipaz Wallet.

What you're approving

  • The signing page accepts the new layout and the new spelling, and still accepts the old ones.
  • The signing page refuses what it refused before, except two things it now accepts on purpose: the new answer layout, and the signature type spelled kb-sd-jwt+kb. The merchant side is looser in two ways too: a merchant's verifier now accepts the wallet's step typed kb-sd-jwt+kb (0.6.0 accepted only kb+sd-jwt+kb), and the agent's last step typed kb-sd-jwt as well as kb+sd-jwt, as AP2's own verifier does. If a check were wrong, the worst case is a bad presentation being accepted; the tests cover each way that could happen.
  • Trust level stays device-signed: a key the credential names signed this. It does not say who issued the credential.
  • Terms: the key binding is the holder's signature over the answer; sd_hash is the checksum of the credential and the parts of it that were revealed; a disclosure is one revealed part.

How to test

npm test

All tests should pass. To see the controls matter, delete the sd_hash comparison in presentation.ts: three tests fail ("a key binding whose sd_hash does not cover the disclosures presented", "an sd_hash that does not cover the credential's chain", and the replay's "credential's disclosure dropped"). Delete the disclosure check in verify.ts: one fails ("a disclosure behind the key binding that delegate_payload does not commit to"). All are in presentation.test.ts.


For reviewers — the detail

  • Layout. The new wallet answers <SD-JWT>~~<KB-JWT>~<disclosure>~ (Delegate SD-JWT draft §5.1.1); the old one ended with the KB-JWT. splitPresentation in presentation.ts reads both. sd_hash covers the credential chain before the extra ~, as in the SDK's buildKbJwt, so that check is unchanged.
  • Disclosures behind the key binding are not covered by sd_hash. verify.ts requires each to be byte-equal to one the gate asked for, after the existing check that delegate_payload holds the grant's digests.
  • Stored form. The presentation is stored in the old layout, so the chain code that spends it is unchanged.
  • Key-binding type. Draft -00 itself uses both spellings: kb+sd-jwt+kb in §5.1.4 and kb-sd-jwt+kb in §6 (the review of openwallet-foundation/multipaz pull request 2178 reports that a later draft settled on the second; I could read only -00). The wallet picks the type; the gate's request names none. The signing page and ap2/chain/verify.ts accept either spelling, so a grant is not authorized and then refused at purchase. Any other spelling is refused. The merchant's chain verifier alone also accepts both kb+sd-jwt and kb-sd-jwt for the agent's last step, as AP2's Python SDK does; the signing page sees only the wallet's step and does not.
  • Tests. Layout accepted both ways; refused for wrong sd_hash, nonce, audience, mandates, forged holder key, forged disclosure, nothing behind the ~~, and a key binding that is not three base64url parts (including =, + and /). The real wallet answer is replayed, through the signing page's checks and through the merchant's. A grant signed in the new layout is spent and verified at the merchant. The new spelling is covered on the signing page and the chain verifier.
  • Merchants on 0.6.0 refuse a spending grant this wallet signs (their chain verifier accepts only kb+sd-jwt+kb). Update together; the changelog says so.

🤖 Generated with Claude Code

…inding type (#473)

The updated Multipaz wallet answers `<SD-JWT>~~<KB-JWT>~<disclosures>~`, with the key binding in
the middle; the signing page read the last part and refused with "presentation carries no
key-binding JWT". It now reads both layouts, checks `sd_hash` over the credential's chain, requires
any disclosure behind the key binding to be one the gate asked for, and stores the presentation in
the earlier shape so the chain code that spends it is unchanged.

That wallet also types the key binding `kb-sd-jwt+kb`, the draft's newer spelling. The signing page
and the chain verifier accept either spelling for a hop that names a further key.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Ever Morales <ever.morales@koombea.com>
Comment thread CHANGELOG.md Resolved
@claude

claude Bot commented Nov 19, 2026

Copy link
Copy Markdown

Claude review

Verdict: ⛔ Needs changes

This lets the grant signing page read the newer Multipaz Wallet's answer, which puts the signature in the middle instead of at the end. I found no way to get a forged answer accepted, but one new test doesn't test what it says, and nothing shows the fix working with the real wallet.

Fix before merging

  1. The test “nothing after the gap is refused” never builds the new layout: the simulated wallet drops that option when told to leave the signature out. So the unsigned new-layout answer the issue asked about is never tried. Make the simulated wallet honour both options, and assert on the new layout.
  2. The issue said the checksum in the real wallet's signature couldn't be reproduced, and the tests can't catch a mismatch, since the simulated wallet and the page hash the same bytes. If they differ, the person's phone still shows a refusal while the changelog says it's fixed. Replay one captured phone answer as a test, or say in the PR and changelog that it hasn't been tried on a phone.

Worth a look

  • No test spends a grant signed the new way.
  • The changelog should say stores still on 0.6.0 refuse permissions this wallet signs.
  • A signature token with an extra dot-separated part is now accepted, then can't be spent.
  • Comments above the checksum check still describe the old layout.
  • kbDisclosureOverride breaks its siblings' override… naming; rename it before release.
Details for the author

Scope: full, 51d64d6..8735216 (one commit; not a release PR). Every finding below also has an inline comment.

Fix before merging

  1. packages/credentagent-gate/src/ceremony/intent-sign/presentation.test.ts:648-652 · REVIEW.md §2, the bypass-test rule · CONFIRMED. simulate.ts:185-188 sets presentation = disclosed for omitKeyBinding before delegatedLayout is read (simulate.ts:219, the else branch). So the input is <jwt>~<d>~, with no ~~; it takes the earlier-layout branch and is refused at presentation.ts:132, the same path as the test at line 188. The refusals at presentation.ts:84 and :86 are untested: reduce 84 to a bare rest.pop() and delete 86, and every test stays green. Without 86, normalized is the truthy string <chain>undefined, so verify.ts:281 would pass an answer with no key binding that a custom IntentVerifyBackend accepted. The issue's acceptance list asks for this case on the new layout.
  2. packages/credentagent-gate/src/ceremony/intent-sign/presentation.ts:208 · REVIEW.md §5 (the Before and after must be real) and §6 (the changelog claim) · CONFIRMED that the PR shows no evidence. Whether a phone run passes is the unproven step: it depends on the real wallet's sd_hash bytes. The issue's comment says: “I could not reproduce the value in the logged token from any prefix … This has to be settled before the fix.” The PR repeats the buildKbJwt reading without saying how that was settled. dev-wallet.ts:87 hashes presented, which equals parts.chain, so no test can see a mismatch. The first two versions of the description (19:32 and 19:33) said it was run on a phone without a recording; the current one (19:34) doesn't. This fails closed, so it is not a bypass.

Worth a look

  1. packages/credentagent-gate/src/grants.agent-key.test.ts:199-211 · test coverage for the PR's “not authorized and then refused at purchase” · CONFIRMED gap. By trace, the spend passes. The new test stops at authorized. The only spend test (lines 77-103) uses the earlier layout. verify.test.ts:164 builds its chain with test-wallet.ts. The comment at lines 199-200 now describes the test at line 213.
  2. CHANGELOG.md:89-95 · §6, Principle 9 (honest versioning) · CONFIRMED. At v0.6.0, chain/verify.ts:154 is typ !== wants, which accepts kb+sd-jwt+kb only. The stored presentation keeps the wallet's kb-sd-jwt+kb key binding (presentation.ts:87, serialize.ts:73), so merchants on 0.6.0 refuse with code: 'typ'. “The gate still sends kb+sd-jwt+kb” is true only of the simulator (dev-wallet.ts:81); the request names no typ (mandates.ts:252-258). Not announced: SimulateOptions.delegatedLayout and kbDisclosureOverride (compare cardShape, lines 43-44), and the re-serialized intent.presentation.
  3. packages/credentagent-gate/src/ceremony/intent-sign/presentation.ts:234 · correctness; contradicts “refuses everything it refused before” · CONFIRMED. I read the decoder in the published @sd-jwt/core 0.20.1 source. Before, the code ran the key binding through decodeJwt, which requires exactly three parts and otherwise throws “Invalid JWT as input”. Now the code checks only the first three parts (lines 178-179). So h.p.s.x is authorized, and later refused by isCompactJwt in walletChain (serialize.ts:72, purchase.ts:144). Only the holder of the cnf key can produce it.
  4. packages/credentagent-gate/src/ceremony/intent-sign/presentation.ts:205-207 · Principle 10, §5 · CONFIRMED. The sd_hash comment says everything after the last ~ is the key binding. In fact the mandate disclosures behind the key binding are not hashed, and only verify.ts:282 guards them. The same kind of stale text is in verify.ts:173-175, :286-288 and :297; presentation.ts:11 and :188; ap2/chain/verify.ts:155; serialize.ts:65-66; purchase.ts:65; and verify.ts:92-109. Draft revision -00 (in the ietf.org archive) has no changelog, and its §6 already says kb-sd-jwt+kb (and kb-sd-jwt for a terminal hop, which is still refused). That makes the citation in ap2/delegate.ts:23-28 weaker than it needs to be.
  5. packages/credentagent-gate/src/ceremony/intent-sign/simulate.ts:90-92 · Principle 2 (consistency), on the exported SimulateOptions · CONFIRMED. It breaks the override* naming convention (header lines 14-15), replaces only the first disclosure (line 219), and is ignored without delegatedLayout.
  6. Pre-existing: packages/credentagent-gate/src/ap2/chain/verify.ts:154 · the no-cnf arm has no test with a wrong typ · CONFIRMED. On the PR text: deleting the sd_hash compare fails two tests (presentation.test.ts:179 and :618), and deleting the disclosure check fails one (:636), not “three” for either.

What holds (for the record):

  • On the new path, the in-gate backend still reports only device-signed, and no text implies issuer trust.
  • In both layouts, sd_hash covers every issuer disclosure.
  • A disclosure behind the key binding never counts as a claim, and it must be one the gate asked for (pinned by presentation.test.ts:636).
  • The nonce, audience and holder-key refusals run on the new layout.
  • What is verified is what is stored and spent.
  • The size is under the limits, and no other open fix shares this cause.

Coverage

  • Scope: 51d64d6..8735216, full.
  • Read in full: all 10 changed files, plus ap2/chain/serialize.ts, hop.ts, test-wallet.ts and purchase.ts; ceremony/intent-sign/routes.ts and mandates.ts; the index.ts exports; chain/verify.ts at v0.6.0; the draft's -00 text; and the @sd-jwt/core 0.20.1 decoder.
  • Dimensions: security invariants and bypass tests, correctness and edge cases, the DX rubric and docs, honesty fencing and PR/changelog text, size.
  • Tests were not run here, because this job has no node_modules; CI's build-test is green.
  • Effort: max.

Ever Morales and others added 8 commits November 19, 2026 14:19
… (review of #474)

The old test set omitKeyBinding and delegatedLayout together, but the simulator handled
omitKeyBinding first and never produced the new layout, so it passed through the earlier layout's
refusal. The simulator now returns `<chain>~~` for that pair, the test asserts the answer is in the
new layout and the exact reason, and a backend that accepts everything is still refused. Direct
splitPresentation cases pin the odd shapes.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Ever Morales <ever.morales@koombea.com>
…he page's range (review of #474)

The simulated wallet hashes the same bytes the page does, so no test could tell whether a real
wallet agrees on what `sd_hash` covers. This commit adds one answer captured from the updated
wallet on a phone and replays it: the layout, the `kb-sd-jwt+kb` type and the checksum verify, and
dropping a disclosure, another nonce or another audience are refused. Changing the hashed range
fails 23 tests.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Ever Morales <ever.morales@koombea.com>
…rchant (review of #474)

The test for the new layout stopped at "authorized". The person has left by the time the agent
spends the permission, so the stored form must also be one `verifyDelegatedPurchase` accepts. The
spend-and-verify steps are now a helper, run for the Delegated layout typed `kb-sd-jwt+kb`; storing
the raw answer instead of the normalized one fails it. The comment above the neighbouring test no
longer claims a spend it does not do.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Ever Morales <ever.morales@koombea.com>
…else the fix changes (review of #474)

The entry said "the gate still sends kb+sd-jwt+kb", true only of the simulated wallet, which could
read as nothing changing for merchants. It now says the wallet picks the type, that a merchant on
0.6.0 refuses a permission this wallet signed, that intent.presentation is re-serialized, and names
the new simulator options and the issue.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Ever Morales <ever.morales@koombea.com>
The key binding's signature is checked on its first three parts, and only the credential's chain
now goes through the SD-JWT decoder, so `h.p.s.x` verified, was authorized and stored, and was
refused only when the agent spent it. splitPresentation now requires a three-part compact JWS, the
check the chain code applies, in both layouts. Without it, the replay test with a fourth part and
the splitter case fail.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Ever Morales <ever.morales@koombea.com>
…iew of #474)

The sd_hash comment described the earlier layout and now says what is hashed, and that the mandate
disclosures behind the key binding are guarded by the delegate_payload digests. The agentHeld doc,
the type comments, the IntentVerifyBackend doc, walletChain and fromWalletPresentation no longer
claim one layout or one spelling. The refusal messages name the accepted spellings from
DELEGABLE_KB_TYPS. The draft citation is first-hand: -00 uses both spellings (§5.1.4 and §6), and
its terminal `kb-sd-jwt` in §6 step 4.2 is noted as still refused.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Ever Morales <ever.morales@koombea.com>
…be ignored (review of #474)

SimulateOptions is exported, so a later rename would break callers. `kbDisclosureOverride` becomes
`overrideKbDisclosure`, like `overrideNonce`, `overrideVct`, `overrideMandates` and
`overrideKbTyp`. Its doc says it replaces only the first disclosure behind the key binding, and
without `delegatedLayout` the simulator throws, as it does for an unknown `cardShape`, instead of
silently ignoring it. The changelog line follows.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Ever Morales <ever.morales@koombea.com>
#474)

Replacing the no-`cnf` arm of the chain verifier's `typ` check with `false` left every test green.
An agent hop with no further key, typed with either delegable spelling or the plain `kb+jwt`, is
now refused with `code: "typ"`, and the three cases fail without the arm.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Ever Morales <ever.morales@koombea.com>
@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

✅ Scope check: a maintainer approved its size (scope:approved). 667 changed lines in 12 files (docs, specs and lockfiles not counted; the bar is 400 lines or 15 files).

Comment thread CHANGELOG.md Resolved
@claude

claude Bot commented Nov 19, 2026

Copy link
Copy Markdown

Claude review

Verdict: ⛔ Needs changes

Since the last review: 7 fixed, 1 partly open.

This lets the grant signing page read the newer Multipaz Wallet's answer. The fixes hold up: a real phone answer is now replayed as a test, and nothing forged or unsigned gets through. Only a process step blocks merging.

Fix before merging

  1. The pull request is now past the size limit for one review, and the size check is red. A change this big gets skimmed, like a long contract, so the rule asks for a split or a maintainer's sign-off. Most of the growth is tests the last review asked for, which belong with the fix: ask a maintainer to add the scope:approved label, with that reason in a comment.

Worth a look

  • The description is out of date on three points: who picks the signature type, where the draft's spelling came from, and a test count.
  • The signing page still approves a few odd answers a merchant later refuses, like a padded signature (only the user's own wallet can send one). One issue for that whole class beats another one-off fix.
  • The new shape check is tested only with the wrong number of parts.
  • The changelog should say the wallet was a development build: the wallet change it needs isn't merged yet.
  • The “needs its own decision” note points at the issue this closes; open a decision issue instead.
Details for the author

Scope: delta, 8735216..435159c: the eight new commits eb44535, 92858dd, 65383a4, c282dec, 379a8ca, 590edbf, 32dec42 and 435159c. Main changed none of this PR's files since the last review (the base is still 51d64d6). Findings C to F also have an inline comment. A and B are about the whole PR, so they have none.

Since the last review (its eight findings, at 8735216)

  1. Fixed (eb44535). The “nothing behind the gap” test now builds the new layout.
    • The simulator's answer now ends in ~~. The test asserts that and the exact reason.
    • A backend that accepts everything is still refused at verify.ts:286.
    • Deleting verify.ts:286 turns presentation.test.ts:669-685 red: the result is ok: true with no presentation.
    • Deleting presentation.ts:88 turns :654-667 red through the exact reason. Line 91 still refuses, since isCompactJwt(undefined) is false.
  2. Fixed (92858dd). A real Multipaz answer is replayed (presentation.test.ts:739-780 and the fixture).
    • The sub-agent recomputed its sd_hash with Node's crypto. It equals SHA-256 of parts.chain. Chain plus ~, chain minus ~, and the whole answer all give different values, so the hashed range is pinned.
    • The only time check on that path is the credential's exp (presentation.ts:173, about 2026-12-19), compared with the fixed nowMs. The test doesn't age out.
    • The fixture holds no private key. Its certificate is OWF Multipaz TEST DS under Multipaz TEST IACA. It isn't published: the package's files are dist, README.md and LICENSE.
    • The PR's Before line matches main's code: splitSdJwt reads the empty last part as the key binding.
  3. Fixed (65383a4). grants.agent-key.test.ts:111-114 spends and verifies a grant signed in the new layout, typed kb-sd-jwt+kb. If the raw answer were stored, walletChain (serialize.ts:73-75) would see an empty last part, and the test would go red.
  4. Fixed (c282dec, 32dec42). The changelog now names three things: the refusal by merchants on 0.6.0, the re-serialized intent.presentation, and both simulator options.
  5. Fixed (379a8ca). A key binding that isn't three parts is refused at presentation.ts:91 and :97. This is pinned by presentation.test.ts:724-728 and :769-774.
  6. Fixed (590edbf). Every stale comment listed last time now matches the code. I checked delegate.ts:23-30 against draft -00 in the ietf.org archive:
    • §2.2, §5.1.4 and Appendix A.2 say kb+sd-jwt+kb.
    • §6 steps 1.1, 3.e and 4.2 say kb-sd-jwt+kb.
    • Steps 1.1 and 4.2 write the terminal hop kb-sd-jwt.
    • -00 has no changelog.
  7. Fixed (32dec42). The option is now overrideKbDisclosure. It throws without delegatedLayout, pinned at presentation.test.ts:645-647.
  8. Partly fixed.
    • The no-cnf arm of the chain verifier's typ check now has a test (435159c, verify.test.ts:216-230). With the arm set to false, all three cases reach ok: true.
    • The PR text's “three tests fail” is now true for the sd_hash compare (presentation.test.ts:183, :621, :760).
    • It is still not true for the disclosure check at verify.ts:287: only presentation.test.ts:638 pins it.

Fix before merging

A. Size · REVIEW.md §8 · CONFIRMED.

  • Counted the way ci/pr-scope/check.mjs counts (Markdown excluded): 507 changed lines in 12 files at 435159c, up from 226 at 8735216. The limit is 400.
  • The scope check is red. Grant signing refuses the Delegated SD-JWT layout the updated Multipaz wallet sends #473 is not a sub-issue of an epic, and the PR has no scope:approved label.
  • 317 of the 507 lines are tests and the fixture: presentation.test.ts 197, grants.agent-key.test.ts 82, chain/verify.test.ts 31, fixture 7. Most of that is what the last review asked for, so the label, with that reason, fits better than a split.

Worth a look

B. PR description · REVIEW.md §5 · CONFIRMED. Three statements are out of date:

  • “The gate still sends kb+sd-jwt+kb”: the changelog now says the wallet picks the type, and the request names none.
  • “per multipaz#2178's reviewer quoting its changelog; I could only fetch revision -00 myself”: the code now cites -00 first-hand, and -00 has no changelog.
  • “…or the disclosure check in verify.ts and three tests fail”: deleting that check fails one test (see 8).

C. Signing page vs merchant · presentation.ts:89-91 and :155.

  • This was there before the PR. It fails closed, and only the holder's own wallet can send these answers.
  • The padded credential signature is PLAUSIBLE. The unproven step: that decodeSdJwt accepts a third JWT part that isn't strict base64url.
    • es256Verify decodes the signature with Buffer.from in base64url mode (ap2/sdjwt.ts:47), which ignores padding. So the answer verifies and is stored.
    • At spend, splitChain refuses link 0 (serialize.ts:54, hop.ts:46-47).
  • CONFIRMED by reading, four more answers the merchant refuses and this page accepts:
    • a key-binding alg other than ES256 (chain/verify.ts:97);
    • a key binding with no numeric iat (:137);
    • an issuer_jwt_hash claim (:134-135);
    • an extra plain element in delegate_payload: mandates.ts:165-175 ignores it, and chain/verify.ts:140-146 counts it.
  • 379a8ca is a one-off fix in this class. CLAUDE.md's second-symptom rule points to one issue instead: run the merchant's own link rules at signing. No other open PR touches this.

D. Test coverage · presentation.test.ts:724-728 · CONFIRMED. Replace isCompactJwt at presentation.ts:91 and :97 with a count of three parts, and every test stays green. That lets h.p.s== back in: it verifies, then walletChain refuses it at spend.

E. Changelog · CHANGELOG.md:89-94 · CONFIRMED.

F. Decision pointer · ap2/delegate.ts:29-30 · CONFIRMED. It points at #473, which this PR closes. CLAUDE.md asks for decisions as an issue labelled needs-decision.

What holds

  • No security invariant is broken.
  • trust_level stays device-signed, and no new text claims issuer trust.
  • The aud, nonce and holder-key refusals run in both layouts.
  • In both layouts, the stored form is byte-for-byte what was verified. The sub-agent ran copies of splitPresentation, walletChain and splitChain over odd inputs: zero disclosures, ~~~, a missing closing ~, a trailing newline.
  • isCompactJwt is not newly public.

Coverage

  • Read in full: presentation.ts, intent-sign verify.ts, simulate.ts, grants.agent-key.test.ts, ap2/chain/verify.ts, ap2/chain/verify.test.ts, serialize.ts and delegate.ts.
  • Read in part: presentation.test.ts lines 560-780, the fixture, the CHANGELOG Unreleased section, and purchase.ts lines 40-160.
  • Also read: the callees es256Verify, appendAgentHop and delegatePayloadMatches; main's presentation.ts; ci/pr-scope/check.mjs; and draft -00.
  • Dimensions: security invariants and bypass tests (one sub-agent, reading independently), correctness and edge cases, DX and docs truthfulness, honesty fencing and PR text, and size.
  • Tests were not run here, because this job has no node_modules. CI build-test is green.
  • Effort: max.

…build, make the terminal-hop note stand alone (review of #474)

The shape check was tested only with the wrong number of parts, so a looser three-part check kept
every test green; two cases with `==` now fail it. The changelog says the wallet is a development
build, since multipaz#2178 is not merged. The note about the terminal `kb-sd-jwt` spelling no
longer points at #473, which closes with this PR, and says why the gate refuses it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Ever Morales <ever.morales@koombea.com>
@claude

claude Bot commented Nov 19, 2026

Copy link
Copy Markdown

Claude review

Verdict: ⛔ Needs changes

Since the last review: 4 fixed, 2 still open.

This lets the grant signing page read the newer Multipaz Wallet's answer. The new commit and an edited description make most of the fixes the last review asked for and weaken no check; only the size sign-off still blocks.

Fix before merging

  1. The pull request is still over the size limit for one review, and the size check is red. A change this big gets skimmed, like a long contract, so the rule asks for a split or a maintainer's sign-off. Ask a maintainer to add scope:approved, noting that most of the growth is tests the reviews asked for.

Worth a look

  • The new test only tries a stray = sign. A check that also let + or / through would pass every test, and approve a grant the agent then can't spend. Two more lines pin it.
  • A code note now treats refusing one spelling of the agent's final signature type as settled. Yet the toolkit of AP2 (the agent payments protocol) accepts it, and the note's own rule for the other type would too. A decision issue would record the choice.
  • Still open: one issue for the odd answers the signing page approves and a merchant later refuses.
Details for the author

Scope: delta, 435159c..0e6da94: the one new commit, 0e6da94. Main changed none of this PR's files since the last review (the base is still 51d64d6). G1 and G2 also have inline comments. A and C are about the whole PR, so they have none.

Since the last review (its six findings, at 435159c)

  • A. Size: still open. REVIEW.md §8 · CONFIRMED.
    • Counted the way ci/pr-scope/check.mjs counts, with CHANGELOG excluded: 515 changed lines in 12 files, up from 507. The limit is 400.
    • The scope check is red at 0e6da94, and the PR has no scope:approved label.
  • B. PR description: fixed (the body was edited). It now says:
    • the wallet picks the type;
    • draft -00 is cited first-hand;
    • deleting the disclosure check fails one test.
  • C. Signing page vs merchant: still open. No issue was filed, and the thread has no reply.
  • D. Character set untested: fixed for the mutation named.
    • presentation.test.ts:733 reaches presentation.ts:97, and :734 reaches :91.
    • Swapping either call for a three-part count turns the new test red. The older four-part and two-part cases stay green under it.
    • The leftover gap is G1.
  • E. Development build: fixed (CHANGELOG.md:89 and :93-94).
    • The fixture's note says the wallet was built on Multipaz SDK pull requests 2196 and 2178. Both are still open in openwallet-foundation/multipaz.
    • It matches the Added entry, which says no released wallet signs grants yet.
  • F. Decision pointer: fixed.
    • The pointer to the closing issue is gone.
    • Each claim in the new note holds: chain/verify.ts:153-155, presentation.ts:200-202, intent-sign/verify.ts:298-305 and chain/hop.ts:48.
    • New evidence is G2.

New in 0e6da94 (both worth a look)

G1. presentation.test.ts:733-734 · REVIEW.md §2 (a weakened control still passes) · CONFIRMED, executed on a verbatim copy of splitPresentation.

  • Replace isCompactJwt at presentation.ts:91 and :97 with a three-part regex that also admits + and /. Every splitPresentation case and the phone replay stay green.
  • A real ES256 signature respelled with + and / still verifies: Buffer.from in base64url mode reads standard base64 (ap2/sdjwt.ts:47).
  • Then walletChain refuses it at spend (serialize.ts:75, reached from purchase.ts:144).
  • Fix: the two-line suggestion inline.
  • Aside, from an earlier commit: presentation.ts:89-90 says a key binding with fewer than three parts would verify on its first three. It doesn't, because es256Verify gets an empty signature (lines 184-185).

G2. ap2/delegate.ts:29-31 · CLAUDE.md (decisions live in needs-decision issues) and docs truthfulness · CONFIRMED facts, PLAUSIBLE impact. The unproven step: that any sender uses kb-sd-jwt for the last hop.

  • AP2's kb_sd_jwt.py (google-agentic-commerce/AP2 at b4587ac) emits kb+sd-jwt and accepts kb+sd-jwt and kb-sd-jwt on the last hop. This gate accepts only the first (chain/verify.ts:153-155).
  • The note's own rule for the delegable type (lines 23-27) argues for accepting both.
  • No issue records the choice. The AP2 conformance issue's body and comments don't mention this spelling.

What holds

  • No security control's code changed: the commit is one test, one changelog paragraph and one comment.
  • trust_level is untouched and stays device-signed. No new wording claims trust or uses a GLOSSARY Avoid word.
  • The new test's comment is true, traced end to end:
    • a real ES256 signature with = or == appended verifies (executed);
    • it is stored through verify.ts:285-286 as the normalized presentation;
    • it is refused at spend.
  • CI's typecheck, lint and root npm test are green on 0e6da94. DCO is green.

Coverage

  • Read in full: intent-sign/presentation.ts, ap2/delegate.ts, ap2/chain/serialize.ts, ap2/chain/verify.ts and ap2/chain/hop.ts.
  • Read in part:
    • presentation.test.ts lines 560-787;
    • CHANGELOG.md lines 1-140;
    • intent-sign/verify.ts lines 160-320;
    • ap2/chain/verify.test.ts lines 155-234;
    • the fixture's note;
    • the PR body, labels, checks and review threads;
    • AP2's kb_sd_jwt.py, through the GitHub API;
    • the AP2 conformance issue.
  • Dimensions:
    • security and bypass tests: my own read, plus one independent sub-agent read of the commit;
    • correctness;
    • docs truthfulness;
    • honesty fencing and PR text;
    • size.
  • Mutation checks ran with node on verbatim copies. vitest was not run, because this job has no node_modules.
  • Effort: max.

Ever Morales and others added 2 commits November 19, 2026 15:58
…review of #474)

The two `==` cases would still pass a check that also let standard base64's `+` and `/` through,
and the signature decoder reads those too: such a key binding verifies, is stored, and is refused
when the agent spends it. Two cases with `H.B.S+/` fail that check. The comment above it no longer
says a key binding with fewer than three parts would verify; it fails the signature check.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Ever Morales <ever.morales@koombea.com>
…rifier (review of #474)

AP2's Python SDK accepts `kb+sd-jwt` and `kb-sd-jwt` for a hop that ends the chain (TYP_TERMINAL),
and draft -00 writes it both ways (§5.1.4 and §6 step 4.2). The chain verifier accepted only
`kb+sd-jwt`, so a merchant on this gate refused a last hop AP2's verifier accepts. It now accepts
either, and the signing page lists both. A wallet hop that names a further key typed `kb-sd-jwt`
is still refused. Removing the second spelling fails the new accept test.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Ever Morales <ever.morales@koombea.com>
@dzuluaga dzuluaga removed their assignment Nov 20, 2026
dzuluaga added a commit that referenced this pull request Nov 21, 2026
…-bar before ready

The Claude review ran on every push (`synchronize`): each fix for a note started the next
review, which found the next note. #474 got 10 reviews in a day. This finishes the
2026-10-20 decision the cap alone didn't: the bot reviews once when a PR opens or is marked
ready, and again only when someone adds `review:again` (the issue agent already adds it after
a fix). The cap of 2 rounds stays.

- claude-code-review.yml: trigger on opened/ready_for_review/reopened/labeled, not
  synchronize; only the review:again label runs the job; delta scope on that label; the bot
  removes the label after each run. Concurrency moves to the job, so adding any other label
  (its run is skipped) can't cancel a review in progress.
- issue-agent-review.yml: assess ignores a skipped review run. With the labeled trigger, any
  other label starts one, and assess would read it as a verdict-less review and hand the PR
  to a human.
- CONTRIBUTING.md, PR template: open as draft, run /review-to-the-bar, put its scorecard,
  cold-read packet and what you couldn't verify at the top, then mark ready.
- CLAUDE.md: the review bot's description matches.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Diego Zuluaga <dfzuluaga@gmail.com>
Ever Morales and others added 2 commits November 20, 2026 18:37
…d the type once (review of #474)

`normalized` was always `chain + kbJwt`, and both callers re-checked it as a second optional field.
It is gone; verify.ts builds the stored presentation where it stores it. The guard is two checks, so
a malformed answer says "not a compact SD-JWT presentation" and only a missing key binding says
"presentation carries no key-binding JWT". The agent-held `typ` check reads the type from the
split it already has instead of splitting again. The page's type refusal no longer says the hop
"must be" the two delegable spellings when `kb+sd-jwt` also passes for a gate-held grant. The
disclosure test matches the full refusal text, and the IntentVerifyBackend doc says what `sd_hash`
covers in the Delegated layout and to wrap `inGateBackend`, without pointing at an unexported file.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Ever Morales <ever.morales@koombea.com>
…move the merchant change to Changed (review of #474)

The README now names `IntentVerifyBackend` and says only direct callers of `verifyIntentPresentation`
can plug one in; the signing route always uses the in-gate backend. The changelog's backend note is
one line ("wrap `inGateBackend`"), says the page still refuses a key binding that is not three
base64url parts, and the merchant's acceptance of the agent's last hop typed `kb-sd-jwt` is its own
entry under Changed, not Fixed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Ever Morales <ever.morales@koombea.com>
@TheBlackBit

Copy link
Copy Markdown
Collaborator Author

Thanks @dzuluaga. The five small items are done in b585718 and 6d03ab3: the type refusal no longer says the hop "must be" the two spellings, the agent-held check reads the type from the split it already has, the guard is two checks (a malformed answer now says "not a compact SD-JWT presentation"), and the disclosure test matches the full refusal text. One difference on the changelog item: I wrote that the page "still refuses" a key binding that is not three base64url parts, not "before: authorized, then refused at spend", because main refused it too (it decoded the whole answer strictly).

Comment thread CHANGELOG.md Resolved
@claude

claude Bot commented Nov 21, 2026

Copy link
Copy Markdown

Claude review

Verdict: 💬 Ready — small notes

Since the last review: 1 fixed, 0 still open.

This lets the grant signing page read the newer Multipaz Wallet's answer. The two new commits tidy the code without changing what it accepts or stores, and act on a maintainer's wording notes. A maintainer has approved the size, so nothing blocks merging.

Worth a look

  • A new changelog line says the signing page “still” refuses a wallet signature with stray characters. Version 0.6.0 accepted one padded with = or written with + and /, so that refusal is new. A one-line rewording is suggested.
  • A new note for developers who plug in their own verifier says the checksum the wallet signs covers the answer “up to” the second of two separator marks. It can be read as including that mark, which gives the wrong checksum. Say “before”.
  • Optional: the new refusal, for when a developer's own verifier approves a malformed answer, has no test. A ready-made test is suggested.
Details for the author

Scope: delta, c7684d6..6d03ab3: the two new commits b585718 and 6d03ab3. Main changed none of this PR's files since the last review (the base is still 51d64d6). R1 to R3 also have inline comments.

Since the last review (its one open item, at c7684d6)

  • A. Size: fixed. A maintainer added scope:approved. The scope check passes on 6d03ab3 (648 counted lines in 12 files, by its own comment).

New in this delta (all worth a look)

R1. CHANGELOG.md:101 · REVIEW.md §5 and §6 (release text matches the code), Principle 10 · CONFIRMED.

  • presentation.ts is the same at v0.6.0 and on main. It verified the key binding with es256Verify, which reads the signature with Buffer.from in base64url mode (ap2/sdjwt.ts:47).
  • Executed with node, using the same calls: a real ES256 signature with == appended, or with - and _ written as + and /, still verifies. isCompactJwt refuses both.
  • 0.6.0 then decoded the whole answer. In @sd-jwt/core 0.20.1, locked both at v0.6.0 and here, decodeJwt checks for three parts and strictly decodes the header and body. It passes the signature through unchecked (decode.ts at the published gitHead b983e03, read through the GitHub API).
  • 0.6.0's verify.ts stored the raw answer with no shape check. So that answer was authorized: an agent could not spend it, and a gate-held grant was spent.
  • The head refuses it at presentation.ts:92 and :98, pinned by presentation.test.ts:762-768.
  • “Still” holds for a wrong number of parts, and for a header or body that is not strict base64url.
  • It fails closed, and RFC 7515 forbids padding in a compact JWS, so no conformant wallet is affected.

R2. verify.ts:98 · Principle 10 · PLAUSIBLE. The unproven step: how a reader takes “up to”.

  • The hashed range is parts.chain, sdjwt.slice(0, gap + 1) (presentation.ts:83). It ends at the first ~ of ~~.
  • The template beside it is right. The PR description says “before the extra ~”.

R3. verify.ts:282 · REVIEW.md §2 (test strength), optional · CONFIRMED.

  • None of the four custom-backend tests (presentation.test.ts:364, :378, :694, :713) sends an answer that splitPresentation refuses.
  • Delete line 282 and vitest stays green, but npm run build's tsc fails (TS18048 at :283). Without the line, this path throws, and nothing is authorized.
  • A test is suggested inline.

What holds

  • b585718 changes no outcome and no stored byte.
    • normalized was truthy exactly when kbJwt was. In the earlier layout, chain plus kbJwt is the raw answer, which is what was stored before.
    • The sub-agent ran verbatim copies of both versions over 649,548 inputs: both layouts, odd shapes, four disclosure sets, and agentHeld on and off. It found 0 outcome differences and 0 byte differences.
    • Only two reason texts changed (verify.ts:282 and presentation.ts:207). Nothing parses them.
  • The bypass tests still catch a removed check:
    • deleting verify.ts:283 turns presentation.test.ts:700 red, because the gate would store the chain plus “undefined”;
    • grants.agent-key.test.ts:192 pins the agent-held type check, and :111 and :213 pin where it reads the type (sub-agent);
    • no edited assertion got weaker. :647 now matches only the text verify.ts:285 produces, and :731, :735 and :739 now use toEqual.
  • SplitPresentation stays internal (it is not in index.ts or the package exports), and normalized was never released. Nothing in the repo still reads normalized or keyBindingTyp.
  • The README holds. The signing route passes no backend (routes.ts:135-147). IntentVerifyBackend, verifyIntentPresentation and inGateBackend are exported (index.ts:60-61).
  • The Changed entry (CHANGELOG.md:86-90) sits under Unreleased, and each claim in it holds:
    • cnf picks a delegable or terminal type, and must match the hop's place in the chain (chain/verify.ts:103 and :153-156);
    • the gate's agent signs kb+sd-jwt (chain/hop.ts:48);
    • the page refuses kb-sd-jwt (presentation.ts:206, pinned by presentation.test.ts:663-667).
  • trust_level is untouched and stays device-signed on the page. No new wording claims trust or uses a GLOSSARY Avoid word.
  • Both commits are signed off. DCO, scope, build-test (the root npm test) and both quickstart smokes are green on 6d03ab3.

Aside (outside this delta; not counted as a finding)

  • REVIEW.md says CI runs npm run typecheck, but it does nothing: the root runs it with --if-present, and neither workspace defines it.
  • npm run build does type-check. But the gate's tsconfig.test.json includes only four test globs, so intent-sign/presentation.test.ts is never type-checked. Worth an issue.

Coverage

  • Read in full: intent-sign/presentation.ts and intent-sign/verify.ts, at the head and on main; both commits.
  • Read in part:
    • presentation.test.ts lines 560-842;
    • CHANGELOG.md lines 1-140;
    • chain/verify.ts lines 90-170, routes.ts lines 115-160, and hop.ts;
    • isCompactJwt, es256Verify, peekJson, and simulate.ts's option handling;
    • GLOSSARY.md, the gate's package.json and tsconfig.test.json;
    • the PR body, labels, checks and review threads.
  • Also read: @sd-jwt/core 0.20.1's decode.ts; git diff v0.6.0..51d64d6 for the signing page; the 0.6.0 lockfile.
  • Dimensions:
    • security invariants and bypass tests: my own trace, plus one independent sub-agent, which ran an equivalence check on verbatim copies;
    • correctness;
    • docs, README and changelog truthfulness;
    • honesty fencing and PR text;
    • size.
  • vitest was not run here, because this job has no node_modules. CI's build-test ran it.
  • Effort: max.

…efore" the second `~`, and test the unreadable-answer guard (review of #474)

The changelog said the page "still" refuses a key binding that is not three base64url parts. That
is true for the part count and for a header or body that is not strict base64url, but 0.6.0
authorized a key binding whose signature was padded with `=` or written with `+` or `/` (the
signature check reads it leniently and the library does not check it), and the merchant then refused
it at the purchase. The page refuses it at signing now, and the entry says so. The IntentVerifyBackend
doc said `sd_hash` covers the answer "up to the second `~`", which reads as including it; the hashed
range ends before it. A test gives a backend that approves an answer the gate cannot split and
expects the refusal; replacing the guard with a throw fails it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Ever Morales <ever.morales@koombea.com>
@TheBlackBit

Copy link
Copy Markdown
Collaborator Author

@dzuluaga a correction to my earlier note on your changelog item. I wrote that the page "still refuses" a key binding that is not three base64url parts, because main refused it too. That was wrong for the signature: at 0.6.0 a signature padded with = or written with + or / was authorized, and the merchant then refused it at the purchase, as you said. The page refuses it at signing now, and the changelog says so (5758051). It was right only for a wrong part count and for a header or body that is not strict base64url.

@TheBlackBit

TheBlackBit commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator Author

@dzuluaga I ran a second self-review of this PR (head 6d03ab3, after your review and the bot's). Three reviewers read the diff, and a fourth checked each finding against the code. The three open bot threads it found are fixed in 5758051.

Rubric Score Set by
Developer experience 4 A custom-backend author is told to wrap inGateBackend with no snippet; a malformed key binding gets a vague reason
Shown is what is signed n/a The approval screen is unchanged
Correctness and spec 4 No defect introduced; the signing page / merchant gaps are #475 and pre-existing
Evidence 4 Every claim re-runs and was mutation-tested; one overclaiming sentence in the description
Scope and size 4 One purpose, 248 source lines, plus the merchant kb-sd-jwt change you approved
Repository rules 4 Scope check green; small nits only
Overall 4 No blocking item

@TheBlackBit
TheBlackBit requested a review from dzuluaga November 21, 2026 01:08
@TheBlackBit TheBlackBit assigned dzuluaga and unassigned TheBlackBit Nov 21, 2026
@dzuluaga

Copy link
Copy Markdown
Contributor

Thanks @TheBlackBit, b585718 and 6d03ab3 cover everything, and you're right about the CHANGELOG line: main already refused it.

Two things left:

  1. Please answer comments 2 and 3, especially the rollout one. Do we ship kb-sd-jwt+kb now and ask merchants on 0.6.0 to upgrade, or hold it? Also, keep or split the merchant kb-sd-jwt change. Once those are settled I can approve.
  2. On your next PR, run /review-to-the-bar on it before asking me to look, and put its cold-read packet and scorecard at the top of the description. It would have caught most of this round's comments. Install: /plugin marketplace add openmobilehub/review-to-the-bar, then /plugin install review-to-the-bar@review-to-the-bar. Once Register review-to-the-bar for everyone who opens the repo, with auto-update on #476 merges, opening the repo installs it for you.

@dzuluaga dzuluaga assigned TheBlackBit and unassigned dzuluaga Nov 21, 2026
@TheBlackBit

Copy link
Copy Markdown
Collaborator Author

Thanks @dzuluaga.

  1. Both are answered in the threads, and I'm putting them here in one place. We keep the merchant kb-sd-jwt change in this PR: splitting it wouldn't bring the PR under 400 lines, and it's its own entry under Changed. We ship kb-sd-jwt+kb now. The wallet that sends it is unreleased, and the changelog tells merchants on 0.6.0 to update the gate and merchants together.

One correction on the CHANGELOG line: main did not refuse every case. A signature padded with = or written with +// was authorized at 0.6.0 and refused by the merchant at the purchase, as you first said. main only refused a wrong part count and a header or body that isn't strict base64url. 5758051 says so now, and I posted the correction above.

  1. I ran /review-to-the-bar before asking you to look, and its first run found items I fixed before your review. I kept its findings in my own notes and did not put the scorecard or the cold-read packet on GitHub. I posted the latest scorecard in a comment above, and on the next PR both go at the top of the description, as you ask.

Comment thread CHANGELOG.md Resolved
@claude

claude Bot commented Nov 21, 2026

Copy link
Copy Markdown

Claude review

Verdict: 💬 Ready — small notes

Since the last review: 3 fixed, 0 still open.

This lets the grant signing page read the newer Multipaz Wallet's answer. The new commit acts on the last three notes. It rewords a changelog line and a developer note, and adds a test: if a developer's own verifier approves an answer the page can't read, the page still refuses it with a clear reason. No check changed, and nothing blocks merging.

Worth a look

  • The reworded changelog line says version 0.6.0 approved a grant with an oddly written wallet signature, and the merchant then refused it when the agent spent it. The second half is wrong both ways. If the agent held the grant's key, the agent's spending code in this package refused it before any merchant saw it. If the gate held the key, the gate spent it normally, so this release newly refuses that grant when the user signs. A rewording is suggested.
  • The sentence above that line, and the description's list of what you're approving, name only what the page newly accepts. Add this new refusal to both.
Details for the author

Scope: delta, 6d03ab3..5758051: the one new commit, 5758051. Main changed none of this PR's files since the last review (the base is still 51d64d6). S1 has an inline comment with a suggestion, and S2 is folded into it.

Since the last review (its three notes, at 6d03ab3)

  • R1. “Still refuses”: fixed (5758051). CONFIRMED.
    • The bullet now says the page “now also refuses” a key-binding signature padded with = or written with + or /. That holds at the head: presentation.ts:92 and :98 (isCompactJwt), pinned by presentation.test.ts:781-787.
    • “Already refused a key binding with the wrong number of parts” holds at v0.6.0. More than three parts hit the part-count check of decodeJwt in @sd-jwt/core 0.20.1. Fewer than three fail es256Verify on an empty signature.
    • The new outcome clause is S1.
  • R2. “Up to” the second ~: fixed (5758051). CONFIRMED. verify.ts:98 now says “before”. The hashed range is parts.chain, sdjwt.slice(0, gap + 1) (presentation.ts:83, hashed at :224-227). It ends at the first ~ of the gap.
  • R3. No test for the unreadable-answer guard: fixed (5758051). CONFIRMED by trace, and the sub-agent traced it the same way.
    • overrideKbDisclosure set to an empty string survives simulate.ts:228, which uses ??. So dev-wallet.ts:105 puts an empty part right after the key binding.
    • The custom backend and delegatePayloadMatches pass. The sibling test at presentation.test.ts:719 uses the same pattern and reaches verify.ts:283.
    • splitPresentation returns undefined at presentation.ts:85 (the empty part), so verify.ts:282 gives the asserted reason. Nothing refuses earlier.
    • The test goes red if line 282 is deleted (line 283 then throws “Cannot read properties of undefined (reading 'kbJwt')”, so the awaited call rejects), given another reason, or merged back into line 283's check. The test's comment and its quoted error are accurate.

New in 5758051 (both worth a look)

S1. CHANGELOG.md:101-103 · REVIEW.md §5 and §6 (release text matches the code), Principle 10 · CONFIRMED by reading v0.6.0. One independent sub-agent traced it the same way.

  • “0.6.0 authorized such a grant” holds, in the earlier layout. 0.6.0 refused the Delegated layout outright.
  • “The merchant then refused it when the agent spent it” holds for neither kind of grant:
    • Gate-held grant (no agentKey). This is the default, and the storefront's own device-signed grants at v0.6.0 are this kind (server.ts:1086). v0.6.0 _authorizeDevice seals an engine (grants.ts:686-706), and spend() calls rec.engine.spend (:782), which never reads the stored answer. So it was spent, and this release newly refuses it at signing.
    • Agent-held grant. v0.6.0 DelegatedIntent.spend calls walletChain (purchase.ts:143-144). Its isCompactJwt fails (serialize.ts:69-73), so spend throws before any proof reaches a merchant. Only an agent built without this package reaches the merchant's verifyChain, which refuses it as malformed (chain/verify.ts:99-103). This PR's own test comment (presentation.test.ts:779-780) names walletChain.
  • The check refuses any character outside base64url (serialize.ts:24), not only =, + and /. The sub-agent ran Node 24's Buffer.from(sig, 'base64url'), the read es256Verify uses (ap2/sdjwt.ts:47). A space, an exclamation mark or an asterisk also still verify. The check looks at neither length nor trailing bits, so “not strict base64url” would overclaim. The suggestion says “a character outside base64url”.
  • It fails closed, and RFC 7515 forbids these characters in a compact JWS, so no conformant wallet is affected.
  • The commit message and the thread reply repeat “the merchant then refused it”.

S2. CHANGELOG.md:98-99 and the description's “What you're approving” · REVIEW.md §5 · CONFIRMED. Both say the page refuses what it refused before, except what it now accepts. Neither names the new refusal that the sub-bullet below now announces. Add it to both.

Asides (outside this delta, not counted as findings)

  • presentation.test.ts:847-848 (from 379a8ca) says a key binding with a fourth part “used to be authorized”. No release authorized one. v0.6.0 refused it at the decodeJwt part-count check, and refused the Delegated layout, which the fixture uses, outright. It was true only of this PR's first commit, and it now contradicts the changelog's “already refused”.
  • The credential's own issuer signature is still read leniently at signing (presentation.ts:156-157, and decodeSdJwt keeps the signature as a string). By reading, not run: an agent-held grant whose issuer signature is padded is authorized, then appendAgentHop throws “not a delegation chain” (hop.ts:46-47, via splitChain at serialize.ts:54). This was already true in 0.6.0. It belongs to the class in Decision: the signing page approves answers a merchant later refuses (no iat, extra delegate_payload element, _sd_alg) #475, which doesn't list it yet, so consider adding it there.

What holds

  • No security control's code changed: the commit is one changelog bullet, one doc comment and one test.
  • trust_level is untouched and stays device-signed on the page. The new test's backend reports issuer-verified as a careless external verifier, the same as its sibling. That is test data, and the test asserts a refusal. No new wording claims trust or uses a GLOSSARY Avoid word.
  • The commit is signed off. DCO, scope, build-test (the root npm test) and both quickstart smokes are green on 5758051.

Coverage

  • Read in full: intent-sign/presentation.ts, intent-sign/verify.ts, simulate.ts and dev-wallet.ts, and v0.6.0's intent-sign/routes.ts and ap2/chain/serialize.ts.
  • Read in part:
  • Dimensions:
    • docs and changelog truthfulness, and bypass-test strength, the two this commit can affect: my own trace, plus one independent sub-agent. It also read @sd-jwt/core 0.20.1 and @owf/identity-common 0.3.2, and ran scratch copies of splitPresentation and the signature read with node.
    • security invariants: no control changed
    • honesty fencing and PR text
  • vitest was not run here, because this job has no node_modules. CI's build-test ran it.
  • Effort: max.

dzuluaga added a commit that referenced this pull request Nov 21, 2026
…ready (#418)

* ci(review): cap the Claude review at 2 rounds per PR; issue-agent loop at 2 cycles

The review bot re-reviewed every push with no limit. On #415 that ran 10 reviews
since the PR was marked ready, six in one day, each answered by a 1-5 line wording
fix that triggered the next review. Stripe's agents get at most two CI rounds;
Anthropic's guidance warns a reviewer told to find gaps will always report some.

- claude-code-review.yml: count this PR's "## Claude review" summaries since it was
  last marked ready for review; at CLAUDE_REVIEW_MAX_ROUNDS (default 2) skip the
  review and post one note that a person decides next. Draft -> ready resets it.
- issue agent: ISSUE_AGENT_MAX_REVIEW_CYCLES default 3 -> 2.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Diego Zuluaga <dfzuluaga@gmail.com>

* ci(review): review once, then only on review:again; run review-to-the-bar before ready

The Claude review ran on every push (`synchronize`): each fix for a note started the next
review, which found the next note. #474 got 10 reviews in a day. This finishes the
2026-10-20 decision the cap alone didn't: the bot reviews once when a PR opens or is marked
ready, and again only when someone adds `review:again` (the issue agent already adds it after
a fix). The cap of 2 rounds stays.

- claude-code-review.yml: trigger on opened/ready_for_review/reopened/labeled, not
  synchronize; only the review:again label runs the job; delta scope on that label; the bot
  removes the label after each run. Concurrency moves to the job, so adding any other label
  (its run is skipped) can't cancel a review in progress.
- issue-agent-review.yml: assess ignores a skipped review run. With the labeled trigger, any
  other label starts one, and assess would read it as a verdict-less review and hand the PR
  to a human.
- CONTRIBUTING.md, PR template: open as draft, run /review-to-the-bar, put its scorecard,
  cold-read packet and what you couldn't verify at the top, then mark ready.
- CLAUDE.md: the review bot's description matches.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Diego Zuluaga <dfzuluaga@gmail.com>

* docs(issue-agent): review:again, not the push, starts the next review

Three notes said the label does nothing until the review starts on it; with this PR it does.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Diego Zuluaga <dfzuluaga@gmail.com>

* ci(review): a skipped review run is no review; other labels get their own concurrency group

Found by review-to-the-bar on this PR:
- issue-agent-review's label-started lookup took the head's newest Claude Code Review run.
  With the labeled trigger, agent:in-review itself starts a skipped run right after the PR
  opens, so the agent read "ended as skipped" and handed every new PR to a human before its
  first review. It now ignores skipped runs; an in-progress review still makes it wait.
- Concurrency: GitHub doesn't document whether a job skipped by `if` joins its group, so
  other-label runs get a group of their own (issue-agent-review.yml's pattern), at workflow
  level. A PR created with labels keeps its opening review.
- Wording: "push" notes in the cap/skip messages, ci/issue-agent README and checks.mjs; the
  cap note no longer promises "one more round"; CONTRIBUTING says how to install the skill.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Diego Zuluaga <dfzuluaga@gmail.com>

---------

Signed-off-by: Diego Zuluaga <dfzuluaga@gmail.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
dzuluaga added a commit that referenced this pull request Nov 21, 2026
…ssues (#477)

* ci(review): cap the Claude review at 2 rounds per PR; issue-agent loop at 2 cycles

The review bot re-reviewed every push with no limit. On #415 that ran 10 reviews
since the PR was marked ready, six in one day, each answered by a 1-5 line wording
fix that triggered the next review. Stripe's agents get at most two CI rounds;
Anthropic's guidance warns a reviewer told to find gaps will always report some.

- claude-code-review.yml: count this PR's "## Claude review" summaries since it was
  last marked ready for review; at CLAUDE_REVIEW_MAX_ROUNDS (default 2) skip the
  review and post one note that a person decides next. Draft -> ready resets it.
- issue agent: ISSUE_AGENT_MAX_REVIEW_CYCLES default 3 -> 2.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Diego Zuluaga <dfzuluaga@gmail.com>

* ci(review): review once, then only on review:again; run review-to-the-bar before ready

The Claude review ran on every push (`synchronize`): each fix for a note started the next
review, which found the next note. #474 got 10 reviews in a day. This finishes the
2026-10-20 decision the cap alone didn't: the bot reviews once when a PR opens or is marked
ready, and again only when someone adds `review:again` (the issue agent already adds it after
a fix). The cap of 2 rounds stays.

- claude-code-review.yml: trigger on opened/ready_for_review/reopened/labeled, not
  synchronize; only the review:again label runs the job; delta scope on that label; the bot
  removes the label after each run. Concurrency moves to the job, so adding any other label
  (its run is skipped) can't cancel a review in progress.
- issue-agent-review.yml: assess ignores a skipped review run. With the labeled trigger, any
  other label starts one, and assess would read it as a verdict-less review and hand the PR
  to a human.
- CONTRIBUTING.md, PR template: open as draft, run /review-to-the-bar, put its scorecard,
  cold-read packet and what you couldn't verify at the top, then mark ready.
- CLAUDE.md: the review bot's description matches.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Diego Zuluaga <dfzuluaga@gmail.com>

* docs(issue-agent): review:again, not the push, starts the next review

Three notes said the label does nothing until the review starts on it; with this PR it does.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Diego Zuluaga <dfzuluaga@gmail.com>

* ci(review): a skipped review run is no review; other labels get their own concurrency group

Found by review-to-the-bar on this PR:
- issue-agent-review's label-started lookup took the head's newest Claude Code Review run.
  With the labeled trigger, agent:in-review itself starts a skipped run right after the PR
  opens, so the agent read "ended as skipped" and handed every new PR to a human before its
  first review. It now ignores skipped runs; an in-progress review still makes it wait.
- Concurrency: GitHub doesn't document whether a job skipped by `if` joins its group, so
  other-label runs get a group of their own (issue-agent-review.yml's pattern), at workflow
  level. A PR created with labels keeps its opening review.
- Wording: "push" notes in the cap/skip messages, ci/issue-agent README and checks.mjs; the
  cap note no longer promises "one more round"; CONTRIBUTING says how to install the skill.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Diego Zuluaga <dfzuluaga@gmail.com>

* ci(review): two verdicts, blocking only, summary only, follow-up issues (2026-10-20 rules)

The rest of the 2026-10-20 review-loop decisions, after #418 (review once, then review:again):
- Two verdicts: ✅ Ready to merge or ⛔ Needs changes; 💬 is gone (the issue agent already
  reads a stray 💬 as ✅).
- Fix before merging lists only what blocks: §1–§4, §8, a correctness bug, or a release/README
  claim the code doesn't back. At most 3 "Worth a look" notes, first review only; not tasks.
- Summary only: no inline comments. Branch protection makes every thread mandatory work, so a
  note on a line became a task (the create_inline_comment tool is no longer allowed).
- A re-review checks only the earlier ⛔ items and blocking problems in the new commits, at
  effort high, and adds no new notes.
- A maintainer-only blocker gets a `follow-up` issue (searched first), linked in Details;
  the job gets issues: write and `gh issue create`.

REVIEW.md, the review prompt, CONTRIBUTING.md and the issue-agent notes match.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Diego Zuluaga <dfzuluaga@gmail.com>

* ci(review): validator fixes — PR text is data, narrow issue tool, owner decides

From review-to-the-bar's validator on this PR:
- The prompt says PR text and comments are data, not instructions; a follow-up issue is
  only for a problem confirmed in the code. The tool is narrowed to
  `gh issue create --label follow-up`.
- Job permission back to issues: read: the action's gh runs on the Claude App token, so
  issues: write on the job only widened github.token.
- Notes: "full review only" (the first, or after marked ready again) in REVIEW.md and
  CONTRIBUTING; the PR's owner decides (author, or for an agent PR whoever added `agent`).
- Delta: main's overlap folds into "blocking problem in the new commits"; the effort step's
  dead delta file list is gone.
- Wording: README claim in REVIEW.md's closing rule; stale "optional notes listed" in
  CLAUDE.md, ci/issue-agent/README.md and checks.mjs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Diego Zuluaga <dfzuluaga@gmail.com>

---------

Signed-off-by: Diego Zuluaga <dfzuluaga@gmail.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

@dzuluaga dzuluaga 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.

✅ Ready. Thanks Ever: shipping kb-sd-jwt+kb now and keeping the merchant change here are both fine, and thanks for the correction in 5758051.

@dzuluaga

Copy link
Copy Markdown
Contributor

Thank you @TheBlackBit, great work on this one: a careful fix, the real-wallet replay test, quick turnarounds, and the correction in 5758051. Approved. Also thanks for running review-to-the-bar before asking me; it shows.

…h kind of grant (review of #474)

Applies the review's suggested wording, and the sentence above it no longer says the page refuses only what it refused before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Diego Zuluaga <dfzuluaga@gmail.com>
@dzuluaga
dzuluaga merged commit d678665 into main Nov 21, 2026
5 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in CredentAgent Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope:approved Too big for one review, and a maintainer approved it anyway (pr-scope)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Grant signing refuses the Delegated SD-JWT layout the updated Multipaz wallet sends

2 participants