Repository navigation
factory: an organization's people sign in with a username and password (E9) - #2646
Merged
Merged
Conversation
…d (E9) A team server takes a username and password by default, with GitHub as the second way in. An account is made through the operator link or an invitation, consuming the link in the same locked write that makes the account. Passwords are argon2id (OWASP 46 MiB, t=1, p=1) in PHC strings, NFKC-normalized, 12 characters to 256 bytes, checked against an embedded common-password list and the username. Sign-in is throttled per username and per resolved client address with decaying backoff; unknown, wrong and removed accounts get one sentence and the same hashing cost. Sessions reuse the server's access sessions: 30 days idle, 90 days absolute, ended by a password change, a reset or a sign-out. The operator can make a one-hour, single-use reset link for a password person. Password routes are JSON only, strictly decoded, 8 KiB, no-store, and refused over plain HTTP except on loopback or behind a trusted HTTPS proxy. Every account change is audited and no password reaches a log, record, file or answer. The engine serves factory.access_sign_up, access_reset, password_sign_in and password_change behind the hello word factory_password, holding every session the way access sign-in does. Assisted-by: CodeAF Co-Authored-By: CodeAF <[email protected]>
Assisted-by: CodeAF Co-Authored-By: CodeAF <[email protected]>
Assisted-by: CodeAF Co-Authored-By: CodeAF <[email protected]>
Assisted-by: CodeAF Co-Authored-By: CodeAF <[email protected]>
H1 A session carries the password generation it was made under; a change or a reset moves the generation, and mintSession re-reads it under the session lock, so no session made with an old password outlives the change. H2 A link made for one GitHub login takes no password and offers none. H3 A try spends its throttle tokens on entry and gets them back only for a right password; one sign-in of a username is verified at a time. M1 Backoff is keyed by (username, address); a looser per-username ceiling skips addresses the person signed in from before, so a stranger cannot keep the owner out. M2 A username already named anywhere on the server (a GitHub login that ever signed in, a share, a team, an owner, a driver, a job, the record) is taken. L1 IPv6 counts by /64; a backing-off key is never evicted, a full set refuses. L2 A transparent rehash compares and swaps on the hash it verified; a change compares on the generation. L3 The common list is NCSC 100k plus xato-net's top million and famous passphrases, compared by letters and digits: about 486,000 entries. L4 A GitHub sign-in checks the name again under joinMu before its session is stored, and remembers the handle for good. L5 accounts.json is cached by mtime and size; a read error refuses the request and keeps the session. L6 Typed passwords are passing secrets: at least 8 bytes, the latest 64 kept. Assisted-by: CodeAF Co-Authored-By: CodeAF <[email protected]>
…second review)
M1: every sign-up, reset, change and sign-in without one hands the machine a
device token (256-bit, kept server-side as SHA-256 in accounts.json, bound to
the person and the password generation, 180 days, 16 per person, revoked by a
change, reset or removal, surviving a restart). A try with a valid token
skips the username's ceiling and counts by the device and its address. The
engine keeps the token beside the session through factory.sessions_take and
factory.session_restore and presents it on later sign-ins. The in-memory
trusted addresses are gone. A new machine during an attack uses the
operator's reset link, which is never throttled.
M-new: the changing session is valid at gen+1 before the write, so concurrent
requests never sign it out. L-a: refunds are hand-counted credit. L-b: a full
set logs once a minute. L-c: punctuation, keyboard runs and few-character
passwords are common. L-d: a hash waits up to 500 ms for a slot.
POST /v1/me/password answers 200 {device_token}.
Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>
Assisted-by: CodeAF Co-Authored-By: CodeAF <[email protected]>
/v1/me and the password sign-in answer said github_signed_in true for a password person. It is now true only for a GitHub sign-in; sign_in_kind "password" says a password person signed in, and the engine's can_sign_out reads either. Assisted-by: CodeAF Co-Authored-By: CodeAF <[email protected]>
… use is pushed out (re-review #2) N1: a device token is made only on want_device; the engine asks only while the app's core says factory.sessions_store {can_keep: true} (unsaid is false). A device is marked used at every sign-in with it, and a person's sixteen live devices are never evicted: past that a sign-in succeeds with no new token, said once in the log. N2: a signed-in password change counts per session, not against the username's ceiling. N3: a trusted pair is keyed by device and address, so a stolen token used elsewhere backs off only itself. Assisted-by: CodeAF Co-Authored-By: CodeAF <[email protected]>
…y address (re-check 3) F1: a password change counts in one bucket per session with no address in the key, so a stolen session spread over 30 addresses gets 10 current passwords checked, not 300. F2: a device token keeps its (device, address) pair bucket and also has a ceiling of 100 across every address; past it the try counts as untrusted, so a stolen token from 30 addresses gets 100 trusted checks plus the username's ceiling, not 300. F3: the concurrent-guess test asserts the real bound, the username's ceiling. Assisted-by: CodeAF Co-Authored-By: CodeAF <[email protected]>
ZeroPoint95
pushed a commit
that referenced
this pull request
Nov 24, 2026
…d (E9) (#2646) * factory: an organization's people sign in with a username and password (E9) A team server takes a username and password by default, with GitHub as the second way in. An account is made through the operator link or an invitation, consuming the link in the same locked write that makes the account. Passwords are argon2id (OWASP 46 MiB, t=1, p=1) in PHC strings, NFKC-normalized, 12 characters to 256 bytes, checked against an embedded common-password list and the username. Sign-in is throttled per username and per resolved client address with decaying backoff; unknown, wrong and removed accounts get one sentence and the same hashing cost. Sessions reuse the server's access sessions: 30 days idle, 90 days absolute, ended by a password change, a reset or a sign-out. The operator can make a one-hour, single-use reset link for a password person. Password routes are JSON only, strictly decoded, 8 KiB, no-store, and refused over plain HTTP except on loopback or behind a trusted HTTPS proxy. Every account change is audited and no password reaches a log, record, file or answer. The engine serves factory.access_sign_up, access_reset, password_sign_in and password_change behind the hello word factory_password, holding every session the way access sign-in does. Assisted-by: CodeAF Co-Authored-By: CodeAF <[email protected]> * changes: name #2646 in its entry Assisted-by: CodeAF Co-Authored-By: CodeAF <[email protected]> * changes: end each claim of #2646's entry in a full stop Assisted-by: CodeAF Co-Authored-By: CodeAF <[email protected]> * engine: read the sign-in cache under a deferred unlock Assisted-by: CodeAF Co-Authored-By: CodeAF <[email protected]> * factory: close the security review's findings on password sign-in H1 A session carries the password generation it was made under; a change or a reset moves the generation, and mintSession re-reads it under the session lock, so no session made with an old password outlives the change. H2 A link made for one GitHub login takes no password and offers none. H3 A try spends its throttle tokens on entry and gets them back only for a right password; one sign-in of a username is verified at a time. M1 Backoff is keyed by (username, address); a looser per-username ceiling skips addresses the person signed in from before, so a stranger cannot keep the owner out. M2 A username already named anywhere on the server (a GitHub login that ever signed in, a share, a team, an owner, a driver, a job, the record) is taken. L1 IPv6 counts by /64; a backing-off key is never evicted, a full set refuses. L2 A transparent rehash compares and swaps on the hash it verified; a change compares on the generation. L3 The common list is NCSC 100k plus xato-net's top million and famous passphrases, compared by letters and digits: about 486,000 entries. L4 A GitHub sign-in checks the name again under joinMu before its session is stored, and remembers the handle for good. L5 accounts.json is cached by mtime and size; a read error refuses the request and keeps the session. L6 Typed passwords are passing secrets: at least 8 bytes, the latest 64 kept. Assisted-by: CodeAF Co-Authored-By: CodeAF <[email protected]> * factory: trust a person's own machines against a stranger's guesses (second review) M1: every sign-up, reset, change and sign-in without one hands the machine a device token (256-bit, kept server-side as SHA-256 in accounts.json, bound to the person and the password generation, 180 days, 16 per person, revoked by a change, reset or removal, surviving a restart). A try with a valid token skips the username's ceiling and counts by the device and its address. The engine keeps the token beside the session through factory.sessions_take and factory.session_restore and presents it on later sign-ins. The in-memory trusted addresses are gone. A new machine during an attack uses the operator's reset link, which is never throttled. M-new: the changing session is valid at gen+1 before the write, so concurrent requests never sign it out. L-a: refunds are hand-counted credit. L-b: a full set logs once a minute. L-c: punctuation, keyboard runs and few-character passwords are common. L-d: a hash waits up to 500 ms for a slot. POST /v1/me/password answers 200 {device_token}. Assisted-by: CodeAF Co-Authored-By: CodeAF <[email protected]> * factory: a password person is not said to have signed in with GitHub /v1/me and the password sign-in answer said github_signed_in true for a password person. It is now true only for a GitHub sign-in; sign_in_kind "password" says a password person signed in, and the engine's can_sign_out reads either. Assisted-by: CodeAF Co-Authored-By: CodeAF <[email protected]> * factory: a device token only when the client can keep it, and none in use is pushed out (re-review #2) N1: a device token is made only on want_device; the engine asks only while the app's core says factory.sessions_store {can_keep: true} (unsaid is false). A device is marked used at every sign-in with it, and a person's sixteen live devices are never evicted: past that a sign-in succeeds with no new token, said once in the log. N2: a signed-in password change counts per session, not against the username's ceiling. N3: a trusted pair is keyed by device and address, so a stolen token used elsewhere backs off only itself. Assisted-by: CodeAF Co-Authored-By: CodeAF <[email protected]> * factory: one session's or one device's guesses are capped across every address (re-check 3) F1: a password change counts in one bucket per session with no address in the key, so a stolen session spread over 30 addresses gets 10 current passwords checked, not 300. F2: a device token keeps its (device, address) pair bucket and also has a ceiling of 100 across every address; past it the try counts as untrusted, so a stolen token from 30 addresses gets 100 trusted checks plus the username's ceiling, not 300. F3: the concurrent-guess test asserts the real bound, the username's ceiling. 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.
Do not merge before the independent security review. The binding contract in
~/work/teams-wave/PASSWORD.md("SECURITY ARCHITECTURE — BINDING") requires that review.An organization server now takes a username and password by default, with GitHub as the second way in. Two password people can claim, invite, join, share a workstream, read it, sign out, and sign back in, with no GitHub anywhere.
How it meets the binding section
golang.org/x/crypto/argon2) with OWASP paramsm=47104,t=1,p=1, a 16-byte salt and a 32-byte key, stored as a PHC string.golang.org/x/time/ratekeyed by username and by the IP from the existingresolveClienttrusted-proxy resolver.lockRowscritical section that creates the account, with a compensating rollback if the second write fails. A race test sends 8 goroutines at one link and exactly 1 joins.accounts.json, so a reset secret can never be a bearer token.crypto/rand, stored only as SHA-256, compared in constant time). Idle life is 30 days and absolute life is 90.DisallowUnknownFields, an 8 KiB cap andCache-Control: no-store. They are refused over plain HTTP unless the request is on loopback or behind a trusted proxy that reports HTTPS. Password routes are kept out of the idempotency replay cache.account_changedwith verbs: signed up, signed in, refused sign-ins, changed password, made password reset link, reset password.redactandtraceon arrival. Leak tests push a known password through every path, then grep answers, log, record rows and every file under the store (server), plus every wire line and redact (engine).golang.org/x/*: crypto and text were already direct;x/timemoves from indirect to direct.Wire
Documented in
docs/design/app-v3/PROTOCOL.mdand in PASSWORD.md's new "As built" section.factory.access_sign_up,access_reset,password_sign_inandpassword_change, behind the hello wordfactory_password.sign_in,sign_in_kind, people/memberkind, accesskind/reason.link_createtakeskind:"reset".Behavior changes and open points
invite_availableis no longer gated on GitHub.config.Team, the GitHub allowlist. The link is the gate.codeaf runner joinstill signs in with GitHub only, and there is no TOTP, WebAuthn, email recovery or SSO.Evidence
bin/codeaf factory serveon a temporary home: operator claim, a short password refused withpassword_short, invite, second sign-up, the reused invite answeringused_up, workstream returning 404 before the share and readable by both after, both signed out (401), the same sentence for a wrong and an unknown user, a form body answered 415, both signed back in and reading, peoplekind= password. No password appeared in the server log or any file under the home.--new-operator-linkstill prints a fresh link.