Repository navigation
exec: the bjn_v1 notify token - #400
Merged
Merged
Conversation
jaredLunde
enabled auto-merge
October 18, 2026 23:25
github-merge-queue
Bot
removed this pull request from the merge queue due to a conflict with the base branch
Oct 18, 2026
A module that mints and verifies v1.4 notify tokens exactly as the spec defines them, and the only code that makes or checks one: K is HKDF-SHA256 of the seal secret's bytes as given, the kid its fingerprint, the MAC input length-prefixed, the tag HMAC-SHA256 compared with verify_slice, and the mac canonical unpadded base64url. mint computes the session's own scope from the tenant and session, so a replica cannot mint for another session. verify takes only the kid and the tag from the token and everything else from the request. tests/notify_token.rs runs every vector in v1.4-token.json, changes every byte of the token and of each request field, and holds the named notify_token checks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JimHGjsfk2Ktm5GxyZJKKk
jaredLunde
force-pushed
the
jared/notify-token
branch
from
October 19, 2026 00:12
7171451 to
b364e05
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
notify_token, the module that mints and verifies exec v1.4bjn_v1notify tokens exactly as the spec's "The notify token (bjn_v1)" defines them. It is the only code that makes or checks a token; nothing else builds the MAC input, holds the key or compares a tag.NotifyKey::from_seal_secretderivesK = HKDF-SHA256(seal secret, salt empty, info "bjn_v1 notify")from the secret's bytes as given (X25519 clamps only on use), and the kidhex(SHA-256("bjn_v1 kid" ‖ K)[0..4]).mint(tenant, session, job)computes the session's own scope (JobScope::for_session) itself, so a replica cannot mint for another session's scope.verify(token, tenant, session, scope, id)parses the exact grammar (three fields, lowercase-hex kid, 43-char canonical base64url mac), returnsUnknownKidfor any kid but its own, builds the length-prefixed MAC input from the request alone, and compares the full tag withverify_slice.Verdict::refusal_status:malformed/bad_mac→ 401,unknown_kid→ 503.Nothing calls it yet; the
job_endedreceiver inservecomes next.Tests (
tests/notify_token.rs): every vector inv1.4-token.json, the minted vector reproduced, both fixture kids derived from the raw and theStaticSecretforms, a change to every byte of the token and of each request field (over 10,000 variants), plusthe_tag_is_compared_in_constant_timeandmints_only_its_own_scope. A mutant that skips the canonical re-encode and the kid check fails three of them.🤖 Generated with Claude Code
https://claude.ai/code/session_01JimHGjsfk2Ktm5GxyZJKKk