Safari can't approve: its stored device key doesn't sign after a reload #94
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What happened
A new user on Safari on Mac couldn't add a machine with hosted control (2026-10-03):
signed_bycheck, and it signed both recovery codes fine.illogicald joinprinted a code. The code was valid: recomputing it from the request's keys gives the same code, so the browser's "doesn't match its code" check passes.that approval doesn't check out (signed by a device this account trusts?)(approval_ok,crates/control/src/api.rs). The join stayed unapproved. The account has no revocations, no pending second browser, and Safari is its root.So the device approving is the right one and is trusted, but its signature on the daemon's certificate doesn't verify.
Suspected cause (unconfirmed)
The browser's Ed25519 key is a non-extractable
CryptoKeykept in IndexedDB (web/src/e2e/keys.ts). Every signature that worked was made in the page load that generated the key, with the in-memory key. The approval came after opening the#join=link, a new page load, so with the key read back from IndexedDB. If Safari doesn't round-trip Ed25519 (and maybe X25519)CryptoKeys through structured clone correctly, every later signature fails. If the X25519 key is affected too, connecting to machines from that Safari would fail as well.This hasn't been reproduced on Safari: geek has no Safari, and control doesn't keep rejected approvals.
Fix
generateKeys()stores the keys, read them back from IndexedDB and check a sign→verify (and an X25519 agreement) against the public keys. Enroll only once that passes, so a browser can never become a trusted device with keys it can't use after a reload.approval_ok,join_approve,approve,enroll) with the reason, account and device ids, sofly logsshows the cause next time. No signatures or bodies in the logs beyond ids.Workaround for affected users
Sign in from Chrome or Firefox, let that browser in with a recovery code (it signs with the code's key, not Safari's), then approve the
illogicald joinlink there.Merged into main (
abb197b, from54ddccaand7febed0). CI passed on both runners.Cause, reproduced in Playwright's WebKit (Safari 26.6 engine): IndexedDB gives back an X25519
CryptoKey, and any record that holds one, asnull. Ed25519 and AES-GCM keys come back fine. So an enrolled Safari made new keys on every page load and signed approvals as a device the account doesn't trust. On main's old code, the new WebKit join-after-reload test reproduces the failure; with the fix it passes.Fix:
device-keys.webkit.spec.ts) covers the round trip, a join approved after a reload, and re-enrolment.Left: deploy control, then open
/key-probe.htmlin real Safari on the Mac and on iOS and note the version and the verdict here. The affected user's Safari should then show the lost-key screen. They enroll again with a recovery code, then approve the join.