Skip to content

fix(auth)!: a cloud-managed environment sets no local password for anyone, a platform administrator included - #33268

Merged
os-zhuang merged 5 commits into
mainfrom
claude/project-thread-1trdp3
Nov 15, 2026
Merged

os-zhuang merged 5 commits into
mainfrom
claude/project-thread-1trdp3

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Elon · project thread

Fixes #33203

Clause-②: yes (narrowing) — narrowed: on a cloud-managed environment only (OS_CLOUD_MANAGED=1), POST /admin/set-user-password answers 409 RESOURCE_CONFLICT for an env_native target too, where it set the password, and POST /set-initial-password answers 409 RESOURCE_CONFLICT to a signed-in platform administrator too, where it set their first local password; POST /reset-password and POST /phone-number/reset-password answer 409 RESOURCE_CONFLICT to every request, where a valid token or code set (or created) the password, and POST /request-password-reset and POST /phone-number/request-password-reset answer 409 too, where they answered success and sent a link or code. Two refusal sentences are added (resetPassword, requestPasswordReset); the two existing ones no longer promise a local or break-glass password. The managed set-user-password arm no longer reads the target's identity source, so its 503 for an unreadable source is gone there.
Metadata-protocol: none
Skills-docs: none — no skill under skills/** teaches the cloud-managed password doors; content/docs/permissions/authentication.mdx gains the rule in this change.

Lands with the ADR amendment #33248 (Tier H, ADR-0135 D5.2's break-glass clause), after the maintainer's word on both. Owes a review.

维护者速读

  • 改了什么:托管环境(OS_CLOUD_MANAGED=1)上,「管理员给用户设密码」对本地账号(env_native)也拒绝;「给自己设首个密码」对平台管理员也拒绝;邮件和短信「重置密码」(以及发送重置链接/验证码)对所有人拒绝。拒绝文案不再提「应急(break-glass)密码」。自托管不变。
  • 为什么改:cloud#4465 裁决 10:托管上任何人都没有本地密码,也没有本地应急管理员。云端已在 cloud#4477 拒绝了密码登录和它自己的同名入口,框架这边的入口和文案要对齐。
  • 风险与回滚:只影响托管环境;回滚即还原本 PR。托管上已有的本地密码不在这里作废(那是云端的工作)。
  • 先看:packages/plugins/plugin-auth/src/cloud-managed.ts(规则说明和文案),admin-user-endpoints.ts、auth-plugin.ts 和 auth-manager-before-hook.ts 里的 isCloudManaged() 分支。
  • 两分钟验证:pnpm --filter @objectstack/plugin-auth exec vitest run src/cloud-managed.test.ts src/password-reset-ends-sessions.test.ts,预期全部通过。
  • 需要你做的:和 ADR 修订 docs(adr): ADR-0135 D5.2 — a cloud-managed environment keeps no local break-glass password #33248 一起批准落地。

What changes

  • admin-user-endpoints.ts: on a cloud-managed environment admin/set-user-password refuses every target with the managed 409, before reading the target's identity source. Before, it refused only idp_provisioned targets and still set an env_native one (the break-glass administrator among them).
  • auth-plugin.ts: on a cloud-managed environment set-initial-password refuses every signed-in caller. Before, a caller with platform-admin standing was admitted to give themselves a local password. A caller with no session still falls through to the body and is answered 401 as before.
  • auth-manager-before-hook.ts (review S1): on a cloud-managed environment the two self-service reset doors (/reset-password, /phone-number/reset-password), each of which creates the credential account when the user holds none, refuse every request with the managed 409, ahead of the vendor's handler and before any record is read (so the answer says nothing about any account), and so do the two doors that send the link or code (/request-password-reset, /phone-number/request-password-reset), so nobody is sent a link the reset door would refuse. Asked ahead of the per-number send guard and of the SSO-only reset judge.
  • cloud-managed.ts: the module rule now states that every door that sets a local password is closed to everyone on a managed environment, and the sentences say no local password is set here for anyone, an administrator included (review S2: a password held before is kept, cloud#4471). Nothing in them promises break-glass or names env_native. auth-manager.ts: the signUpForcedOff jsdoc no longer says break-glass is untouched on a managed environment (review N1).
  • content/docs/permissions/authentication.mdx: one bullet stating the managed rule.
  • The card's third item, the environment home's "set a backup password" banner, is already hidden on a cloud-managed environment on main (RecoveryPasswordReminder.tsx, the cloudManaged arm, pinned by RecoveryPasswordReminder.cloudManaged-13330.test.tsx), so nothing changes there.

Unchanged: every self-hosted deployment, SSO-only mode's rules included; a local password a user already holds on a managed environment.

Why

Ruling 10 of objectstack-ai/cloud#4465 (hosted has no local break-glass administrator; no local password for anyone), the text relayed on #33181 and #33183. ADR-0135 D5.2 kept a local credential reachable by population; its amendment for managed environments is #33248.

Verification

At head 7e7c8042 (branch point origin/main e540baf8):

  • @objectstack/plugin-auth full suite: Test Files 269 passed (269), Tests 5118 passed | 10 skipped. typecheck (after building the package, which its examples program imports): exit 0, check:test-typecheck: OK.
  • cloud-managed.test.ts: the old "env_native still answers 200" and "platform admin still admitted" cases are now refusals (409, RESOURCE_CONFLICT, the door's sentence, no credential written or moved), plus a platform admin setting their own password through set-user-password, CONTROLs for both doors on an unmanaged deployment, and a pin that neither sentence mentions break-glass or env_native.
  • Ablations (each source file restored to origin/main with the tests at HEAD, then restored to HEAD; git diff HEAD empty after): admin-user-endpoints.ts → 2 failed (the env_native and the self-target refusals); auth-plugin.ts → 1 failed (the platform-admin refusal).
  • Derived gates (node scripts/pm/dispatch-gates.mjs --commands, 106 families, each run with </dev/null): read in the review request; CI runs the full set.

At head 1ae420f9 (review S1/S2/N1 fold):

  • @objectstack/plugin-auth full suite: Test Files 269 passed (269), Tests 5124 passed | 10 skipped; typecheck exit 0; eslint on the changed files exit 0. Derived gates 106: 105 exit 0, 1 NOT MEASURED locally (teardown-shape --self-test, needs an unshallow clone).
  • password-reset-ends-sessions.test.ts, new describe [#33203] a cloud-managed environment sets no local password at the reset doors: the emailed link refuses a user with no credential and creates none; refuses a platform administrator holding a password, whose password does not move and still signs in; a token that matches nothing gets the same 409 (nothing told); the link request sends no mail; the texted code is refused with the password unmoved and the code request sends no text; no reset sentence mentions break-glass. Unmanaged CONTROLs are the file's existing reset cases.
  • Ablation: the managed reset block disabled (if (false && …)), the 5 wire cases fail; restored, they pass.

Acceptance notes

  • On a managed environment, the Profile page's password card still offers "set password" to a user with no local credential (ui/apps/console/src/pages/system/ProfilePage.tsx); the server now refuses it for everyone there, as it already did for non-administrators. Hiding it is a domain:ui follow-up, not in this PR.
  • change-password for a credential a user already holds on a managed environment is untouched; invalidating hosted passwords is the cloud's (objectstack-ai/cloud#4471).

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic. (Not touched.)
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes (CI).
  • 4. One issue, one branch off an up-to-date main, one pull request (the ADR text is docs(adr): ADR-0135 D5.2 — a cloud-managed environment keeps no local break-glass password #33248, split so this does not wait on a Tier H approval it shares anyway).
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: its generated artifacts are regenerated and committed. (Not touched.)
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English. (The 维护者速读 section is the frame's Chinese summary.)
  • The Before Submitting list in CONTRIBUTING.md is done.

🤖 Generated with Claude Code

https://claude.ai/code/session_016WV4d1NJYFGVi2FRztyBNo

…yone (#33203)

On a cloud-managed environment, admin/set-user-password now refuses an
env_native target too, and set-initial-password refuses a platform
administrator too: a hosted environment keeps no local password and no
local break-glass administrator (ruling 10 of objectstack-ai/cloud#4465).
The two refusal sentences no longer promise one. Self-hosted is unchanged.

Claude-Session: https://claude.ai/code/session_016WV4d1NJYFGVi2FRztyBNo
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 14, 2026
@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/plugin-auth, touching 16 documentable anchor(s).

15 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/ai/connect-mcp.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in runAdminSetUserPassword))
  • content/docs/api/client-sdk.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in runAdminSetUserPassword))
  • content/docs/api/error-catalog.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in runAdminSetUserPassword))
  • content/docs/api/index.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in runAdminSetUserPassword))
  • content/docs/automation/approvals.mdx (via idp_provisioned (literal, a string literal in runAdminSetUserPassword))
  • content/docs/automation/webhooks.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in runAdminSetUserPassword))
  • content/docs/deployment/self-hosting.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in runAdminSetUserPassword))
  • content/docs/kernel/contracts/auth-service.mdx (via AuthManager (symbol, a top-level class))
  • content/docs/kernel/runtime-services/email-service.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in runAdminSetUserPassword))
  • content/docs/kernel/services-checklist.mdx (via AuthManager (symbol, a top-level class))
  • content/docs/permissions/authentication.mdx (via AuthManager (symbol, a top-level class), SERVICE_UNAVAILABLE (literal, a string literal in runAdminSetUserPassword), idp_provisioned (literal, a string literal in runAdminSetUserPassword), /api/v1/auth/set-initial-password (route, the route ledger binds it to client method auth.setInitialPassword))
  • content/docs/permissions/authorization.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in runAdminSetUserPassword))
  • content/docs/permissions/sharing-rules.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in runAdminSetUserPassword))
  • content/docs/protocol/kernel/error-handling.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in runAdminSetUserPassword))
  • content/docs/ui/print-pages.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in runAdminSetUserPassword))

⛔ 7 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v17/17-0.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in runAdminSetUserPassword))
  • content/docs/releases/v17/17-3.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in runAdminSetUserPassword))
  • content/docs/releases/v17/17-4.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in runAdminSetUserPassword))
  • content/docs/releases/v17/17-7.mdx (via SERVICE_UNAVAILABLE (literal, a string literal in runAdminSetUserPassword))
  • content/docs/releases/v18/18-2.mdx (via AuthManager (symbol, a top-level class), SERVICE_UNAVAILABLE (literal, a string literal in runAdminSetUserPassword))
  • content/docs/releases/v18/18-3.mdx (via AuthManager (symbol, a top-level class))
  • content/docs/releases/v18/18-4.mdx (via AuthManager (symbol, a top-level class), idp_provisioned (literal, a string literal in runAdminSetUserPassword))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • the SDK route bridge reached 65 of 247 client-bound route-ledger rows — the other 182 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 182: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 123 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 22 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 7844272c47fd4e83cae6f4770b878d70b5a37e13 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 1d8ebd74b77f92ef0115e0b8162eae7702f1f5e3 — the merge of head c976f8c26c58c9a466906456f0b209f7abad376c into base 7844272c47fd4e83cae6f4770b878d70b5a37e13, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 1d8ebd74b77f92ef0115e0b8162eae7702f1f5e3 && git checkout 1d8ebd74b77f92ef0115e0b8162eae7702f1f5e3
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 7844272c47fd4e83cae6f4770b878d70b5a37e13 c976f8c26c58c9a466906456f0b209f7abad376c && git checkout -B drift-repro 7844272c47fd4e83cae6f4770b878d70b5a37e13 && git merge --no-ff c976f8c26c58c9a466906456f0b209f7abad376c

node scripts/docs-audit/affected-docs.mjs --json 7844272c47fd4e83cae6f4770b878d70b5a37e13

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 7844272c47fd4e83cae6f4770b878d70b5a37e13 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Contract-review-claim: session_016WV4d1PGptBW3QRQNmy5e6 · head 7e7c804 · 2026-11-14T15:17:52Z

review#3 (area-lease pilot #33059, area A1); reviewed as a pair with #33248.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · os-elon-musk · session_016WV4d1NJYFGVi2FRztyBNo

Request: review · area A1 · Fixes #33203 · head 7e7c804 · pairs with #33248 (ADR-0135 D5.2) · requested at 2026-11-14T15:18Z

Local at this head: plugin-auth full suite 269 files / 5118 passed; typecheck exit 0; derived gates 106: 103 exit 0, 3 NOT MEASURED (exit 3: teardown-shape self-test needs an unshallow clone, skill-examples and dual-build-cjs-loads need a full build); CI running.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 7e7c804266c4d81c646a7286c0ad9506501e5849
Local-runs: none
Scope: packages/plugins/plugin-auth/src/admin-user-endpoints.ts, packages/plugins/plugin-auth/src/auth-plugin.ts, packages/plugins/plugin-auth/src/cloud-managed.ts, packages/plugins/plugin-auth/src/cloud-managed.test.ts + packages/plugins/plugin-auth/src/auth-manager-before-hook.ts, packages/plugins/plugin-auth/src/auth-manager.ts, packages/plugins/plugin-auth/src/sso-only-local-password.ts, packages/plugins/plugin-auth/src/admin-import-users.ts (read only)

① Derived judgments

  • The two door changes are exactly what the declaration says and nothing more: runAdminSetUserPassword returns cloudManagedRefusal('setUserPassword') before any source read when isCloudManaged() (after the 404 user check, so an unknown id still answers 404); set-initial-password refuses any caller with session.user.id under isCloudManaged(), anonymous falls through. Self-hosted paths are untouched (isCloudManaged() false ⇒ identical code), pinned by the two CONTROL cases. The removed 503 arm and the dropped readUserSource import are consistent.
  • Tests drive the real seam (real AuthManager, mounted routes) and assert no credential is written or moved; ablations in the body match the hunks.
  • should-fix S1 — a third local-password door stays open on a managed environment. POST /request-password-reset → POST /reset-password (and the phone twin) is not judged by isCloudManaged() anywhere: the before-hook only runs complexity/history there (auth-manager-before-hook.ts ~L244–280), the SSO-only judge in sso-only-local-password.ts applies only under SSO-only mode, and better-auth's reset mints the credential account on first set (admin-import-users.ts L35 relies on that). So on a hosted environment any user with a reachable email, an administrator included, can still be given a local password. Card Managed environments: the framework's remaining local-password doors and copy (set-user-password on env_native rows, the platform-admin break-glass wording, the 'set a backup password' banner) contradict hosted's no-local-password rule #33203's goal is "nothing promises a password that hosted refuses", and the changeset, docs bullet, both refusal sentences ("no one holds a local password here") and the ADR note in docs(adr): ADR-0135 D5.2 — a cloud-managed environment keeps no local break-glass password #33248 all state the stronger rule. Either fold the reset doors in here (refuse /reset-password and /phone-number/reset-password with the managed 409 on isCloudManaged(), plus pins), or narrow every one of those sentences to the two doors and file one loose-ends card (p1, lease:A1) for the reset doors. Folding is preferred: it is the same rule and small.
  • should-fix S2 — "keeps" vs "sets". The PR's own Unchanged list keeps a password a user already holds on a managed environment (cloud#4471 invalidates those). The refusal sentences say "no one holds a local password here", which is false for that user. Reword to what the code does: "no local password is set here for anyone, an administrator included". Same wording fix in docs(adr): ADR-0135 D5.2 — a cloud-managed environment keeps no local break-glass password #33248.
  • nit N1: auth-manager.ts signUpForcedOff jsdoc still reads "Break-glass is untouched: neither case disables emailAndPassword.enabled". On a managed environment there is no break-glass now; reword the managed half.

② Semver level

@objectstack/plugin-auth: patch with fix(auth)! and Clause-②: yes (narrowing) is consistent with how this repo marks a runtime refusal under a deployment switch (no schema, no export moves). The adr-0087: not-required (no-migration-prescription) marker is correct: nothing stored to rewrite. Metadata-protocol: none holds. Skills-docs: none — REASON is acceptable (no skill teaches these doors).

③ Boundary flags

  • Security boundary: authentication doors on hosted environments; fail-closed direction. Lands only with ADR amendment docs(adr): ADR-0135 D5.2 — a cloud-managed environment keeps no local break-glass password #33248 (Tier H docs/adr/**), maintainer's word on both.
  • Author login objectstack-fleet[bot] (relay); implemented by area A1 session_016WV4d1NJYFGVi2FRztyBNo.
  • CI at this head: Test Core / Build / Type Check / Lint still in progress when read (15:19Z), nothing red.
  • UI follow-up already named in the body (Profile page still offers "set password" on managed).

④ Design judgment

The direction is right and matches ruling 10 of cloud#4465 as quoted on the card: hosted recovery is the cloud's, so a local break-glass credential is a route around the hosting IdP. Closing both doors for everyone (not by population) is the correct reading; the self-hosted D5.2 split is preserved. The design is incomplete only in S1: a rule stated as "no local password for anyone" must close every framework door that mints one, or be stated as narrower. With S1 and S2 fixed this is PASS.

Implemented-by: claude/project-thread-1trdp3
Reviewed-by: session_016WV4d1PGptBW3QRQNmy5e6

VERDICT: FAIL

S1 (fold the reset doors, or narrow the claims + loose-ends card) and S2 (wording) → delta review by review#3. N1 optional.

…t doors too (#33203)

Review follow-up: both reset doors (/reset-password, /phone-number/reset-password)
created a local credential on a managed environment. They now refuse every
request with the managed 409, as do the two request doors that send the link
or code. Refusal sentences say "no local password is set here for anyone".

Claude-Session: https://claude.ai/code/session_016WV4d1NJYFGVi2FRztyBNo
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · os-elon-musk · session_016WV4d1NJYFGVi2FRztyBNo

Request: review · area A1 · Fixes #33203 · head 1ae420f · delta for S1/S2/N1 (records 6879603886, 6879604670) · pairs with #33248 @ b802251 · requested at 2026-11-14T16:14Z

Local at this head: plugin-auth full suite 269 files / 5124 passed; typecheck exit 0; eslint on changed files exit 0; derived gates 106: 105 exit 0, 1 NOT MEASURED (teardown-shape self-test, needs an unshallow clone); reset-door ablation in the body; CI running.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Contract-review-claim: session_016WV4d1PGptBW3QRQNmy5e6 · head 1ae420f · 2026-11-14T16:15:53Z

review#3 delta.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 1ae420f9a8e642da70d6fd043cc9bc92569dc7ae
Local-runs: none
Scope: packages/plugins/plugin-auth/src/admin-user-endpoints.ts, packages/plugins/plugin-auth/src/auth-plugin.ts, packages/plugins/plugin-auth/src/cloud-managed.ts, packages/plugins/plugin-auth/src/cloud-managed.test.ts, packages/plugins/plugin-auth/src/auth-manager-before-hook.ts, packages/plugins/plugin-auth/src/auth-manager.ts, packages/plugins/plugin-auth/src/password-reset-ends-sessions.test.ts + packages/plugins/plugin-auth/src/sso-only-local-password.ts (read only)

Delta review of 7e7c8042..1ae420f9 (one commit), by the reviewer of record 6879603886.

① Derived judgments

  • S1 fixed by folding. globalBeforeHook refuses /reset-password, /phone-number/reset-password, /request-password-reset and /phone-number/request-password-reset on isCloudManaged() with the managed 409 RESOURCE_CONFLICT. It runs ahead of the vendor handler, the per-number OTP send guard and the SSO-only reset judge, and before any record is read. So the answer is identical for every request and says nothing about any account (no enumeration signal, and nothing is spent). With the reset doors closed, no framework door mints a local credential on a managed environment. That makes the "sets no local password for anyone" rule true. Five wire pins; ablation reported all red.
  • Declared consequence: on a managed environment a user who already holds a password can no longer reset it through these doors. That follows from the rule (the cloud refuses password sign-in, cloud#4477) and is in the changeset and docs.
  • S2 fixed: every sentence now says "no local password is set (or reset) here for anyone". The docs say a password set before is not removed (cloud#4471).
  • N1 fixed: the signUpForcedOff jsdoc now separates SSO-only (break-glass kept) from cloud-managed (none).
  • The two door changes reviewed at 7e7c804 are unchanged.

② Semver level

Unchanged: @objectstack/plugin-auth patch with fix(auth)! and Clause-②: yes (narrowing), now naming six doors. The adr-0087: not-required marker is updated to six doors and still correct. Metadata-protocol: none holds.

③ Boundary flags

④ Design judgment

With the reset doors folded in, the rule is enforced at every framework door that can create a local credential, as ruling 10 requires and as ADR-0135's amended note states. Refusing uniformly before any read is the right shape for a public door. Holds.

Implemented-by: claude/project-thread-1trdp3
Reviewed-by: session_016WV4d1PGptBW3QRQNmy5e6

VERDICT: PASS

Conflicts:
- plugin-auth/src/admin-user-endpoints.ts: main's pending-SSO arm stays first
  (every mode, every caller); the PR's wholesale cloud-managed refusal follows
  it in place of main's source-reading managed arm. readUserSource import restored.
- plugin-auth/src/password-reset-ends-sessions.test.ts: both new describe
  blocks kept (the PR's cloud-managed reset doors, main's pending reset doors).

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cytdN5jRpgKX58AY4d
…al of every password door (#33203)

Two tests from main's pending-SSO work assumed the cloud-managed arm still
admitted a platform administrator and an env_native target. With #33203 it
refuses both, so the platform-admin case is judged managed (the cloud-managed
refusal answers first) and unmanaged (the pending refusal holds), and the
env_native CONTROL runs off a managed environment.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cytdN5jRpgKX58AY4d
Brings in #33248 (ADR-0135 D5.2 text) so the base carries the ruling this
PR implements. No conflicts.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cytdN5jRpgKX58AY4d
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#1 · os-elon-musk · session_016WV4cy7hQ5MvQ83ByNZ8ZH

Contract-review-claim: session_016WV4cy7hQ5MvQ83ByNZ8ZH · head c976f8c · 2026-11-15T12:56:25Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#1 · os-elon-musk · session_016WV4cy7hQ5MvQ83ByNZ8ZH

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: c976f8c26c58c9a466906456f0b209f7abad376c
Local-runs: none
Scope: packages/plugins/plugin-auth/src/admin-user-endpoints.ts, packages/plugins/plugin-auth/src/auth-manager-before-hook.ts, packages/plugins/plugin-auth/src/auth-manager.ts, packages/plugins/plugin-auth/src/auth-plugin.ts, packages/plugins/plugin-auth/src/cloud-managed.ts, packages/plugins/plugin-auth/src/cloud-managed.test.ts, packages/plugins/plugin-auth/src/password-reset-ends-sessions.test.ts, packages/plugins/plugin-auth/src/pending-sso-users.test.ts + packages/plugins/plugin-auth/src/sso-only-local-password.ts, packages/plugins/plugin-auth/src/pending-sso-users.ts, packages/plugins/plugin-auth/src/session-tombstone.ts, packages/plugins/plugin-auth/src/admin-import-users.ts, docs/adr/0135-identity-and-access-architecture.md (read only)

Full review at this head. The record of the earlier head 1ae420f9 (record ID: 6880477091) does not carry: 1ae420f9..c976f8c2 holds a main merge with two resolved conflicts (3815aa85), one test commit (974fe1f3) and a second, clean main merge.

Independence: exception — same account (os-elon-musk) implemented this PR; the maintainer ruled 2026-11-15T12:51Z (project thread) that review#1 reviews this account's own drain PRs.

Tier evidence: scripts/pm/verify-review-tier.mjs on this reviewing run's transcript answered PASS (every assistant turn at the tier).

① Derived judgments

  • The diff against main 12a0f09f (the merge base, and the second merge's parent) is the declared change and nothing else: ten files, the eight in Scope plus the changeset and one docs bullet.
  • runAdminSetUserPassword: on isCloudManaged() the door returns the managed 409 for every target, after the 404 for an unknown id and after main's pending-person arm. The identity-source read and its 503 are gone from the managed arm, as declared. readUserSource stays imported because the pending arm uses it.
  • Conflict resolution in admin-user-endpoints.ts (merge 3815aa85): main had placed the pending arm above the managed arm; the resolution keeps that arm whole and replaces only the managed arm. Correct: both sides' rules hold, and nothing of main's was dropped.
  • set-initial-password: every caller with a session is refused on a managed environment; isPlatformAdminUser is still used by the SSO-only arm and elsewhere. A caller with no session falls through and is answered as before.
  • globalBeforeHook: the four reset paths are refused on isCloudManaged() right after the one-account check and before the per-number send guard, the complexity and history checks, the SSO-only reset judge and the vendor handler. Nothing is read first, so the answer is the same for every request. The shape (APIError('CONFLICT', { message, code })) is the one the invite-member managed refusal already uses in this file.
  • Other doors that could mint a credential on a managed environment, read on this head: sign-up is forced off (signUpForcedOff), admin/create-user and admin/import-users already refuse, admin/add-sso-user creates no password, the vendor email-OTP reset door is not mounted (session-tombstone.ts says so), and the only in-process requestPasswordReset caller is the refused import. So the sentence "sets no local password for anyone" holds at every framework door. change-password on a held credential is declared unchanged.
  • Test commit 974fe1f3: the two pending-sso-users.test.ts cases from main assumed the old managed arm. The platform-admin case now runs managed (managed sentence, the arm that answers first) and unmanaged (pending sentence); the env_native CONTROL runs unmanaged. Both changes follow the rule and keep the pending pins.
  • S1: closed and S2: closed (record ID: 6879603886), still closed at this head.
  • No must-fix, no should-fix.
  • nit N1 — set-user-password judges the pending arm before the managed arm, set-initial-password the other way round. Both answer 409 RESOURCE_CONFLICT and write nothing; only the sentence differs. The docs bullet's "refuses every target" is true either way. Accepted as is.
  • nit N2 — the PR body's "Lands with the ADR amendment docs(adr): ADR-0135 D5.2 — a cloud-managed environment keeps no local break-glass password #33248" and its Verification heads (7e7c8042, 1ae420f9) are behind: docs(adr): ADR-0135 D5.2 — a cloud-managed environment keeps no local break-glass password #33248 is on main as 12a0f09f, and the head moved. Prose only.

② Semver level

Metadata-protocol: none holds: no schema key, accepted value or authorable metadata moves; the six refusals are runtime answers under a deployment switch. @objectstack/plugin-auth patch with fix(auth)!, Clause-②: yes (narrowing) naming all six doors and the removed 503, and a BREAKING paragraph in the changeset is consistent. adr-0087: not-required (no-migration-prescription) is right: nothing stored to rewrite. The PR body and the changeset carry the same declaration lines.

③ Boundary flags

  • Authentication doors on hosted environments, fail-closed. The governing text is on main: ADR-0135 D5.2's note (docs(adr): ADR-0135 D5.2 — a cloud-managed environment keeps no local break-glass password #33248, 12a0f09f) names the same six doors and the same kept-password clause as this diff.
  • The PR is a draft; it is not ready to merge until the lane marks it ready.
  • Author login objectstack-fleet[bot] (relay); implemented by area A1.
  • Check runs at this head: 38 success, 15 skipped, none red, none running.
  • No new id materialisation or in-application join: the managed arm removes a read.
  • Follow-up named in the body (domain:ui): the Profile page's "set password" card on a managed environment. The console's forgot-password entry was not read here; the same follow-up should cover it.

④ Design judgment

The narrowing makes the published rule real rather than taking a declared capability away: ruling 10 of objectstack-ai/cloud#4465 and the ADR note on main say a hosted environment sets no local password for anyone, and before this change three framework doors still did. Refusing by deployment, not by population, is the right reading on a managed environment, and the self-hosted D5.2 split is untouched (the isCloudManaged() false path is the old code, pinned by CONTROL cases). Refusing the reset doors uniformly before any read is the right shape for a public door: no enumeration signal, nothing spent, and no link sent that the reset door would refuse. The code agrees with the contract it implements at each of the six doors.

Implemented-by: claude/project-thread-1trdp3
Reviewed-by: session_016WV4cy7hQ5MvQ83ByNZ8ZH

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · os-elon-musk · session_016WV4cytdN5jRpgKX58AY4d

ACCEPT · area A1 · Fixes #33203 · head c976f8c · 2026-11-15T13:02Z · Tier H hand-off (approver lands)

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 15, 2026 13:03
@objectstack-fleet objectstack-fleet Bot added the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 15, 2026
@os-zhuang
os-zhuang added this pull request to the merge queue Nov 15, 2026
Merged via the queue into main with commit 99a6ec0 Nov 15, 2026
59 checks passed
@os-zhuang
os-zhuang deleted the claude/project-thread-1trdp3 branch November 15, 2026 15:16
scbdzhwl pushed a commit to scbdzhwl/objectstack-analysis that referenced this pull request Nov 16, 2026
…pgrading row (objectstack-ai#33823)

<!-- claude-projects-attribution: {"github_login":"os-project-manager"}
-->
_Requested by **Leehom** · [project
thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1XMKjdYGd1ASsfeFTXYf2bZ4)_

Fixes objectstack-ai#33798

Clause-②: no
Metadata-protocol: none

## 维护者速读

- **改了什么**:新增 18.5.0 发布说明页 `content/docs/releases/v18/18-5.mdx`(沿用 18-4
的骨架,五段按「读者要做什么」分组),在 `meta.json` 中排在 18-4 之前;按维护者追加的要求把 `v18/index.mdx`
重写为 v18 产品线总览(不再写成 18.0.0 GA 页,`next` 改述为 `0.0.0-next-时间戳` 快照,数据库仪式只留链接到
18-0),并加上 18.5.0 条目;升级页「Per-release specifics」表加 v18.5.0
行;`handwritten-docs.json` 由生成器补一行。
- **为什么改**:维护者要求在 18.5.0 发版前写好发布说明(「18.5的版本发布说明可以开始安排写了」),并指出 v18
总说明写得不对(「我记得v18总的版本说明写的也不对」)。
- **风险与回滚**:只改文档,不发布任何包;回滚即 revert 本 PR。页面全部数字取自 Version Packages PR
objectstack-ai#33097 头 `25559f43` 的 CHANGELOG 与 `npm view`,分类用发布脚本自己的
`classifyReleaseBullet`。页面是公开的,不写任何客户、下游项目或席位。
- **先看**:① `18-5.mdx` 的「需手动处理」节(45 条,每条写明变化和处理办法);② 同页「自动迁移」表(22 条全是
semantic 条目,`os migrate meta` 只列出、不改写,页面如实说明);③ 重写后的 `v18/index.mdx`。
- **两分钟验证**:`git fetch origin changeset-release/main && git show
25559f4 --diff-filter=D --name-only --format= | grep -c '^.changeset/'`
应输出 `283`;再加上 `main` 在 `b76df9a6` 之后新落地的 1 个
changeset(`1e65a389`,objectstack-ai#33725),共 `284`,与页面「Changesets consumed」一致。
- **需要你做的**:无,席位落地。版本 PR 合并前若再有 changeset 落地,由席位派发刷新。

## What changes

- **`content/docs/releases/v18/18-5.mdx`** (new): the 18.5.0 page in
18-4.mdx's skeleton. A compile callout; a release-status blockquote that
says 18.5.0 is not yet published; Highlights; Release facts, as measured
(before the cut); What's new by kind: 需手动处理 (45, each line saying what
now answers differently and what to do, with its commit and pull
request), 自动迁移 (21, a table with what to do and the ADR-0087 id), 新增能力
(70, by area), 语义变化 (1), 其他修复 (146, counted by area, with the fixes that
bear on an upgrade grouped by capability); Console (Studio); an Upgrade
checklist for an 18.4.0 app, compiled and not walked.
- **`content/docs/releases/v18/index.mdx`**: rewritten as the v18 line
overview, as the maintainer asked on the card (triage record
6893347748). The status blockquote now says 18.4.0 is the newest release
and 18.5.0 is next; a table lists every 18.x release with its npm date
and page; "Coming from 17.x" links the organization-ownership ceremony
down to the 18.0.0 page and the upgrading guide instead of repeating it;
"How a breaking stage lands on this line" (anchor kept: three pages link
it) describes the level rule, protocol 18 and the two npm channels as
they are now (`next` is a `0.0.0-next-YYYYMMDDHHMMSS` snapshot of
`main`, ADR-0125 amendments of 2026-11-05/06); the per-release list
gains the 18.5.0 entry.
- **`content/docs/releases/v18/meta.json`**: `18-5` ahead of `18-4`.
- **`content/docs/upgrading.mdx`**: the v18.5.0 row of "Per-release
specifics", and nothing else.
- **`scripts/docs-audit/handwritten-docs.json`**: +1 line, written by
`node scripts/docs-audit/check-audit-scope.mjs --write` (the generator
objectstack-ai#33137 used).

No CHANGELOG is edited, no other release page is touched, and no tag,
publish, `version` script or release-workflow act was taken.

## Why

The maintainer asked for the 18.5.0 notes ahead of the cut, and on the
card added that the v18 overview page was wrong: it still read as the
18.0.0 GA page and described pre mode and `18.0.0-next.N` as current.

## How the page was compiled

- Source: Version Packages PR objectstack-ai#33097 at head `25559f43` (one commit; its
parent `b76df9a6` is `main` at the start of this work, so the PR covers
every changeset on `main`). The 122 CHANGELOG sections it writes were
read with `getChangelogEntry` and split with `splitChangelogEntry`;
`Updated dependencies` bullets and two dependency-list fragments
dropped; deduplicated on full text: 283 entries, equal to the 283
changesets the commit deletes. Refreshed at head `1e5ae1d459` (addendum
6893969023): `main` at `1e65a389` carries one more changeset,
`.changeset/33689-ai-action-confirmation-elicited.md` (objectstack-ai#33725), read
from its file the same way, so the page holds 284.
- Each entry placed with `classifyReleaseBullet`: 45 / 22 / 70 / 1 /
146. Levels: 39 `minor`, 245 `patch`. Breaking: 67 (24 `minor`, 43
`patch`); 62 commits since 18.4.0 carry `!`.
- Every breaking line was written from its changeset's BREAKING / "What
to do" / "The fix" paragraph; the 22 registered entries (23 registry
ids) were checked to exist as
`packages/spec/src/migrations/entries/semantic/18.*.ts` files, all
semantic entries (no conversion).
- The new-capability lines are the changesets' summaries with the
conventional prefix removed; two are shortened or put in plain words
(`534e115`, `ba32e79`).
- Areas are placed mechanically from summary scope and packages, as the
callout says.

The breaking walk (all 61 `!` commits of
`@objectstack/cli@18.4.0..b76df9a`, each mapped to its changeset and
section, plus the five breaking changesets from commits without `!`, and
the card's candidate list kept/dropped with reasons) is in the project
file `pm-orders/devx/33798-breaking-ledger.md`. Summary: all 61 kept;
candidates dropped: objectstack-ai#33268 (only the ADR text landed, no implementation
on `main`), the hook refusal catalogue (objectstack-ai#33214 → `53f5a4c` is additive,
listed under 新增能力), dataset metrics for the ask agent and model-picker
multipliers (not landed), the SQL-first rule (an AGENTS.md rule, no
changeset).

## Verification

Local gates derived by `node scripts/pm/dispatch-gates.mjs --commands
--repo objectstack-ai/objectstack` against this diff at `a8ae5b50af`:
**61 derived, 61 run, 0 NOT-MEASURED, 0 UNRUN** (`--ran` reconciliation
exit 0). `--tier`: no path-derived mandate; 906 changed lines, under the
3,000 threshold.

<details><summary>Gate record</summary>

- Prerequisites: `pnpm --filter "@objectstack/lint..." build` and `pnpm
--filter "@objectstack/client-react..." build`, both under
`os-verify-lock.sh`, VERDICT exit 0.
- First pass: 60 of 61 exit 0; `check:skill-examples` exit 3
(PREREQUISITE NOT MET: `client-react` had no `.d.ts`). After the client
SDK closure build it exits 0 ("346 prose examples type-check across 3
surface(s)").
- The page-reading gates, all exit 0: `check:release-notes`,
`check:release-page-status`, `check-release-section-coverage.mjs` (and
`--strict`), `check:doc-anchors`, `check:doc-authoring`,
`check:doc-frontmatter`, `check:docs-audit-scope`,
`check-affected-docs.mjs`, `check:role-word`, `check:docs-single-h1`,
`check-section-landing-index.mjs`, `check:corpus-claim-drift`,
`check:closed-ceremony-text`, `check:nul-bytes`, `check-adr-links.mjs`,
`check-issue-citations.mjs` / `check:issue-citations`,
`check-docs-section-name.mjs`, `check-doc-route-spelling.mjs
--advisory`, and the seven `@objectstack/spec` readers.
- The full record is in the project file
`pm-orders/devx/33798-gates-ran.txt`.

</details>

<details><summary>Page render check</summary>

The three touched pages and 18-4.mdx (positive control) compile with
`@mdx-js/mdx` 3.1.1 + `remark-gfm` 4.0.1 (the docs site's MDX compiler):
`18-5.mdx` 129,315 bytes of JS, `v18/index.mdx` 20,189, `upgrading.mdx`
76,568, `18-4.mdx` 324,138. Negative control: a one-line file with an
unclosed brace fails the same script. The full `next build` of the docs
site was not run.

</details>

<details><summary>Facts measured, and where</summary>

- `git show 25559f4 --diff-filter=D --name-only` → 283 changesets
deleted; `ls .changeset` at `b76df9a6` → 283; at `1e65a389` → 284.
- Published set at `25559f43`: 110 non-private packages, all `18.5.0`
(75 `@objectstack/*`, `create-objectstack`, 34 `@object-ui/*`), the same
name set as at `@objectstack/cli@18.4.0`; `@object-ui/app-shell`
versions `18.4.1`, private.
- `npm view @objectstack/spec dist-tags` → `latest` `18.4.0`, `next`
`0.0.0-next-20261115100430`; npm `time` for 18.0.0–18.4.0 gives the
index table's dates; no `18.x.y-` prerelease after 18.0.0 on npm.
- `git ls-remote --tags origin 'refs/tags/@objectstack/spec@18.5*'` →
none.
- 334 first-parent commits `@objectstack/cli@18.4.0..b76df9a`; 61 with
a `!` subject; new CLI command file
`packages/cli/src/commands/migrate/audit-side-copies.ts`.
- `PROTOCOL_VERSION` = `'18.0.0'`
(`packages/spec/src/kernel/protocol-version.ts`).

</details>

## Acceptance notes

- **The 自动迁移 heading overstates this release.** `classifyReleaseBullet`
puts every breaking entry with a `registered` ADR-0087 marker under 自动迁移
("migrated for you"), but all 22 of 18.5.0's registered entries are
semantic entries, which `os migrate meta` lists under "manual change(s)
require your judgment" and does not convert. The page keeps the heading
so it agrees with the GitHub Release body, and says plainly that nothing
is rewritten. Noted, not filed: it is the release script's section name,
a reading the seat may want to raise with the maintainer.
- **Two widenings open with their declaration line**, so the classifier
reads no declaration and files them under 其他修复 (`3eac63a`, `5604aeb`);
the page names them. No narrowing opens that way in this release.
- **The page is written before the cut.** Its status blockquote, the
index blockquote and the index table say 18.5.0 is not yet published.
After the cut the seat's refresh owes: the two blockquotes, the index
table row's date, the release facts (version commit, tags, npm), any
changeset that landed after `b76df9a6`, and
`content/docs/releases/index.mdx`'s v18 entry status `(current series:
…)`, which `check-release-section-coverage --strict` will ask for once
`packages/spec/CHANGELOG.md` carries `## 18.5.0`. That root index entry
still describes v18 by its 18.0.0 prerelease story too; it is outside
this card's file surface.
- **The order's "Fixes customers waited on" section is replaced** by
notable fixes grouped by capability, per the maintainer's later word on
the card (triage record 6893327884): the page names no customer,
downstream project or seat.
- **Read heads.** `main` at `b76df9a6` and Version PR objectstack-ai#33097 at
`25559f43`. While this ran, `main` moved one commit: `1e65a389` (objectstack-ai#33725,
`feat(spec)!:`, a declared-gated action on an AI door confirmed by a
person through MCP elicitation, with a new protocol-18 semantic entry
`action-requires-confirmation-elicited`). It is not on this page; it
shares no file with this diff, and the refresh before the cut picks it
up with the Version PR's next head.
- No changeset: the diff publishes nothing from any released package
(docs content plus a script data file), so `skip-changeset` is declared.

## Human Minimum

- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
(not touched)
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; `pnpm lint` passes. (no code; CI runs lint)
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request.
- [x] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset. (publishes
nothing)
- [x] 6. `packages/spec` touched: its generated artifacts are
regenerated and committed. (not touched)
- [x] 7. No hand edits to `content/docs/references/`,
`packages/*/CHANGELOG.md` or `content/docs/releases/`.
(`content/docs/releases/v18/` is this card's subject: a docs-only
release-notes PR, dispatched per card by the seat)
- [x] 8. Title, body and comments are in English.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01FEkQ5oCDtzpDYo1LPg2KvR

---
_Generated by [Claude
Code](https://claude.ai/code/session_01FEkQ5oCDtzpDYo1LPg2KvR)_

<!-- signed: domain:devx#4 · os-project-manager ·
session_01FEkQ5ooRyyS95kdyC2dPEX -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
scbdzhwl pushed a commit to scbdzhwl/objectstack-analysis that referenced this pull request Nov 16, 2026
… local sign-in path off, and a blocked client lands on the sign-in page from the direct sign-in door (objectstack-ai#33781)

<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} -->
_Requested by **Steedos** · [project
thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9Ubb8CDLT8YAjNiG4Z8mgQQdT9)_

Fixes objectstack-ai#33358

Clause-②: yes (narrowing) — narrowed: with direct sign-in on and its
local sign-in path `off`, an auth settings save (`PUT
/api/settings/auth`) that turns Google off, or clears a Google client
credential no environment variable backs, while Google is the last way
in the sign-in page offers answers `400 SETTINGS_VALIDATION` (copy
`googleLocalOff`) and saves nothing, where it saved, even with email and
password or phone sign-in on; and a `GET /api/v1/auth/sign-in/direct`
from a client the IP allow-list refuses answers `302` to
`/login?error=IP_NOT_ALLOWED`, where it answered the `403
IP_NOT_ALLOWED` JSON body. Widened: under `off` with nothing else in
force (no Google, no identity provider row, no social or OIDC provider
with credentials, no host sign-in handoff), a save of
`email_password_enabled: false` answers `200` and saves, where it
answered `400 SETTINGS_VALIDATION`, because the sign-in page offers no
email and password there either way; module exports (not on the package
entry) `DIRECT_SIGN_IN_NETWORK_REFUSED`, `isDirectSignInDoorNavigation`
and `directSignInNetworkRefusal`; the copy key `googleLocalOff` in all
11 locales; the `@object-ui/i18n` key
`auth.login.errors.networkNotAllowed` in all 11 packs (no key renamed or
removed); `markSignOutRoundTrip` takes the sign-in page path it records.
Metadata-protocol: none
Skills-docs: none — no skill under `skills/**` teaches direct sign-in,
the auth settings save, the IP allow-list or the sign-out note;
`content/docs/permissions/sso.mdx` gains the rules in this change.

## 维护者速读

- 改了什么:直接登录把本地登录路径设为 off 后,保存认证设置时不再把邮箱/密码当作还能登录的方式,删掉最后一个 Google
会被拒绝并给出专门的提示;被 IP 白名单拦下的浏览器打开直接登录入口时,跳回登录页并说明"不允许从你的网络登录",不再看到原始的 403
JSON;从身份提供方注销的标记只在提供方把浏览器送回登录页那一次生效。
- 为什么改:自托管系统开了 OS_AUTH_DIRECT_SIGN_IN_LOCAL_PATH=off 时,管理员关掉最后一个 Google
登录仍能保存成功,随后所有人(包括管理员)都进不了系统;被 IP 白名单拦下的人看到一段看不懂的
JSON;提供方不回跳时,下一次打开深链接会丢掉 ?redirect=。
- 风险与回滚:**BREAKING**(声明 Clause-② narrowing):直接登录且本地登录路径为 off 时,把 Google
作为最后一种登录方式关掉的设置保存从 200 变为 400;被 IP 白名单拦下的浏览器 GET 直接登录入口从 403 JSON 变为 302
跳回 /login?error=IP_NOT_ALLOWED。hidden 和直接登录关闭时行为不变;IP
白名单没有放宽,被拦的客户端仍然无法发起登录,POST 和带尾斜杠的路径仍是 403。回滚即撤回本 PR。
- 先看:packages/plugins/plugin-auth/src/sign-in-method-floor.ts 的
signInMethodFloorPredicate;auth-plugin.ts 中 IP
白名单中间件新增的一段;ui/packages/auth/src/signOutRoundTrip.ts 的
readSignOutRoundTrip。
- 两分钟验证:`cd packages/plugins/plugin-auth && pnpm exec vitest run
src/sign-in-method-floor.test.ts
src/direct-sign-in.test.ts`,预期全部通过,其中新加的 off 场景用例与 IP 白名单用例都在列。
- 需要你做的:无,席位落地。

## What changes

**Item 1, the settings-save half (N7).** `signInMethodFloorPredicate`
now judges by what the sign-in page offers, through the same
`pageOffersLocalSignIn` the provider delete and the boot report use
since objectstack-ai#33623. Under `directSignIn.localSignIn: 'off'`:

- the `google_*` change that removes the last way in (Google off, or a
client credential cleared that no env variable backs) is refused `400
SETTINGS_VALIDATION` at its key with email and password ON, in a new
`googleLocalOff` copy in all eleven languages of the existing table (the
email-off copy's remedy, keep email and password on, does nothing
there); turning email and password on in the same save does not help;
- the `email_password_enabled` key itself is never refused under `off`,
because the page draws it neither way, so the save removes nothing the
page offers. With nothing else in force this widens an answer:
`email_password_enabled: false` was `400` on main and is now `200`
(declared under Widened). Recovery after such a save needs
`OS_AUTH_EMAIL_PASSWORD_ENABLED=true` as well as
`OS_AUTH_DIRECT_SIGN_IN_LOCAL_PATH=hidden`, then a restart;
- phone sign-in counts only as the page offers it (`asThePageOffers:
true`), as on the other two doors.

Under `hidden`, or with direct sign-in off, every answer is as on main
(the `localOffered` leg is true there).

Copy nit folded in: `enterpriseSsoUnverified` (the `503` on a provider
delete whose provider list could not be read) said "with email and
password off"; it now says the sign-in page offers no email and
password, which is true under both reasons the check runs. All eleven
languages.

`content/docs/permissions/sso.mdx` no longer says the settings save is
still open, and names the three checks and the exits that still count.

**Item 2 (N8), the direct sign-in door under the IP allow-list.** The
allow-list middleware in `auth-plugin.ts` (one hunk, disjoint from
objectstack-ai#33268's) still refuses, audits and logs exactly as before. For a GET of
the mounted door only, its answer is now `302` to the Console's
`/login?error=IP_NOT_ALLOWED` with the page's `?redirect=` carried
(`directSignInNetworkRefusal` in `direct-sign-in.ts`, reusing
`carriedRedirect` / `keptReturnPath`), instead of the raw `403` JSON. No
exemption: the request never reaches the door, nothing is started, no
provider is read, and every other auth request from that client
(`/get-session`, `/sign-in/social`, a POST to the door path, the door
path with a trailing slash) is still `403 IP_NOT_ALLOWED`. With direct
sign-in off the path is not mounted and the answer is the `403` as
before. The page holds on any `error` already; `ssoCallbackRefusal.ts`
gains `IP_NOT_ALLOWED` with the new `@object-ui/i18n` key
`auth.login.errors.networkNotAllowed` in all eleven packs (zh-Hant
generated by `gen:zh-hant`), so the page says the system does not allow
sign-in from this network instead of the generic "link expired"
sentence. The route ledger note for `GET /api/v1/auth/sign-in/direct`
says so.

**Item 3, review nit N6.** Pins for the exits under `off`: another
provider row, a social provider and an OIDC provider with credentials, a
host sign-in handoff, on the provider delete, the boot report and the
settings save.

**Item 5 (N13).** The provider-logout note in `sessionStorage` now holds
the time AND the return path (`createAuthClient.signOut` passes
`resolveSpaRoute('/login')`, the sign-out's own `callbackURL`), and
`readSignOutRoundTrip` honours it only on a load of that path within the
window. `AuthProvider` still drops the note on every mount, so a tab
whose provider never sent it back drops it unread on the next load of
any other page: `LoginRedirect` then keeps the deep link's `?redirect=`.
`LoginRedirect` itself is unchanged. A note in the old bare-number shape
reads as no note.

## Why

An administrator of a self-hosted system with
`OS_AUTH_DIRECT_SIGN_IN_LOCAL_PATH=off` could save Google off while it
was the last way in, and the page then said "No sign-in method is
available" to everyone. A blocked client following the direct sign-in
redirect saw a raw JSON body. A provider that never returned the browser
made the next deep link in the tab land on the home page.

## Verification

Final head `e25b4e31`. Round 3 (delta review 6894048463) added
`e25b4e31`, a changeset-prose-only commit declaring the email-off save
under `off` as widened; the changeset gates (no-major, empty-changeset,
adr-0087 registration, issue citations, closed-ceremony text, changeset
gate self-tests) re-ran exit 0 there. Before that, the review round
(review-a FAIL 6893256448) added commit `7c6c999c` on top of `10180db4`:
the changeset re-declared as narrowing, the no-Google email-key pins,
the trailing-slash case and the docs sentence. Touched suites,
ablations, delta gates and the dogfood battery ran on `7c6c999c` after
rebuilding the closure; the full suites and the 110-family gate run are
from `f76f5856` / `10180db4` (round 1), and no source file changed
since, only tests, docs and the changeset.

<details><summary>Tests</summary>

- Round 2 at `7c6c999c`: `sign-in-method-floor.test.ts` +
`direct-sign-in.test.ts`: 2 files, 168 passed.
- Round 1: `pnpm --filter @objectstack/plugin-auth test` under the
verify lock: Test Files 277 passed (277), Tests 5481 passed, 10 skipped.
After the merge of main (`spec check:generated` all 14 up to date): 5
touched files, 210 tests passed.
- Round 1 ui under the lock: `packages/i18n/`,
`apps/console/src/pages/auth/`, `apps/console/src/components/__tests__`,
`product-neutral-renderer.ratchet`: 137 files, 2259 passed, 13 skipped.
`packages/auth` sign-out tests: 2 files, 22 passed. `pnpm --dir ui exec
vitest run scripts/`: 171 files passed, 2 skipped.
- Type checks (round 1): `@objectstack/plugin-auth typecheck`; turbo
`type-check` for `@object-ui/auth`, `@object-ui/i18n` (6 tasks) and
`@object-ui/console` (75 tasks), all successful.

</details>

<details><summary>Ablations (each through scripts/ablation-replace.mjs:
anchor 1 to 0 on disk, red, restored, git diff HEAD empty)</summary>

Round 2, at `7c6c999c`:

- `if (!localOffered && key === 'email_password_enabled') return
undefined;` → `if (false) …`: 2 red, both the new pins where nothing
else is in force (the composed `under the local sign-in path off, the
email and password key is never refused, even with no other way in
configured`, and the off judge's no-Google case). With Google still in
force the old pins stayed green, which was the review's point.
- `method.toUpperCase() === 'GET' &&` → `true &&` in
`isDirectSignInDoorNavigation`: 1 red, the `POST` to the door answers
302 instead of 403.
- the path equality → `path.startsWith(basePath)`: 1 red,
`/api/v1/auth/get-session` answers 302 instead of 403.
- the path equality → equality after stripping a trailing slash: 1 red,
`GET /api/v1/auth/sign-in/direct/` answers 302 instead of 403 (the new
trailing-slash case).
- `this.directSignInDoorMounted &&` → `true &&` in the allow-list
middleware: 1 red, the CONTROL with direct sign-in off answers 302
instead of the 403 body.

Round 1, at `f76f5856`:

- `localOffered` forced true: 2 floor tests red (the composed off save
and the off judge).
- off copy replaced by the email-off copy: the same 2 red.
- phone counted on the save under off (`asThePageOffers: false`): 1 red
(the off judge).
- the allow-list landing branch disabled: 1 red (the blocked navigation
case).
- the carried redirect dropped from the landing: 1 red.
- the `IP_NOT_ALLOWED` map entry renamed in `ssoCallbackRefusal.ts`: 1
red (the page sentence pin).
- the return-path comparison in `readSignOutRoundTrip` forced true: 3
red.

</details>

<details><summary>Gates</summary>

- Round 2 at `7c6c999c`: the 48 families of the round-1 list that read
the changeset, docs, ADR registration, citations, comments, error codes,
the auth mount ledger or skills examples, re-run: 48 exit 0
(`check:skill-examples` after building `@objectstack/client-react`, its
declared prereq).
- Round 1: `dispatch-gates --commands` derived 110 families; 109 exit 0;
`check:dual-build-cjs-loads` exit 3 (needs every package built) NOT
MEASURED locally and left to CI. `pnpm lint` exit 0.
- Dogfood battery (owed by `!` and the narrowing arm): PASS at
`7c6c999c`: `pnpm --filter @objectstack/dogfood test` under the verify
lock, Test Files 467 passed, 3 skipped (470); Tests 3958 passed, 42
skipped (4000); VERDICT command-exit 0 (held 33m41s, shared box).

</details>

## Acceptance notes

- What to do after an email-off save under `off`: setting the local path
back to `hidden` is not enough; set
`OS_AUTH_EMAIL_PASSWORD_ENABLED=true` as well, then restart. `sso.mdx`'s
recovery sentence already says so.
- Declared `Clause-②: yes (narrowing)` per claim amendment 6893265267:
two answers move (the settings save under `off` from 200 to 400, the
blocked door GET from 403 to 302), so the title carries `!` and the
changeset a **BREAKING** paragraph, an Unchanged paragraph, What to do,
and the `adr-0087: not-required (no-migration-prescription)` marker (no
schema key, value or metadata type moves, nothing stored to rewrite).
The bump stays `patch`, as objectstack-ai#33623 did.
- `content/docs/permissions/sso.mdx` gains the 302 sentence in the
direct sign-in "No loops" list.
`content/docs/permissions/authentication.mdx` (the allow-list field row)
is outside the claim surface and untouched; the sso.mdx sentence links
to it.
- `AuthProvider.tsx` keeps its comment that the first mount after the
round trip starts raised; that is still true of the return load, so it
is untouched.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01QsR2jSSVaNcDs8HPSoGV6V

<!-- signed: domain:server#5 · zhuangjianguo ·
session_01QsR2jVPGBoi3MCGoKbW1Hv -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
scbdzhwl pushed a commit to scbdzhwl/objectstack-analysis that referenced this pull request Nov 16, 2026
…holds (objectstack-ai#33991)

<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} -->
_Requested by **Steedos** · [project
thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbSUQWB2j9eHYsRcrCiq1X1C)_

Fixes objectstack-ai#33200
Clause-②: yes (widening)
Metadata-protocol: none

## 维护者速读

- **改了什么:** 「设置上级」(Set Manager) 现在只拒绝真正由 SCIM 目录同步的人;只通过 SSO
登录、背后没有目录的人,管理员可以照常改上级。按钮对平台管理员在每一行用户上都显示。
- **为什么改:** 托管环境里第一次通过平台 SSO 登录的人都会被标成
`idp_provisioned`,旧规则把他们全当成「目录持有」,登录后上级就再也改不了,按上级流转的审批跟不上组织调整。按裁决记录
6895645364 选项 A 修。
- **风险与回滚:** 只放宽:以前能成功的请求没有一个变成拒绝。SCIM 判定多读一次 `sys_scim_subject`,读失败返回
500 且不写入。回滚即 revert 本 PR。
- **先看:** `admin-set-user-manager.ts` 的 refusal 5
判断(`applyUserManagerLink`);`scim-sso-adoption.ts` 新导出的
`isHeldByScimDirectory`;`sys-user.object.ts` 的 `set_user_manager`
`visible`。
- **两分钟验证:** `pnpm --filter @objectstack/plugin-auth exec vitest run
src/admin-set-user-manager.test.ts`,预期 38 个全过,其中 "an SSO-only identity
... is SET like a local one" 为 200 并写入 `manager_id`。
- **需要你做的:** 无,席位落地。

## What changes

Built to the maintainer ruling recorded in 6895645364 (option A: only
identities a SCIM directory holds stay locked).

- **`POST /api/v1/auth/admin/set-user-manager` (refusal 5).** It refused
on `sys_user.source = 'idp_provisioned'` alone. ADR-0135 D4 stamps that
value on every federated link without a local password, so a person who
only signs in through SSO carried it with no directory behind them. The
refusal now also needs a `sys_scim_subject` row. The answer for a
SCIM-held identity keeps its envelope (`403 PERMISSION_DENIED`,
`details.reason: 'idp_provisioned'`), and the message says to change the
manager in the directory. It no longer claims a sync would revert the
value, because nothing projects the SCIM `manager` attribute onto the
column today. The self, cycle, depth and cross-organization refusals are
unchanged.
- **One predicate, imported.** `scim-sso-adoption.ts` now exports
`isHeldByScimDirectory(engine, userId)`. It is the same
`sys_scim_subject` read its adoption judge already ran as condition 2,
moved into an exported function. The judge calls it, and so does the
endpoint. A missing `sys_scim_subject` table reads as "not held" at the
endpoint. Any other read failure propagates, so the mount answers 500
and writes nothing.
- **The `source` term stays a conjunct.** A SCIM-provisioned user with a
local password is `env_native` under D4 and was accepted before.
Requiring the SCIM row alone would have refused that user, so the
endpoint still checks `source` too, and no request that was served
before is refused now.
- **Bulk import and demo staff.** Both run `applyUserManagerLink`, so
their `manager_id` links follow the same rule with no code change. The
import docblock now says who is refused.
- **`sys_user.set_user_manager` visibility** is
`current_user.isPlatformAdmin == true`. No column on the row says "held
by SCIM", so the button is shown on every row and the endpoint refuses a
SCIM-held one with its message. No new field or key.
- **Lint prescription.** `os explain
approval-approvers-may-resolve-empty` now says the operation refuses an
identity a SCIM directory holds, and that an identity that only signs in
through SSO is set like any other. The docblock in
`validate-approval-approvers.ts` says the same.
- **Docs.** `content/docs/automation/approvals.mdx`,
`content/docs/capabilities/approvals.mdx` and
`content/docs/permissions/authentication.mdx` state the narrowed
refusal.
- ⛔ The `idp_provisioned` stamp (ADR-0135 D4) and the password refusals
are untouched.

## Tests

On head `fa70eaa06`:

- `admin-set-user-manager.test.ts`, refusal 5 rewritten. SCIM-held SET
and CLEAR give 403 `PERMISSION_DENIED` / `idp_provisioned`, write
nothing, and read `sys_scim_subject` for that user. SSO-only SET and
CLEAR give 200, and `update` gets `{ id, manager_id }`. An SSO-only
self-assignment is still a 400 `self_assignment`. `env_native` gives
200, also with a SCIM subject, and the SCIM table is not read. A missing
table gives 200. A failed read rejects and writes nothing.
- `admin-import-users-manager-pass.test.ts`: a SCIM-held row is refused
with `idp_provisioned`. An SSO-only row is `linked`, and `manager_id` is
written. The no-fork pin also asserts that the importer spells neither
`sys_scim_subject` nor `isHeldByScimDirectory`.
- `demo-staff.test.ts`: the refusal fixture is now a SCIM-held identity.
- `sys-user-set-manager-action.test.ts` and `platform-objects.test.ts`:
the action is offered on an `idp_provisioned` row and on the sparse
face. It is hidden from a non-admin. It reads no record column, which
has a positive control on the standing term.
- `validate-approval-approvers.test.ts`: the new prescription is
present, and the old `source 'idp_provisioned'` sentence is absent.

<details><summary>Suite runs</summary>

- `@objectstack/plugin-auth` full suite (locked, before the demo-staff
fixture fix): 276/277 files. The one red was `demo-staff.test.ts`, whose
fixture is fixed in the next commit. Re-run: `demo-staff.test.ts` +
`demo-staff-provisioning.test.ts` 32/32.
- Targeted: plugin-auth 3 files 76/76; platform-objects 2 files 169/169;
lint 1 file 64/64.
- `@objectstack/platform-objects` full: 122 files, 1994 tests passed.
`@objectstack/lint` full: 212 files, 9026 tests passed.
- Typecheck exit 0 for plugin-auth (all three legs, incl.
`check:test-typecheck`), platform-objects and lint.
- Dependent: `@objectstack/runtime` `platform-admin-action-gate.test.ts`
16/16.

</details>

<details><summary>Ablations (each mutation landed by
ablation-replace.mjs, restored to the HEAD blob)</summary>

- A1, refuse on `source` alone (the old predicate): 7 red, incl. every
SSO-only pin in both endpoint and import suites.
- A2, no refusal 5 at all: 4 red, incl. SCIM-held SET, CLEAR and the
import row.
- A3, refuse on the SCIM row alone (drop the `source` conjunct): 1 red,
"env_native ... even one that owns a SCIM subject".
- A4, swallow every SCIM read failure: 1 red, "a FAILED SCIM-subject
read is never read as no directory".
- A5, put the `record.source` term back on `visible`: 5 red across
`sys-user-set-manager-action.test.ts` and `platform-objects.test.ts`.
- A6, put the old lint sentence back: 1 red, "GRADES the routes".
- A7, missing table rethrows: 1 red, "a missing sys_scim_subject table
means no directory".

</details>

## Acceptance notes

- SCIM-held users stay unchangeable from both sides until the SCIM
`manager` projection lands. The ruling records this and the separate
card objectstack-ai#33918 carries it.
- The action's `helpText` still lists the four other refusals and not
the SCIM one. The endpoint message names the directory. Changing
`helpText` would move nine translation bundles, so it is left as it is.
- `details.reason` keeps the value `idp_provisioned` so no client keyed
on it changes. Only the predicate behind it narrowed.

## Verification

- `node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack`: 105 derived families. 101 exit 0. 3 exit 3
(prerequisite not met, NOT MEASURED, left to CI):
`check:skill-examples`, `check:dual-build-cjs-loads`, `check:i18n`. 1
not run: `check:type-check-debt`, because the verify lock was held by
another run for more than 60 minutes. `--ran` reconciliation agrees.
- `--tier`: no path-derived mandate. The same verdict as merged objectstack-ai#33646
and objectstack-ai#33769.
- eslint on the changed `.ts` files: exit 0. `check-nul-bytes`: OK.
- `git merge-tree --write-tree` of this head against `origin/main`,
objectstack-ai#33956, objectstack-ai#33268 and branch `claude/area-A2-33828`: clean, no conflicted
paths.

Session: https://claude.ai/code/session_01QsR2jVPGBoi3MCGoKbW1Hv

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: objectstack-fleet[bot] <332303061+objectstack-fleet[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

3 participants