feat(be): verify a browser's key and its announced successor - #4264
Open
sea-snake wants to merge 38 commits into
Open
feat(be): verify a browser's key and its announced successor#4264sea-snake wants to merge 38 commits into
sea-snake wants to merge 38 commits into
Conversation
This was referenced Aug 22, 2026
sea-snake
marked this pull request as ready for review
August 22, 2026 18:16
|
✅ No security or compliance issues detected. Reviewed everything up to a7b0d9e. Security Overview
Detected Code Changes
|
sea-snake
force-pushed
the
feat/session-device-key-proof
branch
from
August 22, 2026 18:44
b3521fc to
52cdad9
Compare
A sign-in that names a browser has to prove the browser holds the key it names, and the successor it announces for its next sign-in. Two signatures, under two domains: the current key over the session key and the successor, and the successor over the session key and the current key. Separate domains are what stop either signature being replayed in the other's role. Ingress messages are public, so a key read off the wire could otherwise be announced by someone who does not hold it, and claimed when its browser next presents one. P-256 only, and no fallback: a key that does not parse, a signature of the wrong length and an empty signature are each refused rather than skipped. The module is annotated `allow(dead_code)` because its caller is the sign-in ceremony, which lands two PRs up. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
sea-snake
force-pushed
the
feat/session-device-key-proof
branch
from
August 22, 2026 18:58
52cdad9 to
960f5be
Compare
`Device` is taken — it is the passkey credential that authenticates the anchor, and `DeviceData` is in the candid interface. The word this wants is the one its own doc comment already used, and the one the frontend uses throughout. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LVi99RYo2jyi2kCurgovNJ
The module, its function, its parameters and both signature domains said device. The domain strings are what the browser signs over, so they change with the frontend that produces them. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LVi99RYo2jyi2kCurgovNJ
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.
Design: #4224. Overview: #4230. The verifier only — its caller is the sign-in ceremony in #4268, which also removes the
#[allow(dead_code)]this carries.A session records which browser created it, so the user can see where they are signed in and end one browser's access everywhere at once. That is only worth anything if the browser named in a sign-in is the browser that made it; otherwise an attacker holding an access method could attribute their session to a browser the user recognises, and the settings list would lie. Ingress messages are public, so a key presented in one sign-in can be read off the wire by anyone.
verify_device_keyschecks two signatures before a sign-in may name a browser: the current key over the session key and the announced successor, and the successor over the session key and the current key. Each is made under its own domain separator,ii-session-device-keyandii-session-device-successor, so neither can be replayed in the other's role.Requiring possession of the successor is what closes the wire-reading attack: announcing a key you do not hold is impossible without its private half, so a key read off the wire cannot be claimed when its owner next presents one.
P-256 only, no fallback. A key that does not parse, a signature of the wrong length, and an empty signature are each refused rather than skipped.
Tests:
device_key::tests(10), one accepting case and nine refusals — including a successor signature replayed as the current one, a signature over another session key, and one paired with a substituted successor.