Skip to content

Finish the rename the adversarial review found half-done - #241

Merged
adamjohnwright merged 1 commit into
mainfrom
fix/caller-token-review
Sep 18, 2026
Merged

adamjohnwright merged 1 commit into
mainfrom
fix/caller-token-review

Conversation

@adamjohnwright

Copy link
Copy Markdown
Contributor

Dedicated adversarial pass on #240, which I had not done before it merged. Four findings, all fixed.

1. A failure message that hands you a broken command

~/update-beta-chat.sh refuses to deploy when the verifying key is missing — and told the operator to run:

./bin/make-human-token-keypair.py deploy/beta

That script was renamed in #240. The message fires at exactly the moment someone is blocked mid-deploy, and the command it gives them fails with "No such file". Now it names the real script and cds to the repo first.

The same stale command survived in compose.yaml, docker-compose.yml, pyproject.toml, and the generator script's own usage line — my sed in #240 covered identifiers, not the filename in prose.

2. "proof-of-human" framing outliving the premise that justified it

D1 established the token asserts caller identity, not humanity. Five places still said otherwise, including .gitignore, FR-003, and the startup error a misconfigured deployment prints. An error message claiming a proof-of-human check sends whoever reads it looking for a captcha that does not exist on that path.

3. A line no test could distinguish

Mutation-testing the audience enforcement three ways:

mutation tests failing
audience not enforced at all 10
aud removed from required claims 0
empty env loosens instead of falling back 1

So "aud" in require is redundant — PyJWT already raises MissingRequiredClaimError for an absent aud when an audience is expected. It stays as belt-and-braces against that behaviour changing in a future PyJWT, and a comment now says exactly that, so nobody has to re-derive which line is load-bearing. The other two mutations confirm the enforcement itself is genuinely tested.

4. Verified the preflight without touching beta

Extracted the key-check block and ran it against a repo with the key and one without — ok in the first case, die in the second — rather than running the deploy script, which would have stopped and replaced the running container.

Also confirmed: the endpoint uses the configured audience rather than an explicit one, and iss is not enforced anywhere, which is what the website asked for (the signature already identifies the minter, since they hold the only signing key).

CI-equivalent locally: ruff, format, mypy (129 files), full suite with no API keys set, compose valid.

🤖 Generated with Claude Code

#240 renamed identifiers but not the prose around them, so five places still
named a script that no longer exists and five described a security model D1
disproved.

The one that mattered: the beta deploy script's failure message told the
operator to run `./bin/make-human-token-keypair.py`. That message fires at
exactly the moment someone is blocked mid-deploy, and the command it gave them
would have failed with "No such file". Same stale command in compose.yaml,
docker-compose.yml, pyproject.toml and the generator's own usage line.

"proof-of-human" is gone from .gitignore, pyproject.toml, FR-003, the generator
and the startup error. The token asserts caller identity for one visit; saying
otherwise in an error message is worse than saying nothing, because it sends
whoever reads it looking for a captcha.

Also documented, rather than quietly left: `"aud"` in the required claims is
redundant today. Removing it fails no test, because PyJWT already raises
MissingRequiredClaimError for an absent `aud` when an audience is expected. It
stays as belt-and-braces against that behaviour changing, and the comment says
so, so the next person does not spend time working out which line is
load-bearing.

Verified the preflight both ways by extracting the block and running it against
a repo with the key and one without, rather than running the deploy script and
touching beta.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@adamjohnwright
adamjohnwright merged commit 480db64 into main Sep 18, 2026
10 checks passed
@adamjohnwright
adamjohnwright deleted the fix/caller-token-review branch September 18, 2026 04:37
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