Repository navigation
factory: an organization's people sign in with a passkey first (E10) - #2652
Merged
Merged
Conversation
santoshkumarradha
force-pushed
the
w2/e10-passkey
branch
from
November 16, 2026 06:32
d4eef0f to
6e8ce33
Compare
…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]>
…n (E10) 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
force-pushed
the
w2/e10-passkey
branch
from
November 16, 2026 08:56
6e8ce33 to
d6021f1
Compare
…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]>
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]>
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.
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/teamsatd274ba1d5(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.ASWebAuthenticationSessionwould also work for the desk, and the server wouldn't change for it.Library
github.com/go-webauthn/webauthnv0.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 attestationnone, 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
internal/factory/serve/passkey.go, new files):POST /v1/auth/passkey/start|poll|cancel,GET /v1/me/passkeys,POST /v1/me/passkeys/remove.GET /passkey/<flow>plus its same-origin JSONoptions/finish./v1/aboutsign_inlistspasskeyfirst only with HTTPS + a DNS name.SignUp(atomic link spend) withhandleReferenced.mintSessionwith the generation stamp,endSessionsOf.factory.passkey_start/poll/cancel/list/removeand the hello featurefactory_passkey, exactly as desk lane W10 proposed. The verifier never leaves the engine.domain: localhostis allowed withtls: files(for local TLS and the e2e).factory.md) and the change entry.~/work/teams-wave/PASSKEYS.mdgets an "As built" section. That file is outside the repo and was edited in place.Security as built
residentKey: requiredanduserVerification: required.authenticatorAttachmentunset, so Windows Hello, a phone by QR and security keys are all offered.sign_in_kind: "passkey"andgithub_signed_in: false, both in the poll'smeand in/v1/me.viain sessions.json), so it survives a restart.password,passkey,github, and a passkey person can sign out.github_link), following E9's rule.current.default-src 'none'; script-src 'self'; style-src 'self'; connect-src 'self'; img-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'.X-Frame-Options: DENY, COOP.Sec-Fetch-Site: same-originare required on its JSON.Security review fixes (C1, H1, M1, L1, L2)
127.0.0.1:0at a random 256-bit path (cmd/codeaf/appfactory_loopback.go) and sendsreturn_port/return_path.http://127.0.0.1:<port>/<path>?code=<one-time>; only that exact shape is followed.elsewhere, never a session.form-actiondoes not govern and which Chrome Local Network Access does not prompt for.confirm, orPOST /v1/me/password/confirm(factory.password_confirm, which pays the per-session F1 bucket).step_up_requiredand appwire answersstep_up.get()) beforecreate()on the same page.https://host:443works.Residual risk:
Proof
Go:
internal/factory/serve/passkey_test.gouses a software ES256 authenticator (serve/passkeytest). It covers:/v1/me, including after a restart;The engine tests in
cmd/codeaf/appfactory_passkey_test.gouse a real TLS org.End to end:
scripts/passkey-e2e.shruns a realcodeaf factory serveover TLS on https://localhost and twocodeaf appengines. It covers:It also checks that
factory.mesayssign_in_kind: "passkey".elsewherewith no connection, and the starter stayssigned_out.password_confirmreturnsnot_found.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-readyat 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/configTestRegistryCoversEveryUserFacingEnvironmentPinalso 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 insidetouched-packages_test.sh. That bug was already there before this change. Result:test-quick(build, vet, fmt, manual gates, laws, changelog) passes.one-suite_test.sh, which hangs on this box. AppArmor blocksbwrap(kernel.apparmor_restrict_unprivileged_userns = 1), whatever the branch.test-touchedpasses exceptinternal/sessionTestTheFixedPrefixStaysUnderItsBudget. The gate marks it "already failing on the base", the same failure E9 saw one884b0545.Re-review 2 fixes (N1–N4, wrong-device page) — af1d050..26eeb8e
confirmorpassword_confirmbeforehand.optionsbinds the flow to its browser (anHttpOnly; Secure; SameSite=Strictcookie on/passkey/<flow>).options,finishand the hand-over refuse any other browser withother_browser.finishreturns no code, onlynext:/passkey/<flow>/go. The bound browser follows it once to a 303 onto the loopback.return_key, …)[:16], wherereturn_keycomes from the engine at start.optionsopens a flow. Opened sign-ins are capped at 16 per /24 or /48, and the oldest is dropped.TestASplitStepUpCannotBeFinishedByTheAttackerreplays the chain, and it is refused at every step.TestAFlowIsBoundToOneBrowser.TestThePasskeyLoopbackTakesOnlyItsOwnFlowsCode.TestAFloodThatOpensItsPagesIsHeldPerNetworkfloods 48 addresses in one /24; exactly 16 stay opened, and a person on another network signs in.elsewhereand stayssigned_out.BASE=bc25bbb61 make pr-readyis green, apart from 2 failures marked "already failing on the base" (TestTheFixedPrefixStaysUnderItsBudget,TestRegistryCoversEveryUserFacingEnvironmentPin).Re-review 3 fixes (F1–F3), head
85c0ae335__Host-codeaf_pkbcookie (Secure, Path=/, no Domain, HttpOnly, SameSite=Strict, 24 h). The flow keeps sha256 of the id, and a valid existing id is reused.browsehelper, which asserts the__Host-prefix, Path=/ and an empty Domain.includeSubDomainsfor 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.TestAPlantedCookieDoesNotBindThePersonsBrowserreplays the attack (an id planted on the victim's browser) and shows it is refused.TestHSTSCoversSubdomainsOnlyOfANameTheOperatorOwnscovers HSTS. The e2e row asserts the cookie's name and attributes.TestAFloodFromManyNetworksStillLetsAPersonStartfills all 384 slots from 24 networks (2 addresses × 8 flows each). A start from a fresh network still succeeds and signs in.confirmwithaction, orpassword_confirmwithaction) is foradd_passkey,remove_passkey+ id, orset_password.step_uprefusal carriesaction, and appwiredetail {action, passkey?}.TestAConfirmationIsForOneActionOncechecks 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 gettingstep_up, and the lede naming the removal.TestALoopbackCodeLivesOneMinute).http://127.0.0.1:<port>/done. This is covered by an engine loopback test and an e2e row.69721f5ed.BASE=bc25bbb61 make pr-ready: test-quick, tooling and test-touched pass. The tooling run excludesone-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":TestRegistryCoversEveryUserFacingEnvironmentPinandTestTheFixedPrefixStaysUnderItsBudget.Re-review 4 fixes (N1–N3) and the X1 browser leg, head
499de5552TestAFloodOneSignInPerNetworkKeepsAnOfficesFew. 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.password_confirmfor a passkey the person doesn't have gets 404.TestConfirmationsAreFewPerSessionAndOnlyForRealPasskeys.includeSubDomainsis opt-in throughhsts_include_subdomains: true, off by default. Shared wildcard names never get it.758122225).TestAConfirmationIsForOneActionOncewith an instruction-like name,TestHSTSCoversSubdomainsOnlyWhenTheOperatorOwnsTheNameAndAsks, and the e2e lede rows.link,usernameornamegets 422 instead of 404 (TestAnAddOrConfirmWithAStrayFieldIsABadRequest).localhostand*.localhostare documented as one-machine trial addresses. They stay accepted becausedomain: localhostwithtls: filesis how passkeys are tried locally, and the e2e runs on it.3f9a8a370: 46 passed, 1 skipped (the headless Firefox ceremony). It was not rerun after the X1 fix.BASE=bc25bbb61 make pr-readyat499de5552: test-quick, tooling and test-touched pass. Tooling excludesone-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
f005dd3dccleanDisplayNamedrops every format character (Cf) and refuses any control character, C1 included.plainTextcleans the raw device-label fallback the same way.<bdi>.TestANameCannotReorderOrHideTheServersWordscovers 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>.TestConfirmationsAreFewPerAccount.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.make test-focuspasses for the serve passkey/password/confirm/flood/name tests and the engine passkey/loopback tests. The full serve suite passes.make test-quickand the manual gates pass.Assisted-by: CodeAF
Co-Authored-By: CodeAF [email protected]