Repository navigation
Derive the sign-in challenge in Pocket before prompting - #1243
Merged
Merged
Conversation
Pocket's sign-in now signs `signinChallenge(begin.challenge)`, a SHA-256 under its own `dormouse/signin/v1` domain, instead of the bytes the Relay's `POST /api/signin/begin` answers, and `finish` names the begin challenge beside the assertion. Both Relays verify through the shared `verifySigninAssertion`, which now consumes the named challenge and accepts only an assertion over its derivation. A sign-in assertion can no longer equal a presence assertion, whose challenge is hashed under `dormouse/presence/v1`. S271 widens to cover every assertion Pocket requests, with a canary seed for the sign-in half; the presence-half seed is rebased onto the new test file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dormouse-bot
left a comment
Collaborator
There was a problem hiding this comment.
I found no issues in the diff. Approval is held only because Workflow Lint is red. zizmor flags ci.yml:403 ("action's hash pin has mismatched or missing version comment"). This PR doesn't touch that file, and main fails the same way at ed40d01 (run). Every other check passes on this head.
The two Pocket tests that hand the Burrow a proof for a connection on the phone's own paired static now build it, and check that it gains nothing, through one helper. The sign-in verifier reads its request with a plain cast. Both canary seeds are rebuilt against the new test file, with the same mutations. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dormouse-bot
approved these changes
Oct 20, 2026
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.
Hardening for Pocket's sign-in.
Pocket used to hand the challenge
POST /api/signin/beginanswers straight to its authenticator. A sign-in assertion and a presence assertion come from the same passkey under the same RP ID, and a verifier reads only the challengeclientDataJSONnames, so nothing kept a sign-in tap from being signed over a value shaped like a presence challenge. Sign-in now signs a value derived under its own domain:signinChallenge(challenge)inremote-lib-common/src/security/presence.ts, besidepresenceChallenge: base64urlSHA-256(lengthPrefixedConcat("dormouse/signin/v1", challenge's bytes)). It refuses an unbounded or non-base64url challenge.PocketClient.signinsignssigninChallenge(begin.challenge)and sends{ challenge, assertion }tofinish(SigninFinishRequestgainschallenge).verifySigninAssertion, which both Relays run, takes the whole request. It consumes the namedbeginchallenge first, as before, and then accepts only an assertion over its derivation. A missing, malformed, or unissued challenge, or an assertion over anything else (includingbegin's raw bytes), gets 400unrecognized or expired challenge.relay/src/app.tsandhosted/server/relay-api.tspass the body through.Since presence challenges are hashed under
dormouse/presence/v1, the two kinds of assertion are now disjoint. A sign-in could stand in for a presence proof only through a SHA-256 collision.Rollout
Each Relay serves its own Pocket same-origin, and
index.htmlisno-cache, so a fresh load always pairs a Relay with a matching Pocket. A Pocket tab left open across the deploy fails its next sign-in with that 400 until it reloads. Existing sessions are unaffected, since only sign-in changes. There is deliberately no fallback that accepts the old raw-challenge assertion.Tests
lib/src/remote/client/pocket-client.test.ts→ "the presence proof":beginwith a presence challenge for a connection on the phone's own paired static;signinChallengeof it, andfinishnames the Relay's challenge;remote-lib-common/test/presence.test.mjs: an independently computed vector forsigninChallenge, its distinct domain, and its refusals.remote-lib-common/test/relay-common.test.mjs: the verifier's order (nothing spent without a named challenge), refusal of raw-bytes and other-derivation assertions, and acceptance of a padded serialization.relay/test/signin.test.mjsandhosted/server/tests/relay.test.ts: each Relay refuses an assertion overbegin's bytes as given. The existing sign-in helpers now sign the derivation.The Pocket test goes red with
signinreverted to signbegin.challenge; the Relay tests go red with the derivation check removed.Specs
docs/specs/security-remote.md→ "Trust boundary":S271now covers every assertion Pocket requests:signinmust signsigninChallengeof the Relay's challenge, and any othergetAssertioncall must sign a challenge derived under its own domain. Rationale extended; word budget ratcheted to 7100.docs/specs/remote-security-model.md→ "Presence proofs": new bullet, "A sign-in assertion is never a presence assertion".docs/specs/relay.md: sign-in verification is over the derived challenge..github/audit/canaries/pocket-signin-challenge-underived.patch(Rule: S271). The existingpocket-presence-challenge-unchecked.patchis rebuilt against the new test file, with the same mutation.This PR touches
.github/, so the owner merges it.🤖 Generated with Claude Code