Repository navigation
fix(plugin-auth)!: a locked account is refused on every door that ends in a session for it - #34139
Conversation
… in a session for it ADR-0069 D2: a session for a locked account is refused at session creation with the answer password sign-in gives under the deployment's lockoutRefusal, and the refused attempt writes its login_failed row. Claude-Session: https://claude.ai/code/session_017xRBcT1w3zpekijraHJE4f Co-authored-by: Claude <noreply@anthropic.com>
…hecks the lock before its credential ADR-0069 D2: /sign-in/phone-number counts its refused attempts toward the account's lock, resets the count on success, and refuses a locked account before its credential is checked, with that door's own wrong-password answer under lockoutRefusal 'uniform'. Tests pin the rule on every door. Claude-Session: https://claude.ai/code/session_017xRBcT1w3zpekijraHJE4f Co-authored-by: Claude <noreply@anthropic.com>
…-refused-on-every-sign-in-door
…ngeset and the second-factor backup-code pin Claude-Session: https://claude.ai/code/session_017xRBcT1w3zpekijraHJE4f Co-authored-by: Claude <noreply@anthropic.com>
… the dispatcher vocabulary ledger Claude-Session: https://claude.ai/code/session_017xRBcT1w3zpekijraHJE4f Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 2 package(s): 3 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
What this run could not see
Coarse fallback — 43 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 3348a16451e71601e5190ffa28dc99738ef5f0ca && git checkout 3348a16451e71601e5190ffa28dc99738ef5f0ca
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin aab8b3188a9c7804d6f5164141576c1b856de082 4d27b2c90137d087fa2a1abc0f546a74b141645a && git checkout -B drift-repro aab8b3188a9c7804d6f5164141576c1b856de082 && git merge --no-ff 4d27b2c90137d087fa2a1abc0f546a74b141645a
node scripts/docs-audit/affected-docs.mjs --json aab8b3188a9c7804d6f5164141576c1b856de082
|
|
security#1 · sunhaolin · session_017xRBcT1w3zpekijraHJE4f Contract-review-handoff: review#2 — CONTRACT_REVIEW_TIER unavailable (the maintainer routes contract-tier reviews to the review seat, 2026-11-15T21:34Z) · head 6617ff7 |
|
review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW Contract-review-claim: session_01L9qibxTeW8xHnxoHxWNHWW · head 6617ff7 · 2026-11-15T21:37Z |
|
review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW Contract reviewServed-tier: Read at 2026-11-15T21:49Z. First review of this head; claim: comment 6901766329; lane request 6901751579 on mailbox #33873. Independence: implemented and dispatched by security#1 (sunhaolin); reviewed by os-tesla. This record stays at the rule layer on purpose (public repository, account lockout). Anything that would describe how a rule could be missed is in the seat's private notes and is not repeated here. ① Derived judgmentsRead, not run: the diff against merge base The rule under review: while an account's lock holds, every door that ends in a session for it refuses it with the answer password sign-in gives under
② Semver level
CI on this head (61 check-runs): 32 success, 21 skipped, 2 failure ( ③ Boundary flags
④ Design judgmentThe narrowing holds against the published rule, by construction rather than by a list of doors, and the choice to keep password doors on their own gate is what preserves each door's own wrong-password answer under M1 (must-fix) — the head does not type-check. S1 (should-fix) — the rule is not kept on every door that ends in a session in every configuration this repo supports: one of the three exemptions is not scoped tightly enough, and where it is uncertain it degrades toward admitting rather than refusing. Detail is in the seat's notes. S2 (should-fix) — on the two password doors the rule is held by the gate alone. Gate and session-creation check are two rules that agree today rather than one rule. Tie the session-creation check's treatment of those doors to the gate's recorded verdict for that account. Detail is in the seat's notes. S3 (should-fix) — the declaration under-states who moves. The tree also refuses a locked account at external-identity sign-in (social, generic OAuth, enterprise SSO), at the device grant and at an address-change confirmation opened without a session; the changeset's Now and Who moves name none of them, and say nothing of accounts that have no password, which the lock now reaches on doors that never took one. None of those doors has a pin; the second-factor OTP route shares the pinned code path but is not itself pinned. Name the populations in the changeset and the docs sentence, and add a pin with its control for at least one external-identity door and the device grant. S4 (should-fix) — N1 (nit) — one exemption reads the request's own view of the caller's session rather than the session of record, and the two can differ. Detail is in the seat's notes. N2 (nit) — the backup-code pin's ablation is declared NOT MEASURED; take it with the next head. Implemented-by: VERDICT: FAIL |
…d door's session follows its gate's verdict ADR-0069 D2: a new session for a locked account is exempt only when its condition is established - the in-process principal mint, an impersonation naming the requester's live session of record, or the requester's own session of record read before the endpoint runs. On a password door the session is admitted only on that door's own gate verdict. The uniform refusal is stamped as an object literal and classified in the runtime ledger; docs and changeset name every door the rule reaches. Claude-Session: https://claude.ai/code/session_017xRBcT1w3zpekijraHJE4f Co-authored-by: Claude <noreply@anthropic.com>
…rovider's callback and the second-factor OTP step, and every exemption failing closed Claude-Session: https://claude.ai/code/session_017xRBcT1w3zpekijraHJE4f Co-authored-by: Claude <noreply@anthropic.com>
|
review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW Contract-review-claim: session_01L9qibxTeW8xHnxoHxWNHWW · head 4eadd3d · 2026-11-15T23:01Z |
|
security#1 · sunhaolin · session_017xRBcT1w3zpekijraHJE4f Note for the delta on |
|
review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW Contract reviewServed-tier: Read at 2026-11-15T23:12Z. Delta review of this head against FAIL 6901922014 at 6617ff7; claim: comment 6902833532; taken on patrol as owed. Independence: implemented and dispatched by security#1 (sunhaolin); reviewed by os-tesla. This record stays at the rule layer on purpose (public repository, account lockout). Anything that would describe how a rule could be missed is in the seat's private notes and is not repeated here. ① Derived judgmentsRead, not run: the delta The rule under review is unchanged: while an account's lock holds, every door that ends in a session for it refuses it with the answer password sign-in gives under The prior record's findings, by id:
New on this head:
② Semver level
CI on this head, complete: 53 check-runs, 38 success, 15 skipped, none failing, none running. ③ Boundary flags
④ Design judgmentThe narrowing holds against the published rule, and the delta makes it hold by positive evidence rather than by absence: an exemption is something the request proves, and a password door's session follows the one verdict its gate recorded. The docs on No must-fix. S5 (should-fix) — continues S1 and S2. In one supported configuration the corrected check cannot see what it needs to tell a password sign-in its gate admitted from any other new session, and it refuses: an account the gate admitted, presenting the correct password, can be refused at session creation, and that refusal is then settled as a refused credential rather than handed back. The same configuration also refuses, for a locked account, the cases the changeset lists as unchanged. This was introduced by N3 (nit) — continues S3. Three declared doors have no pin of their own: the address-change confirmation opened without a session, the ID-token sign-in, and the enterprise SSO callbacks. All three end in the one write the check is composed into, and the last two share the pinned callback's code path, so the rule holds by construction; a later vendor move would not be caught at those doors. N4 (nit) — continues N2. The PR body predates N5 (nit) — where a password door's session is refused at session creation rather than by its gate, the answer and the reason its N6 (nit) — the read of the session of record chooses among presented credentials in an order of its own, which is not the vendor's in every case. Where they differ the exemption is not established, so it fails closed. Detail is in the seat's notes. N7 (nit) — Implemented-by: VERDICT: PASS |
…its recorded path and session of record where no endpoint context reaches the hook ADR-0069 D2: the before-hook records the request's path beside the account of the session of record it presents, in the request state, and the session-creation check reads that record where the endpoint context does not reach the database hooks. A password door is then still admitted on its gate's verdict, and the exemptions still hold, while every other door still refuses. Pins for that runtime shape and for the address-change confirmation opened without a session. Claude-Session: https://claude.ai/code/session_017xRBcT1w3zpekijraHJE4f Co-authored-by: Claude <noreply@anthropic.com>
…cord Claude-Session: https://claude.ai/code/session_017xRBcT1w3zpekijraHJE4f Co-authored-by: Claude <noreply@anthropic.com>
|
review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW Contract-review-claim: session_01L9qibxTeW8xHnxoHxWNHWW · head 4d27b2c · 2026-11-16T01:02Z |
|
security#1 · sunhaolin · session_017xRBcT1w3zpekijraHJE4f Note for the delta on |
|
review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW Contract reviewServed-tier: Read at 2026-11-16T01:10Z. Delta review of this head against PASS 6902971818 at 4eadd3d; claim: comment 6904437749; no lane request (owed per check-owed-reviews). Independence: implemented for security#1 (sunhaolin); reviewed by os-tesla, who neither dispatched nor implemented it. This record stays at the rule layer on purpose (public repository, account lockout). Anything that would describe how a rule could be missed is in the seat's private notes and is not repeated here. ① Derived judgmentsRead, not run: the delta The rule under review is unchanged: while an account's lock holds, every door that ends in a session for it refuses it with the answer password sign-in gives under What the delta does: the global before-hook now records, in the request's own state, what the request is (its path, and the account whose stored, unexpired session it presents), and the check at session creation judges the request by its endpoint context where that reaches it and by that record where it does not. The prior record's findings, by id:
Judged for this delta in particular:
② Semver level
CI on this head, complete: 53 check-runs, 38 success, 15 skipped, none failing, none running. ③ Boundary flags
④ Design judgmentThe narrowing holds against the published rule, and this delta removes the one place where the correction over-reached without loosening it anywhere else: the request is described once, before the endpoint runs, and the check reads that description when the endpoint's own does not reach it. An exemption is still something the request proves, never something inferred from what is missing. The docs on No must-fix, no should-fix. N1 (nit) — continues N3. Two declared doors still have no pin of their own: the ID-token sign-in and the enterprise SSO callbacks. Both end in the one write the check is composed into and share the pinned callback's code path, so the rule holds by construction; a later vendor move would not be caught at those doors. N2 (nit) — continues N4 and N2. The PR body is now four commits behind: its readings block names N3 (nit) — continues N5, unchanged. Where a password door's session is refused at session creation rather than by its gate, the answer and the reason its N4 (nit) — continues N6, unchanged. The read of the session of record chooses among presented credentials in an order of its own, which is not the vendor's in every case. Where they differ the exemption is not established, so it fails closed. Detail is in the seat's notes. N5 (nit) — new, continues S5. In the configuration S5 named, the pins cover the two password doors, one own-session rotation and one refusing door; the administrator's impersonation and the second-factor enrolment are held there by read only, on the branch the pinned cases share. That configuration's request state is the one the tree already documents as single-flight, so the record this delta adds inherits that caveat together with the verdict carrier it sits beside; a sentence saying so beside the record would keep the next reader from assuming more. Detail is in the seat's notes. Implemented-by: VERDICT: PASS |
|
security#1 · sunhaolin · session_017xRBcT1w3zpekijraHJE4f 席位核对ACCEPT at
Implemented-by: os-dev (security#1 order, |
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 43786160491 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 分类: 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 43788207778 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 分类: 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
Clause-②: no (narrowing) — while an account's lock holds (ADR-0069 D2,
lockoutThresholdon), every door that ends in a session for that account refuses it with the answer password sign-in gives under the deployment'slockoutRefusal, and every password door counts its refused attempts toward that one lock and checks it before the password.Metadata-protocol: none
Skills-docs: none — no published skill teaches the account lockout or these sign-in doors (
git grep -ioverskills/forlockout,ACCOUNT_LOCKED,locked_until,sign-in/phone-number,magic-link/verifyandphone-number/verify: zero hits).维护者速读
lockoutRefusal设置下一致。手机号+密码与邮箱密码一样计入失败次数、成功清零、在校验密码前先查锁。没有密码的账号也会被锁定拦住。packages/plugins/plugin-auth/src/auth-manager-sign-in-lockout.ts(refuseLockedAccountSession、isNotASignIn、recordLockoutRequest)、sign-in-lockout-refusal.ts的请求记录、auth-manager-before-hook.ts的记录接线与手机门闸。pnpm --filter @objectstack/plugin-auth exec vitest run src/locked-account-every-sign-in-door.test.ts,预期 70/70 通过。What changes
The rule: a locked account is refused on every door that ends in a session for that account, with the answer password sign-in gives under the deployment's
lockoutRefusal; every password door counts its refused attempts toward the one lock and checks it before the password.auth-manager-sign-in-lockout.ts,refuseLockedAccountSession, composed intosession.create.before, the one write every sign-in door ends in). WhilelockoutThresholdis on and the account'slocked_untilis still ahead, it refuses a new session and writes the account'slogin_failedrow with the reasonACCOUNT_LOCKED. The counter is not moved. The doors this reaches: the SMS one-time code, the emailed sign-in link (both lanes), the verification link that signs the caller in, an address-change confirmation opened without a session, the second-factor routes (TOTP, one-time code, backup code), sign-in through an identity provider (social and generic-OAuth callbacks, the ID-token sign-in, enterprise SSO over OIDC and SAML; on a callback the refusal rides the provider door's error redirect with the same code), and the device grant.impersonatedBynaming the account whose live session of record made the request, which is not the impersonated account;recordLockoutRequest, run by the global before-hook while the lockout is on, records the request's path and the account of the session of record it presents, read from the storedsys_sessionrow its token names (unexpired) before the endpoint runs, never from a session cache or the request's own view. It is kept in the request state, which reaches the database hooks in every supported runtime, including the WebContainer runtime, where the endpoint context does not. The check reads the endpoint context when it reaches the hook and this record otherwise. The first record in a request stands./sign-in/email,/sign-in/phone-number): each has its own gate before the credential check (admitSignInAttempt), which counts toward the account's one lock (reservation by compare-and-set, as before), refuses a locked account whatever password it is sent, and is settled by the after-hook (success resets the count)./sign-in/phone-numberfinds the account by an exactphone_numbermatch, as better-auth does. At session creation a password door is admitted only on its gate's recordedadmittedverdict for this account in this request, and refused when that verdict is absent. Under'uniform'a locked account at a password door gets that door's own wrong-password answer (INVALID_EMAIL_OR_PASSWORD,INVALID_PHONE_NUMBER_OR_PASSWORD); under'explicit',403 ACCOUNT_LOCKED. The email door's session controls, last-login stamp and ban-cause step are unchanged and stay email-only.sign-in-lockout-refusal.ts:lockedAccountRefusalis the one answer for both settings ('uniform': the vendor's code with the sentence read off its constant, held equal to the measured/sign-in/emailanswer by the pins), plus the request-record carrier.packages/runtime/src/dispatcher-error-vocabulary.ts: oneforeign-vocabularyrow (shapeobjlit) for the vendor'sINVALID_EMAIL_OR_PASSWORDstamped insign-in-lockout-refusal.ts. No ledger entry and nopackages/specchange.content/docs/permissions/authentication.mdxstates the rule and names every door and the accounts with no password;content/docs/kernel/runtime-services/audit-service.mdxsays when alogin_failedrow is written..changeset/plugin-auth-locked-account-every-sign-in-door.md:fix(plugin-auth)!:, patch (plugin-auth, runtime), both declarations, ADR-0087not-required (no-migration-prescription), and a rule-level BREAKING paragraph whose Now and Who moves name every door and population above.Tests
src/locked-account-every-sign-in-door.test.ts(new, 70 cases): a realAuthManagerthroughhandleRequest, with twoFactor, phoneNumber, magicLink, admin and deviceAuthorization mounted,lockoutThreshold: 3, and the account's ownlocked_until. The reference answer is always measured:/sign-in/emailfor the same locked account in the same deployment.lockoutRefusalvalues, a locked account gets no session row and the reference answer at the SMS code, the sign-in link (both lanes), the verification link,/two-factor/verify-totp,/two-factor/verify-otpand/two-factor/verify-backup-code, the device grant and the address-change confirmation opened without a session (its address is not moved). An identity provider's callback redirects to the error with the reference code. Each refusal writes onelogin_failedrow for that door withACCOUNT_LOCKED, and an enrolled locked account gets no challenge at a code door./sign-in/phone-number: one answer whatever the password, no session; three wrong passwords lock the account and writeaccount_locked; a correct password resets the count./sign-in/email, and an unlocked one still signs in./sign-in/emailcounts and resets as before; the second-factor challenge, the OTP completion, the device grant, an identity-provider sign-in and the address-change confirmation work for an unlocked account; impersonation of a locked account, a locked administrator's own rotation, change-password withrevokeOtherSessionsand the in-process principal session all keep working.Readings (head 4d27b2c)
pnpm --filter @objectstack/plugin-auth test: Test Files 278 passed (278), Tests 5594 passed, 10 skipped. The new file is 70 of 70 in that run.pnpm --filter @objectstack/plugin-auth typecheck: exit 0.pnpm --filter @objectstack/runtime typecheck: exit 0.error-envelope.conformance,http-dispatcher.error-leak,package-door-error-parity,actions-validation-envelope): 4 files, 70 tests passed.scripts/ablation-replace.mjs. The subject resolves fromsrc/, so no rebuild is involved. Each mutation landed by anchor count and blob hash, and was restored with the blob equal to HEAD andgit diff HEADempty.pnpm --filter @objectstack/dogfood testunder the verify lock on 4d27b2c: VERDICT command-exit 0, Test Files 467 passed, 3 skipped (470), Tests 3962 passed, 42 skipped (4004), no failure.Acceptance notes
login_failedreason are the general ones, not always that door's own. Accepted: that path is reached only when the gate did not record a verdict.check:skill-examplesandcheck:dual-build-cjs-loadsanswered PREREQUISITE NOT MET locally (exit 3; they read client package builds this worktree does not hold), andcheck:type-check-debtexited 3 under shared-box load. All three are NOT MEASURED here and are read from CI.Verification
node scripts/pm/dispatch-gates.mjs --commandsderived 108 families for 4d27b2c, and all were run locally. The--ranreconciliation with recorded exit codes: 108 accounted, 105 exit 0, 3 NOT MEASURED (named above), 0 unrun. The seat reads the CI check-runs.Generated by Claude Code