Skip to content

factory: an organization's people sign in with a passkey first (E10) - #2652

Merged
santoshkumarradha merged 18 commits into
work/teamsfrom
w2/e10-passkey
Nov 16, 2026
Merged

santoshkumarradha merged 18 commits into
work/teamsfrom
w2/e10-passkey

Conversation

@santoshkumarradha

@santoshkumarradha santoshkumarradha commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Passkeys (WebAuthn: Touch ID, Face ID, Windows Hello, a phone by QR, a security key) become the first way to sign in to an organization server reached over HTTPS at a DNS name. The ceremony runs in the person's default browser on a small page the server serves; the engine gets the session through a PKCE-shaped start/poll.

Based on work/teams at d274ba1d5 (E9 #2646, merged). Do not merge before the independent security review.

Why the browser, not the desk's web view

WKWebView only offers a passkey for an RP id that is one of the app's webcredentials: associated domains (Apple engineer, developer.apple.com/forums/thread/726943). A self-hosted server can't be one, so the contract's claim holds. ASWebAuthenticationSession would also work for the desk, and the server wouldn't change for it.

Library

github.com/go-webauthn/webauthn v0.18.2: BSD-3-Clause, actively maintained (release 2026-09-19), and the de-facto Go relying party (successor of duo-labs/webauthn). It handles attestation none, discoverable login, backup flags and clone warnings. Adding it bumps x/crypto, x/net, x/sync, x/sys and x/text by MVS.

What changes

  • Server (internal/factory/serve/passkey.go, new files):
    • POST /v1/auth/passkey/start|poll|cancel, GET /v1/me/passkeys, POST /v1/me/passkeys/remove.
    • The page GET /passkey/<flow> plus its same-origin JSON options/finish.
    • /v1/about sign_in lists passkey first only with HTTPS + a DNS name.
  • Reuses E9's model, with nothing parallel built:
    • accounts.json under the row lock.
    • SignUp (atomic link spend) with handleReferenced.
    • mintSession with the generation stamp, endSessionsOf.
    • The guard and limiter, and the audit.
    • Removing a passkey and a reset both move the generation. The poll mints only while the account is still at the generation the ceremony saw.
  • Engine: factory.passkey_start/poll/cancel/list/remove and the hello feature factory_passkey, exactly as desk lane W10 proposed. The verifier never leaves the engine.
  • Config: domain: localhost is allowed with tls: files (for local TLS and the e2e).
  • Docs: PROTOCOL.md, the chat manual (factory.md) and the change entry.
  • Contract: ~/work/teams-wave/PASSKEYS.md gets an "As built" section. That file is outside the repo and was edited in place.

Security as built

  • WebAuthn options:
    • RP id = host, one origin, attestation none.
    • residentKey: required and userVerification: required.
    • authenticatorAttachment unset, so Windows Hello, a phone by QR and security keys are all offered.
  • Challenges and flows:
    • A challenge is single-use (taken out before verifying) and lives 5 min.
    • A flow lives 10 min, with 512 flows at most, 5 failed tries per flow and 20 challenges per flow.
    • The poll needs the verifier and the one-time loopback code (constant time, single use); a wrong verifier or code is counted, and the fifth ends the flow.
    • The session is answered exactly once.
  • Throttling:
    • Starts: 30 per address per 15 min, spent on entry.
    • Finish tries go through E9's guard under a per-address name.
  • Sign-in kind (X1 P4):
    • A session made by a passkey sign-in or join answers sign_in_kind: "passkey" and github_signed_in: false, both in the poll's me and in /v1/me.
    • The kind is kept with the session (via in sessions.json), so it survives a restart.
    • The appwire enum is now password,passkey,github, and a passkey person can sign out.
  • E9's F1/F2 throttles are unchanged:
    • A passkey person's password change goes through the per-session bucket; a test proves 10 wrong tries from 10 addresses run that one session dry, while another session is unaffected.
    • A passkey sign-in makes no device token, so the per-device ceiling has nothing to count.
    • Removing a passkey and a reset prune device tokens with the generation.
  • Join rules:
    • A link made for one GitHub login offers no passkey and refuses a passkey join (github_link), following E9's rule.
    • The last way in can't be removed.
    • A passkey-only person sets a first password with an empty current.
    • A reset replaces every way in.
  • Page:
    • CSP default-src 'none'; script-src 'self'; style-src 'self'; connect-src 'self'; img-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'.
    • no-store, no-referrer, nosniff, X-Frame-Options: DENY, COOP.
    • Origin and Sec-Fetch-Site: same-origin are required on its JSON.
  • Leaks: nothing secret reaches logs, traces, the record or appwire answers; there is a test for this.

Security review fixes (C1, H1, M1, L1, L2)

  • C1, sign-in phishing (RFC 8252 §7.3 loopback):
    • Every start binds a one-shot engine listener on 127.0.0.1:0 at a random 256-bit path (cmd/codeaf/appfactory_loopback.go) and sends return_port/return_path.
    • When the ceremony finishes, the page navigates to http://127.0.0.1:<port>/<path>?code=<one-time>; only that exact shape is followed.
    • The poll needs the verifier and the code; without the code it returns elsewhere, never a session.
    • Joins, adds and resets write the account only at that poll, so a stolen add or join url changes nothing.
    • On another device, the page reads "Finish on the computer that started this". Copy address works on the same computer.
    • CSP: no fetch or iframe goes to 127.0.0.1, only a top-level navigation, which form-action does not govern and which Chrome Local Network Access does not prompt for.
  • H1, a stolen session taking an account over: adding a passkey, setting a first password and removing a passkey need a proof from the last 5 minutes.
    • A proof is a sign-in, purpose confirm, or POST /v1/me/password/confirm (factory.password_confirm, which pays the per-session F1 bucket).
    • Without one, the server answers 403 step_up_required and appwire answers step_up.
    • An add by a person who has passkeys asks for one of them (get()) before create() on the same page.
  • M1:
    • At most 8 pending flows per address (/64) and 30 starts per /48, with sign-ins capped at 384 of 512.
    • Unopened sign-in pages end after 2 minutes and are evicted oldest first, so a flood cannot crowd out a join or an add.
  • L1: https://host:443 works.
  • L2: a wrong verifier is counted rather than ending the flow, and cancel requires https.

Residual risk:

  • A person talked into pasting their loopback address to an attacker.
  • An orphan keychain passkey if the commit fails at the poll.
  • The Windows loopback bind is unproven here, because work/teams has no Windows CI.

Proof

  • Go: internal/factory/serve/passkey_test.go uses a software ES256 authenticator (serve/passkeytest). It covers:

    • join, sign out and sign in;
    • UV, resident key and attachment;
    • refusals: wrong origin, replay, expired flow or challenge, missing or wrong verifier, unknown passkey, a passkey owned by someone else, a taken name, a stolen url;
    • the poll answering once under 8 concurrent polls, and racing joins on one link;
    • add then remove ending other sessions, and the last way in;
    • a reset replacing every way in;
    • a way in changed before the poll signing nobody in;
    • the sign-in kind in the poll and /v1/me, including after a restart;
    • a passkey session's password tries paying the per-session bucket;
    • GitHub links taking no passkey;
    • throttled starts, strict JSON and HTTPS, the locked-down page, and no secret sink.

    The engine tests in cmd/codeaf/appfactory_passkey_test.go use a real TLS org.

  • End to end: scripts/passkey-e2e.sh runs a real codeaf factory serve over TLS on https://localhost and two codeaf app engines. It covers:

    • Chromium CDP virtual authenticators for internal, hybrid and usb: join → sign out → sign in → add → sign in elsewhere → remove → the other session is revoked → the last way in is refused;
    • a browser with no WebAuthn, which gets the password route;
    • 320 px with no horizontal scroll;
    • no secret on the wire;
    • a WebKit smoke and a Firefox smoke.

    It also checks that factory.me says sign_in_kind: "passkey".

    • C1 probe:
      • Setup: the victim's browser cannot reach the starter's 127.0.0.1.
      • The victim's ceremony passes, and the page says to finish on the starting computer.
      • The starter's poll ends elsewhere with no connection, and the starter stays signed_out.
      • The same passkey on the starting computer signs in.
    • H1:
      • A confirm ceremony ("Confirm it's you") finishes, and a passkey-only person's password_confirm returns not_found.
      • In Go, a stolen session's takeover chain is refused without a step-up.

    Result: 38 pass, 1 skip. The skip is the Firefox ceremony: its headless soft token refuses every create. The page loads and detects support there.

  • Gate: BASE=bc25bbb61 make pr-ready at d6021f1: test-quick, tooling and test-touched pass, apart from the known reds below. That run regenerated THIRD-PARTY-NOTICES for the webauthn deps. internal/config TestRegistryCoversEveryUserFacingEnvironmentPin also fails, and the gate marks it "already failing on the base". Earlier gate notes:

  • Gate (earlier): BASE=d274ba1d5 make pr-ready. BASE has to go in the environment: passed as a make argument, it overrides the fixture repo's own BASE inside touched-packages_test.sh. That bug was already there before this change. Result:

    • test-quick (build, vet, fmt, manual gates, laws, changelog) passes.
    • Tooling passes, except one-suite_test.sh, which hangs on this box. AppArmor blocks bwrap (kernel.apparmor_restrict_unprivileged_userns = 1), whatever the branch.
    • test-touched passes except internal/session TestTheFixedPrefixStaysUnderItsBudget. The gate marks it "already failing on the base", the same failure E9 saw on e884b0545.

Re-review 2 fixes (N1–N4, wrong-device page) — af1d050..26eeb8e

  • N1:
    • An add never asks for a step-up along the way; it needs confirm or password_confirm beforehand.
    • The first page-origin options binds the flow to its browser (an HttpOnly; Secure; SameSite=Strict cookie on /passkey/<flow>). options, finish and the hand-over refuse any other browser with other_browser.
    • finish returns no code, only next:/passkey/<flow>/go. The bound browser follows it once to a 303 onto the loopback.
  • N2: a sign-in is never a step-up.
  • N3:
    • The code is 16 random bytes ‖ HMAC-SHA256(return_key, …)[:16], where return_key comes from the engine at start.
    • The listener checks Host, path and that mark. Anything else gets 404 (429 past 20 a second), and the listener keeps waiting.
    • The residual is documented in the manual and PASSKEYS.md.
  • N4: only a page-origin options opens a flow. Opened sign-ins are capped at 16 per /24 or /48, and the oldest is dropped.
  • Wrong device: the page shows "Done." / "Returning to codeaf on the computer that started this…" / "If your browser says it can't connect…" about 1 s before navigating. There is no probe, so no Local Network Access prompt, and the CSP is unchanged.
  • Probes:
    • N1: TestASplitStepUpCannotBeFinishedByTheAttacker replays the chain, and it is refused at every step.
    • Binding: TestAFlowIsBoundToOneBrowser.
    • N2: a session 1 minute old is refused an add, a removal and a first password.
    • N3: TestThePasskeyLoopbackTakesOnlyItsOwnFlowsCode.
    • N4: TestAFloodThatOpensItsPagesIsHeldPerNetwork floods 48 addresses in one /24; exactly 16 stay opened, and a person on another network signs in.
    • The e2e passes 42/43 with 1 skip (the headless Firefox ceremony). Its rows include N2, and on the wrong device our words show before Chrome's error, the starter ends elsewhere and stays signed_out.
  • Gate: BASE=bc25bbb61 make pr-ready is green, apart from 2 failures marked "already failing on the base" (TestTheFixedPrefixStaysUnderItsBudget, TestRegistryCoversEveryUserFacingEnvironmentPin).

Re-review 3 fixes (F1–F3), head 85c0ae335

  • F1, cookie fixation:
    • The flow binds by one __Host-codeaf_pkb cookie (Secure, Path=/, no Domain, HttpOnly, SameSite=Strict, 24 h). The flow keeps sha256 of the id, and a valid existing id is reused.
    • Every test that drives the page goes through the browse helper, which asserts the __Host- prefix, Path=/ and an empty Domain.
    • HSTS adds includeSubDomains for a name the operator owns. It does not add it for IPs, localhost, single-label names, or shared wildcard names (sslip.io, nip.io, …), which are documented as demo-only.
    • Probe: TestAPlantedCookieDoesNotBindThePersonsBrowser replays the attack (an id planted on the victim's browser) and shows it is refused. TestHSTSCoversSubdomainsOnlyOfANameTheOperatorOwns covers HSTS. The e2e row asserts the cookie's name and attributes.
  • F2, flood from many networks:
    • When all 384 sign-in slots are opened, the oldest opened sign-in from the /24 or /48 holding the most is evicted.
    • Probe: TestAFloodFromManyNetworksStillLetsAPersonStart fills all 384 slots from 24 networks (2 addresses × 8 flows each). A start from a fresh network still succeeds and signs in.
  • F3, one confirmation for one action:
    • A confirm (passkey_start purpose confirm with action, or password_confirm with action) is for add_passkey, remove_passkey + id, or set_password.
    • It lets that action happen once within 5 min. There is no session-wide window, and a sign-in never counts.
    • The page names the action and the computer: "Remove passkey “MacBook” — requested by codeaf on ".
    • The step_up refusal carries action, and appwire detail {action, passkey?}.
    • Probe: TestAConfirmationIsForOneActionOnce checks that a confirmation works once and that one for passkey A does not remove passkey B. The e2e rows cover one add per confirmation, a removal without its confirmation getting step_up, and the lede naming the removal.
  • Codes and loopback:
    • A code works for 60 s after done (TestALoopbackCodeLivesOneMinute).
    • The loopback answers its code with a 303 to a clean http://127.0.0.1:<port>/done. This is covered by an engine loopback test and an e2e row.
  • Desk: W10 adopted the new wire on desk revert: #440 and #437, the lumped stream that left twelve tui3 tests red #452 at 69721f5ed.
  • Proof:
    • The e2e passes 46 rows with 1 skip (the headless Firefox soft-token ceremony).
    • BASE=bc25bbb61 make pr-ready: test-quick, tooling and test-touched pass. The tooling run excludes one-suite_test.sh, because bwrap is blocked on this machine. The only reds are the two known ones the gate marks "already failing on the base": TestRegistryCoversEveryUserFacingEnvironmentPin and TestTheFixedPrefixStaysUnderItsBudget.

Re-review 4 fixes (N1–N3) and the X1 browser leg, head 499de5552

  • N1, fair eviction drained a busy network:
    • Fairness now counts opened sign-ins per /24 for IPv4 and per /32 for IPv6.
    • A full table evicts from the busiest network, oldest flow first, but only when that network holds more than 4 and more than the newcomer's network + 1. Otherwise the newcomer gets 429.
    • The floor of 4 is added to your rule. Without it, a fresh newcomer (count 0) would still evict the office's 3.
    • Probe: TestAFloodOneSignInPerNetworkKeepsAnOfficesFew. An office /24 keeps all 3 against 384 one-per-network starts, both as IPv4 /24s and as IPv6 /48s in one /32. The F2 flood test still passes.
  • N2, the confirmation table could be filled:
    • password_confirm for a passkey the person doesn't have gets 404.
    • A session holds at most 3 confirmations, and a fourth replaces the oldest.
    • The global cap of 4096 drops the oldest grant anyone holds, never the new one.
    • Probe: TestConfirmationsAreFewPerSessionAndOnlyForRealPasskeys.
  • N3, lows:
    • Device name: the page reads "requested by a computer named “”, signed in from ". The name has its quote marks removed and is capped at 60 bytes.
    • HSTS: includeSubDomains is opt-in through hsts_include_subdomains: true, off by default. Shared wildcard names never get it.
    • Passkey-id cap: the desk now matches 512 bytes (revert: #440 and #437, the lumped stream that left twelve tui3 tests red #452 758122225).
    • Probes: TestAConfirmationIsForOneActionOnce with an instruction-like name, TestHSTSCoversSubdomainsOnlyWhenTheOperatorOwnsTheNameAndAsks, and the e2e lede rows.
  • X1:
    • An add or confirm with a stray link, username or name gets 422 instead of 404 (TestAnAddOrConfirmWithAStrayFieldIsABadRequest).
    • localhost and *.localhost are documented as one-machine trial addresses. They stay accepted because domain: localhost with tls: files is how passkeys are tried locally, and the e2e runs on it.
  • Proof:
    • E2e at 3f9a8a370: 46 passed, 1 skipped (the headless Firefox ceremony). It was not rerun after the X1 fix.
    • BASE=bc25bbb61 make pr-ready at 499de5552: test-quick, tooling and test-touched pass. Tooling excludes one-suite_test.sh, because bwrap is blocked on this machine. The only reds are the two known ones marked "already failing on the base".

Re-check 5 fixes, head f005dd3dc

  • Blocker, bidi and format characters on the confirm page:
    • cleanDisplayName drops every format character (Cf) and refuses any control character, C1 included. plainText cleans the raw device-label fallback the same way.
    • The confirm page sets the computer name and the passkey name each in its own <bdi>.
    • Probe: TestANameCannotReorderOrHideTheServersWords covers U+202E (your exact probe), U+2066/2069, U+200B and U+0090, in both the display name and the device fallback. The page check asserts no U+202E survives and the name sits in a <bdi>.
  • Grants per account: an account holds at most 3 confirmations across all its sessions, oldest dropped. Probe: TestConfirmationsAreFewPerAccount.
  • IPv6 /32 eviction:
    • When the busiest network is an IPv6 /32, the evicted sign-in comes from its busiest /48.
    • Probe: TestAFloodOnTheSameProviderDrainsItsOwnFlowsFirst. The table is asserted full (384), and the victim's 3 survive 64 fresh-network starts. I disabled the fix to check: the test then fails.
  • Manual: the limits now say a sustained flood from hundreds of networks can refuse new passkey sign-ins while it lasts, and that password sign-in is unaffected.
  • Proof:
    • make test-focus passes for the serve passkey/password/confirm/flood/name tests and the engine passkey/loopback tests. The full serve suite passes.
    • make test-quick and the manual gates pass.
    • E2e: 46 passed, 1 skipped (the headless Firefox ceremony).

Assisted-by: CodeAF
Co-Authored-By: CodeAF [email protected]

santoshkumarradha and others added 7 commits November 16, 2026 03:19
…n browser (E10)

The server offers passkeys (WebAuthn, via github.com/go-webauthn/webauthn)
first wherever its address is https with a DNS name. The ceremony runs on a
page the server serves, in the person's browser; the engine starts a flow
with a PKCE-shaped challenge and polls with its verifier for the session.

Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>
…ry_passkey (E10)

The engine makes and keeps the PKCE verifier, opens nothing itself, checks
the ceremony url is on the organization's own origin, and keeps the session
a done poll answers exactly as access_sign_in keeps one.

Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>
…gainst the real binary (E10)

scripts/passkey-e2e.sh runs a real codeaf factory serve over TLS at
https://localhost, two real codeaf app engines, and Chromium with CDP
virtual authenticators on the internal, hybrid and usb transports. The run
found that the page's form rule beat the hidden attribute, so a browser with
no WebAuthn still showed the button. domain: localhost is now accepted with
tls: files.

Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>
…d it, and taking over an account needs a fresh proof (E10 review)

C1: every flow binds a one-shot listener on 127.0.0.1 in the engine; the
page hands the browser there with a one-time code, and the poll answers a
session only with the verifier and that code. A sign-in, join or add opened
on another device never completes (state elsewhere). Joins and adds write
the account only at that poll.

H1: adding a passkey, a first password and removing a passkey need a proof
from the last five minutes: a sign-in, purpose confirm, or
factory.password_confirm. Otherwise step_up. An add by a person with
passkeys asks for one of them first.

M1: pending flows are capped per /64 and starts per /48, sign-ins get at
most three quarters of the room, unopened sign-in pages end after two
minutes. L1: a default port in the address works. L2: a wrong verifier is
counted, not fatal; cancel needs https like the rest.

Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>
…E10 review)

Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>
…nd a confirmation (E10 review)

Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>
santoshkumarradha and others added 11 commits November 16, 2026 04:23
…rowser, and the loopback takes only its own code (E10 re-review 2)

N1: an add no longer asks for an existing passkey along the way; it needs
a confirm or the current password beforehand. The first page-origin
options binds the flow to that browser (HttpOnly, Secure, SameSite=Strict
cookie on /passkey/<flow>); options, finish and the hand-over refuse any
other. The finish answer carries no code: the bound browser follows
/passkey/<flow>/go once, a 303 to the engine's loopback.

N2: a sign-in is never a step-up.

N3: the code carries an HMAC under a key the engine sends with the start;
the listener checks Host, path and that mark, answers anything else 404
(429 past 20 a second) and keeps waiting until its own code.

N4: only a page-origin options opens a flow; opened sign-ins are capped
per /24 or /48. The page says where it finishes before the browser's
"can't connect".

Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>
…e browser, and the shared-computer limit (E10 re-review 2)

Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>
…n another device, and confirms before adding (E10 re-review 2)

Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>
…air eviction, codes live a minute (E10 re-review 3)

A confirm is started for one action (add a passkey, remove passkey X, set a
first password); its page names the action and the computer asking, and it
lets that action happen once within five minutes. step_up names the action.
The flow binds by a __Host-codeaf_pkb cookie no sibling host can plant; HSTS
covers subdomains of a name the operator owns. A full table of opened
sign-ins drops the oldest from the busiest network. A code works for 60 s
after done, and the loopback answers it with a 303 to a clean /done.

Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>
…are for demos (E10 re-review 3)

Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>
…d one change per confirmation (E10 re-review 3)

Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>
… per session, a quoted computer name, opt-in includeSubDomains (E10 re-review 4)

A full table of opened sign-ins takes room only from a network (/24, or
/32 for IPv6) holding more than four and more than the newcomer's own plus
one, oldest flow first; otherwise the newcomer is refused. A session holds
three confirmations at most, a fourth replacing the oldest, and a full
table drops the oldest anyone holds. A password confirm for a passkey the
person lacks is a 404. The confirm page quotes the engine's computer name
beside the session's sign-in date and the address the server saw. HSTS
includeSubDomains is the operator's opt-in, hsts_include_subdomains.

Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>
…ons a session, hsts_include_subdomains (E10 re-review 4)

Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>
…host is a one-machine trial address (E10, X1 browser leg)

Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>
…irmations an account, a same-provider flood drains itself (E10 re-check 5)

Display names, passkey names and the computer a confirm page names lose
every format character (bidi overrides and isolates, zero-width marks); a
control character, C1 included, refuses a display name, and the session's
raw device label is cleaned the same way. The confirm page sets each such
name in its own <bdi>. An account holds three confirmations across its
sessions, oldest out. When the busiest network in a full table is an IPv6
/32, the sign-in it gives up comes from its busiest /48.

Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>
…-ins while it lasts; passwords are unaffected (E10 re-check 5)

Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>
@santoshkumarradha
santoshkumarradha merged commit 3dc626e into work/teams Nov 16, 2026
1 check passed
@santoshkumarradha
santoshkumarradha deleted the w2/e10-passkey branch November 16, 2026 12:16
ZeroPoint95 pushed a commit that referenced this pull request Nov 24, 2026
…2652)

* factory: an organization's people sign in with a passkey, in their own browser (E10)

The server offers passkeys (WebAuthn, via github.com/go-webauthn/webauthn)
first wherever its address is https with a DNS name. The ceremony runs on a
page the server serves, in the person's browser; the engine starts a flow
with a PKCE-shaped challenge and polls with its verifier for the session.

Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>

* engine: factory.passkey_start/poll/cancel/list/remove and hello factory_passkey (E10)

The engine makes and keeps the PKCE verifier, opens nothing itself, checks
the ceremony url is on the organization's own origin, and keeps the session
a done poll answers exactly as access_sign_in keeps one.

Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>

* manual: passkeys on an organization, and a reset replaces every way in (E10)

Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>

* factory: passkeys proven end to end in Chromium, WebKit and Firefox against the real binary (E10)

scripts/passkey-e2e.sh runs a real codeaf factory serve over TLS at
https://localhost, two real codeaf app engines, and Chromium with CDP
virtual authenticators on the internal, hybrid and usb transports. The run
found that the page's form rule beat the hidden attribute, so a browser with
no WebAuthn still showed the button. domain: localhost is now accepted with
tls: files.

Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>

* factory: a passkey ceremony finishes only on the computer that started it, and taking over an account needs a fresh proof (E10 review)

C1: every flow binds a one-shot listener on 127.0.0.1 in the engine; the
page hands the browser there with a one-time code, and the poll answers a
session only with the verifier and that code. A sign-in, join or add opened
on another device never completes (state elsewhere). Joins and adds write
the account only at that poll.

H1: adding a passkey, a first password and removing a passkey need a proof
from the last five minutes: a sign-in, purpose confirm, or
factory.password_confirm. Otherwise step_up. An add by a person with
passkeys asks for one of them first.

M1: pending flows are capped per /64 and starts per /48, sign-ins get at
most three quarters of the room, unopened sign-in pages end after two
minutes. L1: a default port in the address works. L2: a wrong verifier is
counted, not fatal; cancel needs https like the rest.

Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>

* manual: finish a passkey on the same computer, and confirm it's you (E10 review)

Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>

* factory: the passkey e2e probes a sign-in opened on another device, and a confirmation (E10 review)

Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>

* factory: a step-up is only ever its own flow, a flow belongs to one browser, and the loopback takes only its own code (E10 re-review 2)

N1: an add no longer asks for an existing passkey along the way; it needs
a confirm or the current password beforehand. The first page-origin
options binds the flow to that browser (HttpOnly, Secure, SameSite=Strict
cookie on /passkey/<flow>); options, finish and the hand-over refuse any
other. The finish answer carries no code: the bound browser follows
/passkey/<flow>/go once, a 303 to the engine's loopback.

N2: a sign-in is never a step-up.

N3: the code carries an HMAC under a key the engine sends with the start;
the listener checks Host, path and that mark, answers anything else 404
(429 past 20 a second) and keeps waiting until its own code.

N4: only a page-origin options opens a flow; opened sign-ins are capped
per /24 or /48. The page says where it finishes before the browser's
"can't connect".

Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>

* manual: a sign-in is not a confirmation, a passkey page belongs to one browser, and the shared-computer limit (E10 re-review 2)

Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>

* factory: the passkey e2e shows our words before the browser's error on another device, and confirms before adding (E10 re-review 2)

Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>

* factory: one confirmation for one action, a __Host- browser cookie, fair eviction, codes live a minute (E10 re-review 3)

A confirm is started for one action (add a passkey, remove passkey X, set a
first password); its page names the action and the computer asking, and it
lets that action happen once within five minutes. step_up names the action.
The flow binds by a __Host-codeaf_pkb cookie no sibling host can plant; HSTS
covers subdomains of a name the operator owns. A full table of opened
sign-ins drops the oldest from the busiest network. A code works for 60 s
after done, and the loopback answers it with a 303 to a clean /done.

Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>

* manual: confirm it's you for one change, once; shared wildcard hosts are for demos (E10 re-review 3)

Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>

* factory: the passkey e2e checks the __Host- cookie, a clean /done, and one change per confirmation (E10 re-review 3)

Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>

* factory: fair eviction never drains a busy network, few confirmations per session, a quoted computer name, opt-in includeSubDomains (E10 re-review 4)

A full table of opened sign-ins takes room only from a network (/24, or
/32 for IPv6) holding more than four and more than the newcomer's own plus
one, oldest flow first; otherwise the newcomer is refused. A session holds
three confirmations at most, a fourth replacing the oldest, and a full
table drops the oldest anyone holds. A password confirm for a passkey the
person lacks is a 404. The confirm page quotes the engine's computer name
beside the session's sign-in date and the address the server saw. HSTS
includeSubDomains is the operator's opt-in, hsts_include_subdomains.

Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>

* manual: the confirm page quotes the computer's name, three confirmations a session, hsts_include_subdomains (E10 re-review 4)

Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>

* factory: an add or confirm with a stray field is a bad request; localhost is a one-machine trial address (E10, X1 browser leg)

Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>

* factory: a name cannot reorder or hide the server's words, three confirmations an account, a same-provider flood drains itself (E10 re-check 5)

Display names, passkey names and the computer a confirm page names lose
every format character (bidi overrides and isolates, zero-width marks); a
control character, C1 included, refuses a display name, and the session's
raw device label is cleaned the same way. The confirm page sets each such
name in its own <bdi>. An account holds three confirmations across its
sessions, oldest out. When the busiest network in a full table is an IPv6
/32, the sign-in it gives up comes from its busiest /48.

Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>

* manual: a flood from hundreds of networks can refuse new passkey sign-ins while it lasts; passwords are unaffected (E10 re-check 5)

Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>

---------

Co-authored-by: CodeAF <[email protected]>
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