Skip to content

plugin-auth: admin/set-user-manager refuses every user who has signed in through SSO as "directory-owned", even where no directory exists, so on a hosted environment nobody's manager can be changed after their first sign-in #33200

Closed

Description

@objectstack-fleet

domain:server#7 · os-tesla · session_01L9qibzuZJBQY4wUQFJbkfx

Filing gate: ① a public door gives a wrong answer, class a. Found during the #33181 measurement. ⛔ Not a claim; triage sets the lane and grade.

What happens

POST /api/v1/auth/admin/set-user-manager refuses a target whose sys_user.source is idp_provisioned with 403 PERMISSION_DENIED: "This identity is provisioned by an external directory (sys_user.source is 'idp_provisioned'), so its manager is maintained by that directory and a value written here would be reverted on the next sync. Set the manager in the directory instead." (admin-set-user-manager.ts ~L514).

idp_provisioned is not a directory mark. ADR-0135 D4 stamps it on any federated link without a local password (stampIdentitySource, auth-manager-database-hooks.ts ~L597), so the cloud's own platform SSO (objectstack-cloud) stamps it on every person's first sign-in to a hosted environment, and a social or enterprise OIDC sign-in stamps it too. On those rows there is no directory, no sync and no place where the manager could be set "instead".

Repro (reach: public door, wrong answer)

Measured at objectstack-ai/objectstack origin/main 8835532, a real AuthManager behind AuthPlugin.registerAuthRoutes on Hono, caller a platform administrator:

  • target source: idp_provisioned, no sys_scim_subject row (no SCIM directory), no local credential (what a platform-SSO first sign-in leaves): 403 PERMISSION_DENIED with the sentence above; manager_id not written. Same on a cloud-managed environment and on a self-hosted one.
  • CONTROL: the same call on an env_native target answers 200.

Consequence on a hosted Free/Team environment (no SCIM): a manager can be set while a person is not yet signed in, and never again once they have signed in, so approval flows that route by manager cannot follow a reorganisation.

Seam

Seam: platform-objects:sys_user.source (idp_provisioned) → runtime: admin-set-user-manager.ts applyUserManagerLink directory-owned refusal. The ruling that made it (5651634638 row 7, "directory wins") is about a SCIM directory; the predicate reads a mark that also covers SSO-only users. A narrower predicate (a sys_scim_subject row, the condition scim-sso-adoption.ts uses for "held by a SCIM directory") is the likely fix; the ruling's scope is the maintainer's to confirm.

Dedupe words: set-user-manager idp_provisioned, directory-owned manager, manager reverted on the next sync, applyUserManagerLink.

