You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ea03c7c
Browse filesBrowse the repository at this point in the historyBrowse files
fix(plugin-approvals): screen expanded business-unit members to the directory organization (#14946) (#15912)
* test(plugin-approvals): pin the business-unit MEMBER org screen (#14946) — red against the unmodified service
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ARYe3yQTQCUFm5qPYNgKaJ
* fix(plugin-approvals): screen expanded business-unit members to the directory organization (#14946)
`expandBusinessUnitUsers` screened the unit rows with the null-inclusive
`businessUnitOrgScope` (#3807) but read `sys_business_unit_member` with no
organization predicate, under SYSTEM_CTX which carries no tenant. A seeded
unit id exists in every tenant, so tenant A's department approver resolved
tenant B's members. The member read now carries a strict organization_id
equality (`businessUnitMemberScope`): the column is injected and only the
session write path fills it, so NULL means unknown tenancy, not global.
Existing fixtures that pinned org-less membership rows on stamped or seeded
units are re-anchored onto stamped rows; the org-less case is pinned on its
own (B3) as the declared, loud cost.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ARYe3yQTQCUFm5qPYNgKaJ
* test(plugin-approvals): judge the #14946 fake engine's find bound by presence; re-anchor the system-context page; ledger the new pin file
- the fake engine's `find` no longer reads `this` (the objectql-double-limit
probe calls it unbound) and applies the caller's bound after the filter, by
presence, instead of a default page of 1000
- content/docs/permissions/system-context.mdx: six approval-service.ts line
anchors re-aimed by +57, the net insertion of the businessUnitMemberScope
docblock above them (check-system-context-census --fix)
- engine-double-contract ledger learns business-unit-member-org-screen.test.ts
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ARYe3yQTQCUFm5qPYNgKaJ
---------
Co-authored-by: Claude <noreply@anthropic.com>
Fix: a `department` approver on a seeded business unit no longer routes the approval to another organization's members.
6
+
7
+
`ApprovalService.expandBusinessUnitUsers` screened the `sys_business_unit` rows with the null-inclusive tenant predicate (#3807 — a seeded unit carries no organization and is admitted on purpose) but read `sys_business_unit_member` with no organization predicate at all, under a system context that carries no tenant either. A seeded unit id exists identically in every tenant, so a `department:<id>` approver on tenant A's request resolved the shared unit and then collected every tenant's membership rows hanging off it — approval authority over A's record, routed to B's users. The member read now carries a strict `organization_id` equality against the directory organization the approver resolves in: the same screen `plugin-sharing` applies to these rows, and the same posture this package already takes for `sys_team_member` and `sys_user_position`.
8
+
9
+
The screen is strict rather than null-inclusive on purpose. `sys_business_unit_member.organization_id` is filled by REST/session writes but left NULL by seed replay and by elevated system-context writes (tracked in #14570), so a NULL on a membership row means unknown tenancy, not "platform-global", and routing fails closed on it. Declared cost: on a deployment whose membership rows (not merely its units) were seeded or system-written, a `department` approver on a request that carries an organization now expands to nobody — the slot falls to the `department:<id>` literal, the existing `expanded to nobody` warning (#3807) names it, and `onEmptyApprovers` governs the request as for any unstaffed target. The repair is to stamp those membership rows. A request that carries no organization is unchanged, and so is every unit-level screen.
Copy file name to clipboardExpand all lines: content/docs/permissions/system-context.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -145,7 +145,7 @@ The largest single consumer — **17 of the 105 sites**.
145
145
|:--|:---|:---|:---|:---|
146
146
| 40 |**Approval record lock released** — a locked record is writable | plugin-approvals | Get: engine self-writes (the status mirror) pass. Lose: the lock that stops edits while an approval is live. Note there is deliberately **no admin exemption** here — only `isSystem`|`lifecycle-hooks.ts:347`|
147
147
| 41 | Delegation write guard bypassed | plugin-approvals | Get: service / seed / import may write delegation rows naming another delegator |`lifecycle-hooks.ts:570`|
148
-
| 42 | Approval actor / submitter / pending-approver checks bypassed (8 sites) | plugin-approvals | Get: approve, reject, recall, reassign without being a pending approver or the submitter |`plugin-approvals/src/approval-service.ts:963`, `:1072`, `:3248`, `:3396`, `:3564`, `:3635`, `:3824`, `:3864`|
148
+
| 42 | Approval actor / submitter / pending-approver checks bypassed (8 sites) | plugin-approvals | Get: approve, reject, recall, reassign without being a pending approver or the submitter |`plugin-approvals/src/approval-service.ts:963`, `:1072`, `:3305`, `:3453`, `:3621`, `:3692`, `:3881`, `:3921`|
149
149
| 43 | Saved-report ownership is **assignable**, and an update may reassign it | plugin-reports | Get: `ownerId` from input is honoured. A non-system caller always owns what it creates and can never reassign |`plugin-reports/src/report-service.ts:404`, `:425`|
0 commit comments