Skip to content

Token-by-reference store conformance tests (draft -03 Sections 8.2 and 10.4) - #41

Merged
asiridalugoda merged 1 commit into
mainfrom
test/ref-store-conformance
Oct 8, 2026
Merged

asiridalugoda merged 1 commit into
mainfrom
test/ref-store-conformance

Conversation

@asiridalugoda

Copy link
Copy Markdown
Contributor

Adds tests/security/token-reference-store.test.ts, conformance tests for the token-by-reference store against draft-helixar-hdp-agentic-delegation-03 Sections 8.2 and 10.4. No source changes.

The existing tests in tests/unit/transport.test.ts cover digest mismatch, write-once references and idempotent retries one store operation at a time. The new file covers how references behave across a chain extension, and when the store is edited beneath the TokenStore API, which is the substitution threat 8.2 names.

Cases:

  1. Storing an extension under its content reference leaves the UUID reference on the first snapshot (8.2).
  2. Storing an extension under the UUID reference is rejected, and the stored snapshots are unchanged (8.2, write-once).
  3. A content reference rejects a token whose last hop was removed in the store (8.2 digest check).
  4. A UUID reference resolves such a token, and it verifies. This is the completeness limit 10.4 documents, and the reason 8.2 prefers content references where the resolving party does not control the store.
  5. After the store is rolled back to before an extension, the extension's content reference resolves to null; no older snapshot is served in its place.
  6. Across the same rollback, the UUID reference resolves to the same first snapshot, since it names a fixed snapshot rather than the latest chain (8.2).
  7. A holder of the older content reference is served the older token after a rollback; 10.4's authenticated receipt over the complete token digest is the remedy.

Cases 1, 2, 3 and 5 test behaviour the implementation enforces; cases 4, 6 and 7 document behaviour the draft describes. Cases 1 and 2 use InMemoryTokenStore through its public API. The others use a test-only TokenStore with no write-once check, so entries can be overwritten or the whole store restored without reaching into private fields.

The cases follow a measurement of the reference store by Yasha Khandelwal on the IETF RATS list (2026-10-08).

Verification:

  • Root npm run typecheck, npm run build, npm test: 26 files, 139 tests pass (132 before this change). The new file also passes a strict standalone tsc check, since the root tsconfig.json excludes tests/.
  • Case 3 fails when the digest comparison in resolveToken is removed (no TokenReferenceIntegrityError raised).
  • Case 5 fails, with the test unchanged, when resolveToken falls back to the UUID entry for a missing content reference: with the digest check intact it rejects instead of returning null; with the check also skipped it returns the older two-hop token. Source was restored and git diff --exit-code confirmed clean before the green run.

The cases follow a measurement of the reference store by Yasha Khandelwal on the IETF RATS list (2026-10-08).
@asiridalugoda
asiridalugoda merged commit 5996148 into main Oct 8, 2026
38 checks passed
@asiridalugoda
asiridalugoda deleted the test/ref-store-conformance branch October 8, 2026 19:43
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.

1 participant