Activity

  1. objectstack-fleet commented on Nov 14, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Path: none

    Triage: first touch → domain:server · p1 · pm:queue · 2026-11-14T02:44Z

    ⛔ Not a claim.

  2. added
    domain:server
    pm:queue
    priority:p1
    on Nov 14, 2026
  3. objectstack-fleet commented on Nov 14, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#7 · sunhaolin · session_017xRBcSZ51q2s3nMfakhdJ3

    Decision analysis · 2026-11-14T13:15Z · the seat's pre-dispatch reading found the refusal is the ruling's own text, so the card leaves the queue for the decision box. ⛔ Not a claim.

    维护者速读

    • 现象: 托管环境里,人员第一次通过平台 SSO 登录后,就被标为 idp_provisioned。从此管理员再也改不了这个人的上级(manager),按上级流转的审批也就跟不上组织调整。
    • 要你裁: 「目录说了算」这条裁决,是只管真有 SCIM 目录同步的人,还是凡标了 idp_provisioned 的人都管。
    • 推荐: A。只拒「确实由 SCIM 目录持有」的人(有 sys_scim_subject 行),其余人允许修改上级。

    Premise, measured on origin/main 6c5d31fa

    • The refusal: packages/plugins/plugin-auth/src/admin-set-user-manager.ts ~L514: if (String(user.source ?? '') === 'idp_provisioned') return deny(403, 'PERMISSION_DENIED', …, "…a value written here would be reverted on the next sync. Set the manager in the directory instead.").
      • Re-check: git grep -n "=== 'idp_provisioned'" origin/main -- packages/plugins/plugin-auth/src/admin-set-user-manager.ts. Control: deny( appears in the same file.
    • The ruling is 5651634638 ({ type: 'manager' } resolves a column no product surface can write: sys_user.manager_id is refused by the data API and absent from the auth admin endpoints #16678). The card cites row 7, but row 7 is bulk import. The governing row is row 5, verbatim: "Directory sync | P1 — directory wins per identity, keyed on the existing sys_user.source: the endpoint refuses on idp_provisioned with a distinct error; ⛔ P3 is not declared (it needed §4's column)".
    • ADR-0135 D4 stamps idp_provisioned on any federated link without a local password (auth-manager-database-hooks.ts ~L597 stampIdentitySource). So platform SSO, social and enterprise OIDC first sign-ins carry it, with no directory behind them.
    • The SCIM adoption path already tells "held by a SCIM directory" apart by a sys_scim_subject row: scim-sso-adoption.ts L172–179 returns held_by_scim.

    Governing text: ruling 5651634638 row 5; ADR-0135 D4.

    Options

    Option What it does What the customer sees Effort
    A The door refuses only an identity held by a SCIM directory (a sys_scim_subject row), using the same predicate as scim-sso-adoption.ts. Everyone else's manager can be set An SSO-only person's manager can be changed; a SCIM-synced person's still says "set it in the directory" domain:server · 1 PR (admin-set-user-manager.ts + pins)
    B Unchanged: refuse on sys_user.source === 'idp_provisioned' (row 5 as written) On a hosted environment, a manager can be set only before the person's first sign-in none
    C Stop stamping idp_provisioned on SSO-only links (amend ADR-0135 D4), so the mark means "directory" again Same as A for this door, and every other reader of the mark changes too ADR amendment + several readers, not measured

    Recommendation: A. Row 5's own reason is that the value "would be reverted on the next sync", and that holds only where a directory syncs. A applies the rule where its reason holds, with the predicate the SCIM adoption path already uses for "held by a SCIM directory". B leaves a core admin task impossible on the default hosted path. C fixes the mark at its source, but moves every reader of it for one door's sake.

    os-decision-facets
    ① 项目长远合理性:A 让「目录说了算」只落在真有目录的人身上,和 SCIM 认领判定用同一个谓词,「谁由目录持有」只有一个定义;C 更彻底,但要动 ADR-0135 D4 和所有读这个标记的地方。
    ② 实际业务拉动:托管环境默认路径上的每一个人都受影响(分诊首触 6870428421 已定 p1),审批按上级流转。
    ③ 防 AI 犯错:三个选项都不加作者可写的键;A 的拒绝只在真有目录时出现,提示才是真的(「去目录里改」有处可去)。
    ④ 创业阶段不扩散:A 是一个 PR、零新契约;C 范围大得多。
    Prior rulings read: "set-user-manager idp_provisioned" → ruling 5651634638 (#16678) rows 5 and 7; ADR-0135 D4; thread: card #33200 (triage 6870428421)

    After the ruling: A or C returns the card to pm:queue in domain:server; B closes it not-planned with the ruling quoted.

  4. added
    needs-user-decision
    and removed
    pm:queue
    on Nov 14, 2026
  5. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#5 · zhuangjianguo · session_01QsR2jRsWwTRkuRCyQwvpAG
    Maintainer ruling recorded at 2026-11-15T14:07Z: A — only identities a SCIM directory holds stay locked. The maintainer tapped 「只锁目录同步的人」 on the decision card (2026-11-15T14:07:13Z, this project thread), after an independent seat review.

    What the ruling means:

    • admin-set-user-manager stops refusing on sys_user.source = idp_provisioned alone. It refuses only when the user is held by SCIM (a sys_scim_subject row exists; the predicate already lives in scim-sso-adoption.ts:166-173), still with "change it in your directory".
    • A user who signed in through SSO but has no SCIM subject gets the same answer as a local user. The four existing refusals (self, cycle, depth, cross-org) stay unchanged.
    • This is a widening (Clause-②: yes, widening). Narrow reading of ruling 5651634638 line 5: "directory wins" applies where a directory actually exists. It follows cloud#4465 ruling 1 (2026-11-13: the environment is the source of truth for people and managers).

    The build touches more than the endpoint. In scope:

    • sys-user.object.ts:694: the Set Manager button is hidden for idp_provisioned; it must show for non-SCIM users (show it and let the endpoint refuse, or add a readable derived flag).
    • The prescription text in packages/lint/src/rule-explanations.ts:3339 and validate-approval-approvers.ts:148,181.
    • The row-level refusal text in admin-import-users.ts, plus docs.
    • ⛔ ADR-0135 D4 (the idp_provisioned stamp) is not changed; password refusals stay as they are.

    Follow-up, separate card: no code projects SCIM manager into manager_id today (validate-approval-approvers.ts:155-159), so SCIM-held users remain unchangeable from both sides. That card is filed next.

    os-decision-facets
    ① 项目长远合理性:把「目录说了算」收窄到真有目录的人,不新增键、不改 D4 盖章;特例变少。
    ② 实际业务拉动:托管环境(#33227/#33755 已落地待激活用户)里登录过的人改不了上级,按上级流转的审批跟不上组织调整。
    ③ 防 AI 犯错:判定用已存在的 SCIM 持有谓词,闭合;SCIM 持有者仍响亮拒绝。
    ④ 创业阶段不扩散:不加新契约键;拒绝面缩小,不加新面。
    

    Prior rulings read: set-user-manager / directory wins / idp_provisioned / manager_id → ruling 5651634638 (#16678) lines 2, 5, 7; cloud#4465 rulings 1, 9, 10 (via #33181 comment 6870710213); ADR-0135 D2, D4, D5.2; ADR-0092 D2/D5; ADR-0057 D3; ADR-0134; ADR-0068; thread: #33200 body, triage 6870428421, analysis 6877839375.

  6. added
    pm:queue
    and removed
    needs-user-decision
    on Nov 15, 2026
  7. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#5 · zhuangjianguo · session_01QsR2jVPGBoi3MCGoKbW1Hv

    Claim: server area S1 (A1+A2) under #33751 §2 area-lease mode, area A1, seat domain:server#5 · p1 · built to the maintainer ruling recorded in 6895645364 (A — only identities a SCIM directory holds stay locked) · executed by an os-dev subagent of the area S1 thread · posted at 2026-11-15T14:09Z
    Session: session_01QsR2jVPGBoi3MCGoKbW1Hv
    Account: zhuangjianguo
    Branch: claude/area-A1-33200
    Worktree: objectstack-area-A1-33200
    Domain: domain:server
    Seat: domain:server#5
    File surface: packages/plugins/plugin-auth/src/admin-set-user-manager.ts (the directory-held refusal reads the SCIM-held predicate of scim-sso-adoption.ts), packages/platform-objects/src/identity/sys-user.object.ts (Set Manager visibility), packages/lint/src/rule-explanations.ts and packages/lint/src/validate-approval-approvers.ts (prescription text), the row refusal text in packages/plugins/plugin-auth/src/admin-import-users.ts, the docs pages that state the old rule (content/docs/permissions/authentication.mdx, content/docs/automation/approvals.mdx, content/docs/capabilities/approvals.mdx), their tests, one changeset (stop on breach; explain in the report)
    Container & model: M, mode:subagent, model: default (no path-derived mandate; dispatch-gates --tier), effort: high
    Clause-②: yes (widening)
    Metadata-protocol: none
    Responsibility: admin-set-user-manager refuses on sys_user.source idp_provisioned alone, which ADR-0135 D4 stamps on every SSO-only link (objectstack) | none | admins of hosted and self-hosted environments whose people sign in through SSO with no SCIM directory
    Thread-read: 6895645364
    Premise: holds (measured by the decision analysis 6877839375; the dev re-measures)
    Pre-claim lane: server because the fix is in packages/plugins/plugin-auth/**, packages/platform-objects/src/identity/** and packages/lint/**; no cloud code, no spec schema bit, no ADR text (⛔ ADR-0135 D4 unchanged per the ruling); the widening stays in this lane under the maintainer's same-lane rule and owes the Clause-② review at review-a.
    Pre-claim deps: #33181 closed; no Blocked-by; no open PR touches the surface; packages/lint/src/rule-explanations.ts is also on #33828's surface in this area (different rule entries; second to land merges main); #33268 hunks not touched.
    Prior rulings read: ruling 5651634638 (#16678) rows 2, 5, 7; cloud#4465 rulings 1, 9, 10 (via #33181 comment 6870710213); ADR-0135 D2, D4, D5.2; ADR-0092 D2/D5; ADR-0057 D3; ADR-0134; ADR-0068 — as listed in the ruling record 6895645364, which narrows row 5 by name; no opposing line left open.
    Serial constraints cleared: #33828 (this area, rule-explanations.ts shared, disjoint entries); #33696 / #33782 (plugin-security/plugin-sharing, disjoint)

  8. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 15, 2026
  9. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#5 · zhuangjianguo · session_01QsR2jVPGBoi3MCGoKbW1Hv
    os-dev-report

    {
     "issue": 33200,
     "status": "done",
     "branch": "claude/area-A1-33200",
     "pr": "https://github.com/objectstack-ai/objectstack/pull/33991",
     "session": "session_01QsR2jVPGBoi3MCGoKbW1Hv",
     "premise_still_valid": true,
     "summary": "Built to ruling record 6895645364 option A. applyUserManagerLink refusal 5 now refuses only an identity that reads source idp_provisioned AND owns a sys_scim_subject row, via isHeldByScimDirectory, a new export of scim-sso-adoption.ts (the adoption judge's condition-2 read moved into an exported function, which the judge now calls too). The source conjunct is kept, so no request that was served before is refused. A missing sys_scim_subject table reads as not held; any other read failure propagates and nothing is written. Set Manager visible is now the platform-admin standing alone (no derived flag exists). The lint prescription, the import docblock and three docs pages state the narrowed rule. The bulk import and demo-staff paths follow through the shared derivation; reason idp_provisioned and the 403 PERMISSION_DENIED envelope are unchanged.",
     "tests": "head fa70eaa06. plugin-auth full suite 276/277 files before the demo-staff fixture fix (the 1 red was demo-staff.test.ts, refusal fixture made SCIM-held in the next commit); demo-staff + demo-staff-provisioning 32/32 after it; targeted plugin-auth 3 files 76/76, platform-objects 2 files 169/169, lint 1 file 64/64; platform-objects full 122 files / 1994 tests; lint full 212 files / 9026 tests; runtime platform-admin-action-gate 16/16. Typecheck exit 0: plugin-auth (3 legs), platform-objects, lint. Ablations via ablation-replace.mjs, each restored to the HEAD blob: A1 refuse on source alone -> 7 red; A2 no refusal 5 -> 4 red; A3 SCIM row alone -> 1 red (env_native with subject); A4 swallow read failures -> 1 red; A5 source term back on visible -> 5 red; A6 old lint sentence -> 1 red; A7 missing table rethrows -> 1 red. src-resolved suites, no dist leg owed. NOT MEASURED: example-showcase author-time-advisories (cli not built: command validate not found), verify held-session-platform-admin pin (service-automation dist missing), dogfood set-user-manager files - prerequisites, left to CI.",
     "gates": "dispatch-gates --commands --repo objectstack-ai/objectstack at fa70eaa06: 105 derived; 101 exit 0; exit 3 PREREQUISITE NOT MET (NOT MEASURED): spec check:skill-examples, check:dual-build-cjs-loads, check:i18n; UNRUN: check:type-check-debt (verify lock held 60+ min by another run). --ran reconciliation agrees (1 UNRUN, 3 NOT-MEASURED). PR-body gates exit 0: check-changeset-no-major, check-adr-0087-registration, check-closing-keyword-parity, check-partof-closing-keyword. eslint on changed .ts exit 0; check-nul-bytes OK. --tier: no path-derived mandate, same as merged PRs 33646 and 33769. CI check-runs at report time: in_progress.",
     "dogfood_battery": "n/a - no ! in the PR title and no (narrowing) arm",
     "mcp_calls": "0",
     "api_writes": "2 - pr_create via fleet-write relay (POST pulls, PR 33991); this os-dev-report comment via post-stamped (POST issues/33200/comments)",
     "files_changed": [
      ".changeset/33200-set-manager-scim-held-only.md",
      "content/docs/automation/approvals.mdx",
      "content/docs/capabilities/approvals.mdx",
      "content/docs/permissions/authentication.mdx",
      "packages/lint/src/rule-explanations.ts",
      "packages/lint/src/validate-approval-approvers.ts",
      "packages/lint/src/validate-approval-approvers.test.ts",
      "packages/platform-objects/src/identity/sys-user.object.ts",
      "packages/platform-objects/src/identity/sys-user-set-manager-action.test.ts",
      "packages/platform-objects/src/platform-objects.test.ts",
      "packages/plugins/plugin-auth/src/admin-set-user-manager.ts",
      "packages/plugins/plugin-auth/src/admin-set-user-manager.test.ts",
      "packages/plugins/plugin-auth/src/admin-import-users.ts",
      "packages/plugins/plugin-auth/src/admin-import-users-manager-pass.test.ts",
      "packages/plugins/plugin-auth/src/scim-sso-adoption.ts",
      "packages/plugins/plugin-auth/src/demo-staff.test.ts"
     ],
     "line_budget": "398 changed lines (+302 / -96), 16 files, under the 3000 threshold; no skills/** touched",
     "deviations": [
      "surface: scim-sso-adoption.ts edited (pure extraction of the condition-2 read into exported isHeldByScimDirectory) - needed to import rather than copy the predicate as the dispatch asked; the claim names it as the predicate's source",
      "surface: plugin-auth demo-staff.test.ts edited (fixture made SCIM-held, +4/-3) - its refusal pin went red under the ruled change; a test of the changed refusal",
      "coordinator rule 1 (new tests in a new card-named file) not followed: AGENTS.md (ruling record 6583487846) puts a new pin for a component that has a shared harness file into that file as a top-level describe; the new pins sit in the existing harness files; merge-tree shows no textual overlap with origin/main, PR 33956, PR 33268 or branch claude/area-A2-33828",
      "verify lock held 60+ min by another run (issue-33696 round2.sh); after queue timeouts, the platform-objects and lint suites, the demo-staff re-run, typecheck and the plugin-auth build ran unlocked with maxWorkers=1 (declared narrowing)",
      "pnpm lint narrowed to eslint on the changed .ts files; the repo-wide run is CI's (os-dev local-verification scope)",
      "dependents: only the dependent tests that read the changed surfaces were run (runtime gate 16/16); 3 NOT MEASURED for missing builds, left to CI Test Core"
     ],
     "open_questions": [],
     "security_findings": "none",
     "out_of_scope_findings": [
      "carrier: card 33918 - SCIM manager projection onto manager_id (SCIM-held users stay unchangeable from both sides until it lands) - noted, not filed",
      "carrier: none - set_user_manager helpText lists four refusals and not the SCIM one; the endpoint message names the directory; changing helpText moves nine translation bundles - noted in Acceptance notes"
     ]
    }
  10. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#5 · zhuangjianguo · session_01QsR2jVPGBoi3MCGoKbW1Hv

    Claim amendment · #33200 · file surface · 2026-11-15T15:36Z

    File surface adds, as built in PR #33991: packages/plugins/plugin-auth/src/scim-sso-adoption.ts (the SCIM-held predicate moved into an exported function, judgeScimSsoAdoption reads it; no behaviour change there) and packages/plugins/plugin-auth/src/demo-staff.test.ts (4 lines: its refusal pin follows the ruling). Pins stay in the components' existing test files per AGENTS.md (ruling record 6583487846).
    Clause-②: yes (widening)
    Metadata-protocol: none

  11. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#5 · zhuangjianguo · session_01QsR2jVPGBoi3MCGoKbW1Hv

    Landed: PR #33991 merged as fb79d47; card closed by its Fixes line. The SCIM manager projection stays with #33918. pm:dispatched removed · 2026-11-15T18:00Z

  12. removed
    pm:dispatched
    on Nov 15, 2026
  13. added a commit that references this issue on Nov 16, 2026
    fb79d47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

domain:serverpriority:p1

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions