Repository navigation
fix(plugin-auth): SSO-user doors admit the stamped organizationId when it is the session's, so console Import Users and Add User work - #34966
Conversation
…y when it is the session's Claude-Session: https://claude.ai/code/session_01WGufzi3ezPzTysQPDEjmVz Co-authored-by: Claude <noreply@anthropic.com>
…er doors Claude-Session: https://claude.ai/code/session_01WGufzi3ezPzTysQPDEjmVz Co-authored-by: Claude <noreply@anthropic.com>
…tays generic Claude-Session: https://claude.ai/code/session_01WGufzi3ezPzTysQPDEjmVz Co-authored-by: Claude <noreply@anthropic.com>
…nizationId Claude-Session: https://claude.ai/code/session_01WGufzi3ezPzTysQPDEjmVz Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 16 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 5 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 21 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 7c134aae13977c3a3550ba5c182a289e96e8bc4e && git checkout 7c134aae13977c3a3550ba5c182a289e96e8bc4e
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin db1a05cdaeec179bdf327c1e357ac7bbc6b678b9 11968702bd9f369f29726c2c97057be4875cad2e && git checkout -B drift-repro db1a05cdaeec179bdf327c1e357ac7bbc6b678b9 && git merge --no-ff 11968702bd9f369f29726c2c97057be4875cad2e
node scripts/docs-audit/affected-docs.mjs --json db1a05cdaeec179bdf327c1e357ac7bbc6b678b9
|
|
repo:objectstack#3 · os-support-ai · session_01WGufzi3ezPzTysQPDEjmVz Live readings: console Import Users / Add User / remove SSO user on a cloud-managed showcaseShowcase backend (
Each console call carried the session (Bearer plus the session cookie), recorded per line in readings.txt. Served Artefacts (screenshots readings.txt |
|
repo:objectstack#3 · os-support-ai · session_01WGufzf35CD4CvA4nKbwwUn L1: ACCEPT L1 read of #34966 (card #34912) at the head above, base 8e49847; the head merges cleanly with current main. Must-fixNone. Should-fixNone. Notes
|
…und organizationId Claude-Session: https://claude.ai/code/session_01WGufzi3ezPzTysQPDEjmVz Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#3 · os-support-ai · session_01WGufzgh1zkZzDXL36ckWAG Contract-review-claim: session_01WGufzgh1zkZzDXL36ckWAG · head ce3609c · 2026-11-17T19:52Z |
|
repo:objectstack#3 · os-support-ai · session_01WGufzgh1zkZzDXL36ckWAG Contract reviewServed-tier: Face: declaration. Of the 4 paths, 0 are governed and none is a published schema. The PR body and the changeset both say ① Derived judgments
② Semver level
Clause-②: yes (widening) — confirmed. Each door admits one more body key, only when it equals the caller's session org. Nothing that was accepted is refused. ③ Boundary flags
Only nits stay open, which meets the merge standard. Implemented-by: VERDICT: PASS |
|
repo:objectstack#3 · os-support-ai · session_01WGufzf35CD4CvA4nKbwwUn L1: ACCEPT This is a delta read of #34966, from ce3609c (my L1 ACCEPT 6959151659) to 7f0c346. It is one commit, Must-fixNone. Should-fix
Notes
|
…; non-string or empty is its own refusal Claude-Session: https://claude.ai/code/session_01WGufzi3ezPzTysQPDEjmVz Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#3 · os-support-ai · session_01WGufzgh1zkZzDXL36ckWAG Contract reviewServed-tier: This is a delta review over the seat's L2 PASS 6959579883, which was given at
The hop touches two files: The face is unchanged. Neither new path is governed or a published schema, and the PR body and changeset still say Inputs:
Code outside the diff was read with ① Derived judgments
② Semver levelNothing changed since 6959579883. The only entry is Clause-②: yes (widening) — confirmed. The hop adds nothing to the widening and takes nothing from it. The changeset's prose description of the refusals needs the should-fix above. Its level and declaration lines do not. ③ Boundary flags
Merge standard: only nits may stay open. One should-fix is open, the false refusal description in the changeset body. The code, the tests, the doc, the ledger and CI all hold. Once the changeset is corrected, this delta would pass with only nits open. Implemented-by: VERDICT: FAIL |
… non-string value is checked before the session Claude-Session: https://claude.ai/code/session_01WGufzi3ezPzTysQPDEjmVz Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#3 · os-support-ai · session_01WGufzf35CD4CvA4nKbwwUn L1: ACCEPT This is a delta read of #34966 from 7f0c346 (my delta ACCEPT 6959861127) to 57e2d33. Two prose-only commits, 4323236 and 57e2d33, change the changeset, Must-fixNone. Should-fixNone. S1 from 6959861127 is resolved. Notes
|
|
repo:objectstack#3 · os-support-ai · session_01WGufzgh1zkZzDXL36ckWAG Contract-review-claim: session_01WGufzgh1zkZzDXL36ckWAG · head |
|
repo:objectstack#3 · os-support-ai · session_01WGufzgh1zkZzDXL36ckWAG Contract reviewServed-tier: This is a delta review over the seat's delta FAIL 6960548869, given at The face is unchanged. Of the 6 paths in the net diff, none is governed or a published schema. The PR body and the changeset still say Inputs:
Code outside the diff was read with ① Derived judgments
② Semver levelUnchanged since 6959579883. The only entry is Clause-②: yes (widening) — confirmed. Each door admits one more body key, ③ Boundary flags
Merge standard: only nits may stay open. The should-fix is closed, and the three nits left open are prose or optional. The code, tests, doc, ledger, changeset and CI all hold at this head. Implemented-by: VERDICT: PASS |
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzi3ezPzTysQPDEjmVz
|
repo:objectstack#3 · os-support-ai · session_01WGufzgh1zkZzDXL36ckWAG Regen-provenance: 6961284606 · The new head is a pure merge of main |
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzi3ezPzTysQPDEjmVz
|
repo:objectstack#3 · os-support-ai · session_01WGufzgh1zkZzDXL36ckWAG Regen-provenance: 6961284606 · Another pure merge of main |
|
repo:objectstack#3 · os-support-ai · session_01WGufzi3ezPzTysQPDEjmVz Landing · 2026-11-17T22:44Z
Open findings: nits only (jsdoc at pending-sso-users.ts :184–189 still says "names both"; kept in the record under the merge standard). The first merge-forward head 4345f62 went red only on a 25-minute State: ready + auto-merge armed by area o3-D (lease Dev-effort: high · Rounds: 3 (code, docs fold, prose S1s) |
Requested by Yibo Wang · project thread
Fixes #34912
repo:objectstack#3 · os-support-ai · session_01WGufzi3ezPzTysQPDEjmVz
Clause-②: yes (widening)
Metadata-protocol: none
维护者速读
admin/import-sso-users、admin/add-sso-user、admin/remove-sso-user)现在接受请求体里的organizationId,但只在它等于调用者会话当前组织时接受;不等、类型不对、或会话没有当前组织都会被 400 拒绝,且什么都不写。/api/v1/auth/,转发统一附带调用者的organizationId,而这三个入口拒收任何未知键,所以托管环境里每个管理员点这两个按钮都必然 400。pending-sso-users.ts一个文件。packages/plugins/plugin-auth/src/pending-sso-users.ts的refuseForeignOrganization(三个入口共用的校验);同文件三处unknownBodyKeys调用;pending-sso-users.test.ts末尾的[#34912]用例组。pnpm --filter @objectstack/plugin-auth exec vitest run --maxWorkers=2 src/pending-sso-users.test.ts -t 34912,预期 14 个用例全绿。What changes
pending-sso-users.ts: one shared check,refuseForeignOrganization, runs in all three doors right after their closed-key check.organizationIdis the only key admitted beyond each door's own set (unknownBodyKeys), and only as a statement the session already makes:deps.getCallerActiveOrganizationId()(the caller's own session, read with the request's headers throughauthApi.getSession; the route wiring already passes it to these doors, so no wiring change): admitted, then never read again. Scope stays the session's: single-org binds the sole organization as before, multi-org joins the session organization insettleRequestas before;400 INVALID_REQUEST, the sentence names the organization sent and the one the session holds;null,'', a number):400 INVALID_REQUEST;400 NO_ACTIVE_ORGANIZATION.Every refusal happens before any read, write or host call. Both codes are already in the error-code ledger; no new code.
buildApiActionRequest(packages/runtime/src/action-execution.ts) is unchanged (seat ruling A).@objectstack/plugin-authpatch, with both declaration lines.Tests
packages/plugins/plugin-auth/src/pending-sso-users.test.ts, new top-level describe in the shared harness (realAuthManagerand real route mount, real bearer sessions):NO_ACTIVE_ORGANIZATION(and, on add, a CONTROL: the same request without the key still answers 201);null,''and42refused 400;packages/runtime/src/domains/api-action-forward.test.ts(thebuildApiActionRequestharness), CONTROL describe: the declaredsys_user.import_sso_usersandadd_sso_useractions are still stamped with the caller organization,ban_user(another identity route) keeps the stamp, and a caller with no organization gets no stamp.if (sent !== current) {toif (false) {, viascripts/ablation-replace.mjs, anchor 1 to 0, blobed0b3c405d81to2cd498db4bb9): exactly the four foreign-organization legs go red (add, import, remove, multi-org fake), 10 others stay green; restored, blob back toed0b3c405d81= HEAD,git diff HEADempty.Test and type-check readings
pnpm --filter @objectstack/plugin-auth test(tree at c8d32b0; head ce3609c adds only the changeset): Test Files 285 passed (285), Tests 5983 passed, 10 skipped. Exit 0.pnpm --filter @objectstack/plugin-auth typecheck: exit 0.pnpm --filter @objectstack/runtime typecheck(includescheck:test-typecheckover the test file): exit 0.vitest run src/domains/api-action-forward.test.ts(runtime): 89 passed (89).vitest run src/pending-sso-users.test.ts -t 34912: 14 passed.Tests 4 failed | 10 passed; the failed names are the three "a different organization is refused 400 naming both" legs and "the body organization never feeds scope".Acceptance notes
admin/remove-sso-userhas no declared console action: nosys_useraction targets it, although the auth route ledger note says Setup → Users posts it. Its live reading posts the body an identity-route forward would send. Noted, not filed.after-2-import-result.pngin the live readings). Reported to the seat as a separate UX finding; not touched here.notestrings only, with no code path changed:content/docs/permissions/authentication.mdx, in the cloud-managed two-doors section: one paragraph says that add-sso-user, import-sso-users and remove-sso-user take an optionalorganizationId. It is admitted only when it equals the session's active organization. A different or non-string value gets400 INVALID_REQUEST, and a body org with no session org gets400 NO_ACTIVE_ORGANIZATION. Nothing is written before either refusal, and the value never widens scope. The remove-sso-user line points to that paragraph.packages/plugins/plugin-auth/src/auth-route-ledger.ts: the threenotestrings for those routes state the same rule.Verification
Live readings on a cloud-managed showcase (
OS_CLOUD_MANAGED=1), driven through the real console, before (origin/main's door) and after (this head): posted as a PR comment.Local gates at ce3609c
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack: 71 commands. All 71 run: 69 exit 0; 2 exit 3, read as NOT MEASURED:node scripts/check-plugin-teardown-shape.mjs --self-test(pinned fixture commit not reachable from this shallow clone; script untouched) andpnpm check:dual-build-cjs-loads(PREREQUISITE NOT MET: whole-tree gate, unbuilt packages outside this diff). CI runs both.--ranreconciliation: 71 derived, 71 run, 0 UNRUN.check:auth-mount-ledger,check:error-code-casing,check:route-ledger-census, all exit 0.node scripts/pm/overlap-check.mjs --branch=HEAD:VERDICT clean exit 0against origin/main 8e49847 and 0 PR heads.🤖 Generated with Claude Code
https://claude.ai/code/session_01WGufzi3ezPzTysQPDEjmVz