Skip to content

SCIM: a PATCH that replaces only name.givenName / name.familyName leaves displayName and sys_user.name on the old name #32380

Open

Description

@os-bob

Edition / version

ObjectOS Enterprise, framework pin e24136c2 (@better-auth/scim 1.7.12). Local SCIM run for objectstack-ai/cloud#3667.

Measured

  1. A user whose display name is "Renamed InOkta" gets PATCH /Users/{id} with Entra's path-addressed shape: [{"op":"Replace","path":"name.givenName","value":"Entra"},{"op":"Replace","path":"name.familyName","value":"Style"}]. The answer is 200, but:
    • name.givenName / familyName change;
    • displayName, name.formatted and sys_user.name (what the console shows) keep "Renamed InOkta".
  2. Okta's path-less replace ({"op":"replace","value":{"name.givenName":…,"name.familyName":…}}) behaves the same.
  3. Only a PATCH of displayName, or a full PUT, moves sys_user.name.

The cause is vendor behaviour: setNamePart stores the part and never recomposes formatted / displayName. The code has a composeName helper, which only the remove path uses.

Impact

Low while the IdP also sends displayName, as Entra's default mapping does when that attribute changes. A tenant whose mapping sends only given/family name keeps showing the old name in ObjectOS indefinitely.

Expected

When displayName / formatted were derived from the parts (the same test setFormattedName already makes), recompose them after a part changes. Either upstream it to @better-auth/scim, or apply it in the host's identity.reconcileUser before the user row is written.

Activity

  1. added
    bug
    finding
    domain:server
    on Nov 11, 2026
  2. objectstack-fleet commented on Nov 11, 2026

    @objectstack-fleet
    Contributor

    triage#1 · os-zhuang · session_01AavokzJ5DndAwitDXvKy4U

    Path: none

    Triage: finding promoted → domain:server · p3 · pm:queue · 2026-11-11T01:55Z

    ⛔ Not a claim.

    • Lane: domain:server (the host's SCIM reconcile in plugin-auth). The vendor fix goes upstream to @better-auth/scim. Measured during cloud#3667's local SCIM run.
    • Grade: p3 as filed. Entra's default mapping sends displayName with the parts, so only a tenant mapping that sends only given or family name sees a stale name. It is not a security hole: no identity, grant or account state is wrong, only the display name.

    Generated by Claude Code

  3. added
    pm:queue
    and removed
    finding
    on Nov 11, 2026
  4. objectstack-fleet commented on Nov 11, 2026

    @objectstack-fleet
    Contributor

    domain:server#4 · os-lizheng · session_012MmDsNv6qb5gT8Pd98AmCB

    Claim: PM loop round 1
    Session: session_012MmDsNv6qb5gT8Pd98AmCB
    Account: os-lizheng (the seat's linked user as GET /user answers it; the card's assignee)
    Branch: claude/issue-32380-scim-name-recompose
    Worktree: objectstack-issue-32380
    Domain: domain:server
    Seat: domain:server#4
    File surface: packages/plugins/plugin-auth/src/** — the host's SCIM identity.reconcileUser path (auth-manager.ts reconcileScimUserLifecycle and the helper it calls), a new or existing SCIM test file beside scim-deactivation-reconcile-user.test.ts; root .changeset/. ⛔ objectql-adapter.ts (#32388 in flight), pnpm-workspace.yaml / vendor patches, ui/**, skills/**, docs/adr/** (stop on breach; explain in the report)
    Container & model: M, mode:subagent, model: default tier — dispatch-gates --tier: no path-derived mandate, effort: high
    Clause-②: no
    Metadata-protocol: none
    Responsibility: @better-auth/scim setNamePart (vendor) never recomposes; the host half identity.reconcileUser in objectstack plugin-auth | none | a tenant whose IdP mapping sends only given/family name; Entra's default mapping does not hit it
    Thread-read: 6784696655
    Premise: holds (re-read on origin/main 7d82b2d at 2026-11-11T12:56Z)
    Serial constraints cleared: #32388 (seat 3) edits plugin-auth/src/objectql-adapter.ts only — excluded from this surface

  5. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 11, 2026
  6. objectstack-fleet commented on Nov 11, 2026

    @objectstack-fleet
    Contributor

    domain:server#4 · os-lizheng · session_012MmDsNv6qb5gT8Pd98AmCB
    os-dev-report

    {
      "issue": 32380,
      "status": "needs_decision",
      "branch": "claude/issue-32380-scim-name-recompose",
      "pr": null,
      "session": "session_012MmDsNv6qb5gT8Pd98AmCB",
      "premise_still_valid": true,
      "summary": "Defect reproduced on origin/main 7d82b2da with @better-auth/scim 1.7.12, both PATCH shapes, through AuthManager.handleRequest with a real SCIM bearer: a user provisioned with givenName Renamed / familyName InOkta (displayName and name.formatted DERIVED = 'Renamed InOkta') gets PATCH name.givenName=Entra, name.familyName=Style (Entra path-addressed, and Okta path-less) → 200, parts move, but the SCIM resource displayName, name.formatted and sys_user.name all stay 'Renamed InOkta'. The ruled lane (the host's identity.reconcileUser) cannot tell derived from explicit, so per the dispatch's Zone 2 stop condition no code was written: measured inside the callback, the vendor has ALREADY written both the sys_user row (name = the unchanged old displayName, updateManagedBetterAuthUser) and the scimUser row (NEW parts, OLD displayName/formattedName) before it calls reconcileUser, and SCIMIdentityState carries only userId/active/profileSourceId/sources; the OLD parts are gone. The control proves the ambiguity: an IdP-explicit displayName 'Bob B' (parts Robert Smith) after PATCH givenName=Rob reaches the callback as displayName=formattedName='Bob B', parts Rob/Smith — the same shape as the derived case, so any rule there either overwrites an explicit name (forbidden) or fixes nothing. Second measurement kills the Zone 3 route outright: a host write of sys_user.name alone ('Entra Style') is reverted by the very next unrelated changing PATCH (title=Engineer → sys_user.name back to 'Renamed InOkta'), because the vendor rewrites name from its own stored scimUser.displayName on every profile-source PATCH. Mechanism correction to the card's Expected: reconcileUser does not run 'before the user row is written' — it runs after. The fix has to change the vendor's scimUser state (upstream setNamePart, or a host pre-image hook that rewrites vendor rows); that is a fork, analysed in open_questions.",
      "tests": "No code change, so no package test run is owed. Evidence runs (a temporary probe test, deleted, never committed; copy kept at the seat scratchpad issue-32380/zz-probe-32380.test.ts): `pnpm --filter @objectstack/plugin-auth exec vitest run --maxWorkers=2 src/zz-probe-32380.test.ts` under os-verify-lock, both runs `VERDICT command-exit 0`, Tests 2 passed (2), tree 7d82b2da. Readings: 'entra PATCH 200 Renamed InOkta {formatted:Renamed InOkta, givenName:Entra, familyName:Style}', 'entra sys_user.name Renamed InOkta'; same three lines for okta; reconcile callback saw src {displayName:'Renamed InOkta', formattedName:'Renamed InOkta', givenName:'Entra', familyName:'Style'}, user.name 'Renamed InOkta'; 'HOSTFIX sys_user.name after simulated host write Entra Style' then 'HOSTFIX unrelated PATCH 200 sys_user.name now Renamed InOkta'; 'EXPLICIT CREATE 201 Bob B {formatted:Bob B, givenName:Robert, familyName:Smith}', 'EXPLICIT PATCH 200 RECONCILE SAW [{displayName:Bob B, formattedName:Bob B, givenName:Rob, familyName:Smith}]'. Vendor source read: node_modules/@better-auth/scim/dist/index.mjs setNamePart (stores the part only), composeName (used only by name.formatted remove), setFormattedName (displayName===formattedName test), PATCH handler order updateManagedBetterAuthUser → trx.update scimUser → projection.reconcileUser → identity.reconcileUser. Ablation: n/a (no tested behaviour changed).",
      "gates": "No diff: `node scripts/pm/dispatch-gates.mjs --commands` exit 2 — 'this branch changes nothing against origin/main (merge base 7d82b2dab) — nothing to derive'. No local gate owed; no PR, so no check-runs. Only build run: `pnpm --workspace-concurrency=2 --filter '@objectstack/plugin-auth^...' build` under the lock, VERDICT command-exit 0. pnpm lint not run (no diff).",
      "dogfood_battery": "n/a — no PR, no `!` in any title and no (narrowing) arm",
      "mcp_calls": "0",
      "api_writes": "1 — POST issues/32380/comments (this os-dev-report, via scripts/pm/post-stamped.mjs). Plus 1 git push (empty claimed branch claude/issue-32380-scim-name-recompose at 7d82b2da, the routing probe). pr_create: 0.",
      "files_changed": [],
      "line_budget": "n/a — no diff",
      "deviations": "Stopped before code per the dispatch's Zone 2 stop condition (host reconcile cannot see enough to tell derived from explicit). Zone 2 assumption 'reconcileUser runs before the user row is written' (card Expected) measured false. Zone 3 route measured unstable (host-only sys_user.name write is reverted by the next unrelated PATCH). The empty branch stays pushed at 7d82b2da for a resume.",
      "open_questions": [
        {
          "question": "Where should the recompose of displayName / name.formatted after a name-part PATCH live, given the host's identity.reconcileUser sees only the post-image (new parts, old displayName/formatted; old parts already overwritten) and a host-only sys_user.name write is reverted by the vendor on the next PATCH?",
          "options": [
            "A — Upstream only: a PR to @better-auth/scim making setNamePart recompose formattedName (and, through setFormattedName, displayName) when formattedName === composeName(state) BEFORE the part changes — the same derived test the card names. Host change: none now; a dependency bump when the vendor releases, plus a pin in plugin-auth that both PATCH shapes move sys_user.name and an explicit displayName survives. Business need: measured pull is one local SCIM run (cloud#3667) and a tenant mapping that sends only given/family name; Entra's default mapping sends displayName, so waiting costs little. Long-term: fixes the producer (the vendor's state machine), so the SCIM resource, the vendor row and sys_user.name all converge and stay converged. AI-error resistance: one owner, no host shadow of vendor logic. No scope creep: zero host surface, no gate. Cost: ~10 vendor lines + a vendor test; release latency is outside our control. Effort S (plus an S bump PR later).",
            "B — Host pre-image hook: add a user.update.before database hook (fires inside the SCIM transaction from updateManagedBetterAuthUser, before the vendor's scimUser update, and only for the profile source) that stashes the source's OLD parts/formatted/displayName on the SCIM request scope; reconcileUser then compares pre and post and, when derived, rewrites the vendor's sys_scim_user row (displayName, formattedName, and name.formatted inside serializedAttributes JSON) and sys_user.name. Business need: same thin pull as A. Long-term: a consumer-side workaround of a producer defect, coupled to the vendor's private storage format (column semantics + serialized JSON) and to its call order — breaks silently on a vendor refactor; uses reconcileUser outside its declared contract ('reconciles global enabled or disabled state'). AI-error resistance: poor — hidden cross-hook state is exactly what later agents misread. Scope: adds a new host seam beside a path with open security findings (#32113, #32115). Mechanism of the before-hook firing inside the transaction is read from vendor source, not measured. Effort M-L (~200 lines + two-shape pins + controls + ablation).",
            "C — A, plus an interim pnpm patch of the vendor dist carrying the same setNamePart change until the release, removed on the bump. Same axes as A, with a short-lived vendor patch (maintainer-owned surface: pnpm-workspace.yaml / patches, excluded from this claim). Effort S.",
            "D — Close the host half as won't-fix-in-host and leave the card tracking only the upstream fix (no host PR at all). Same as A minus the later pin PR."
          ],
          "recommendation": "A, because the defect is in the producer (vendor setNamePart) and the host cannot fix it soundly from the ruled lane: the reconcile callback sees no pre-image, and a host-only sys_user.name write is reverted by the vendor's next PATCH. A keeps contract-first and adds no host surface; the measured business pull is thin (p3, Entra's default mapping unaffected), so the release latency is acceptable. C only if the maintainer wants it now and accepts a vendor patch; B is not recommended (consumer-side workaround over vendor-private storage)."
        }
      ],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: this card (#32380) — the upstream @better-auth/scim PR (setNamePart recompose when formatted was derived from the parts) is owed under option A/C; it is a vendor-repo PR, not filed here. Dedupe words: scim setNamePart composeName displayName formatted recompose",
        "carrier: none — the card's Expected wording 'apply it in the host's identity.reconcileUser before the user row is written' is mechanically false on 1.7.12 (the callback runs after updateManagedBetterAuthUser and after the scimUser update); noted for the seat's re-read, not filed."
      ]
    }
  7. objectstack-fleet commented on Nov 11, 2026

    @objectstack-fleet
    Contributor

    domain:server#4 · os-lizheng · session_012MmDsNv6qb5gT8Pd98AmCB

    需裁决 · 待维护者 · 2026-11-11T13:14Z

    Release: claim 6796434983 (session_012MmDsNv6qb5gT8Pd98AmCB, domain:server#4) · cause: dev needs_decision (report 6796756062), nothing landed
    Resume-from: claude/issue-32380-scim-name-recompose@7d82b2da (empty branch)

    一句话问题: 企业的身份系统(Okta、Entra)只改了某位员工的「名」或「姓」时,ObjectOS 里显示的仍是旧名字。在本平台这一侧无法安全地修复,因为平台看不出这个显示名原本是由姓名拼出来的,还是管理员特意设的。

    背景: dev 在 origin/main 7d82b2d(@better-auth/scim 1.7.12)上用真实 SCIM 令牌复现了两种 PATCH 形状。名字的各部分改了,但 displayName、name.formatted 和 sys_user.name 不变。席位在 vendor 源码里复读(dist/index.mjs):setNamePart 只是 state[attribute] = value,不重新拼名。PATCH 依次执行 updateManagedBetterAuthUser → 更新 scimUser → identity.reconcileUser。所以宿主的回调运行时,旧的姓名各部分已经被覆盖了。卡上 Expected 写的「在写用户行之前」与实测不符。dev 还测了第二点:宿主单独改写 sys_user.name,下一次无关的 PATCH(例如改 title)会把它写回旧名。

    Governing text: AGENTS.md L200 "No workarounds. Adopt sustainable, well-architected solutions — not temporary patches."(git grep -n "No workarounds" origin/main -- AGENTS.md,对照词 Post-Task Checklist)。分诊 6784696655:"not a security hole … only the display name"。是否改协议:否,不涉及元数据契约。

    前提与复核命令:

    • vendor 不重新拼名:grep -n "function setNamePart" -A2 <scim dist>/index.mjs → 函数体只有一行赋值(对照词 composeName)。
    • 回调在两次写之后运行:grep -n "updateManagedBetterAuthUser(\|identity.reconcileUser(" <scim dist>/index.mjs,看前者的行号是否小于后者。
    • 回调拿不到旧的姓名各部分:SCIMIdentityState 只有 userId、active、profileSourceId、sources(dev 探针 zz-probe-32380.test.ts,未提交)。
    选项 做什么 客户可感知后果 工作量
    A 向 @better-auth/scim 提上游 PR:setNamePart 在原名是由姓名拼出时重新拼名;vendor 发版后本仓升级依赖,并加 pin 只发「名/姓」的租户要等 vendor 发版才能修好;Entra 默认映射本来不受影响 server · 上游 1 个 PR,加本仓 1 个升级 PR · 无先例
    B 宿主在事务里加一个 before 钩子记下旧名,再在 reconcileUser 里改写 vendor 的 sys_scim_user 行和 sys_user.name 现在就修好,但依赖 vendor 的私有存储格式和调用顺序,vendor 一升级就可能静默失效 server · 1 个 PR,约 200 行(dev 估算,未测)· 无先例
    C A,再加一个临时的 pnpm patch 改 vendor 的 dist,vendor 发版后删掉 现在就修好;要维护一个临时补丁,补丁面归维护者 server · 2 个 PR · 无先例
    D 不做宿主这一半,本卡只跟踪上游修复 同 A,只是没有本仓的回归 pin 零

    业务含义直译: A = 请供应商修自己的零件;B = 在我们这边加一层转换来遮住零件的毛病;C = 先临时打个补丁,等正式件到了再拆;D = 只记账,不动手。

    四维(业务立场):

    os-decision-facets
    ① 长远:A 缩小特例(修在生产方),B 扩大(消费端复刻 vendor 逻辑),C 同 A 外加一个临时件,D 中性。
    ② 拉动:今天只有只映射名/姓的租户会撞上,实测一次(cloud#3667),Entra 默认映射不撞。
    ③ 防错:A 单一归属方;B 静默不一致,出错时看不出来。
    ④ 不扩散:A、D 零新增宿主面;B 新增钩子接缝;C 新增临时补丁面。
    Prior rulings read: scim name displayName recompose reconcileUser → 0 hits on rulings in plugin-auth/src scope (auth-manager.ts holds 73 ruling/⛔ markers, none on SCIM name composition); ADR none; thread: none

    推荐:A。 只看①选 A;②③④ 是否翻转:否。置信缺口:vendor 是否接受 PR、何时发版,本席不可控。C 是在 A 之上的提速选项,只有维护者要立即修好、并接受临时补丁时才取。不取 B,因为它属于绕行。不取 D,因为升级后应有回归 pin。

    裁后执行段: 选 A:dev 起草上游 PR 文本和 vendor 测试,由维护者或有该仓权限的人提交;本卡转 pm:on-hold,Restart-when: 写「@better-auth/scim 发布含该修复的版本」,唤醒后派一个 S 级升级+pin 的 PR。选 C:另加维护者批准的 patch PR。选 B:按 dev 方案派 M-L 卡,先实测 before 钩子是否在事务内触发(dev 未测)。

  8. added
    needs-user-decision
    and removed
    pm:dispatched
    on Nov 11, 2026
  9. objectstack-fleet commented on Nov 13, 2026

    @objectstack-fleet
    Contributor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Brief-claimed-by: session_01Q4EjjMnyLqJdzuktEmRPXH · batch #3 · 2026-11-13T05:26Z

    Decision batch #3 (the last four of the box), on the maintainer's 「5张一批按总监决裁格式给我」.

  10. objectstack-fleet commented on Nov 13, 2026

    @objectstack-fleet
    Contributor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Ruling recorded · #32380 · C (upstream fix, and a temporary patch now) · 2026-11-13T05:47Z

    Maintainer, verbatim (triage#1 session): 「创业项目,应该是需求合理就做」, then 「第三批同意」, approving the batch as revised under that principle: 32380 C / 31797 C / 32678 B / 32679 B + one-click reset. The batch was analysed independently at the fable tier, with prior rulings checked first.

    • C: fix it now and fix it at the source.
      • (1) The domain:server lane drafts the upstream PR to @better-auth/scim (recompose displayName / name.formatted when it was derived from the name parts, plus the vendor test) from the kept branch claude/issue-32380-scim-name-recompose. The maintainer, or someone with access to that repo, submits it; agents cannot.
      • (2) A temporary pnpm patch on the vendor package makes a name-only PATCH recompose the display name today, with a regression test for both PATCH shapes.
      • (3) When the vendor ships the fix, the patch is removed in the upgrade PR and the regression test stays.
    • On the AGENTS.md conflict: 「No workarounds … not temporary patches」 is set aside here by the maintainer's ruling for this card only. The patch carries a header naming this ruling and its removal condition, and patches/ gains no other better-auth patch.
    • Neighbour: the patch touches the SCIM name path only, not the callback hooks near open p1 security card plugin-auth SCIM: re-activating a deactivated user (active: true) brings back the API keys and local password from before the deactivation #32115.
    • Execution: needs-user-decision → pm:queue. The cloud SCIM doc's known-issue line is no longer needed once the patch lands.

    Generated by Claude Code

  11. added
    pm:queue
    and removed
    needs-user-decision
    on Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:databugdomain:serverpm:queuepriority:p3

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions