Repository navigation
Commit c41b6ca
docs(permissions): a three-officer split keeps the auditor's set outside the organization boundary (#34880)
Refs #34700 (item 2)
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 改了什么:在委派管理文档里写明「三员分立」规则——审计员的权限集须带一个平台级能力,使其落在组织边界之外;并在
plugin-security 加 12 条真实引擎钉子测试。无源码改动。
- 为什么改:按维护者裁决 E,只写文档、不改契约;同时补一次裁决所欠的实测:委派管理员的白名单路径对这类权限集照旧放行或拒绝。
- 风险与回滚:只有文档与测试,运行时零变化;回滚即撤销本 PR。测试文件仍在原 20 秒预算内(按共享机比例推算 19.0 秒)。
- 先看:`content/docs/permissions/delegated-administration.mdx`
新增的「Separation of duties: the three-officer split」一节;其次是
`org-admin-assignment-boundary.posture.test.ts` 末尾新的 describe 及其期望矩阵
`OFFICER_EXPECTED`。
- 两分钟验证:`pnpm --filter @objectstack/plugin-security exec vitest run
--maxWorkers=2 src/org-admin-assignment-boundary.posture.test.ts -t
three-officer`,预期 12 passed。
- 需要你做的:无,席位落地。
## What changes
- **Docs** (`content/docs/permissions/delegated-administration.mdx`): a
new section, *Separation of duties: the three-officer split*, and one
row in the gate table for the organization administrator's own right.
The rule it teaches: in a three-officer split the auditor's set carries
a platform-scoped capability, which keeps it outside the organization
boundary, so only a delegated scope whose allowlist names the set, or
the platform administrator, adds or removes its holders. It lists the
four boundary conditions (ADR-0090 D12, as amended), shows an
app-declared capability (whose `scope` defaults to `platform`) and the
built-in `setup.access` as the two ways to carry one, and states the
ceiling: the platform administrator can still assign any set, the
auditor's included.
- **Tests**
(`packages/plugins/plugin-security/src/org-admin-assignment-boundary.posture.test.ts`):
a new top-level describe in the existing posture harness (real ObjectQL
engine over a real SQL driver, real `SecurityPlugin`, the protocol's
bulk delete door), postures `single` and `isolated`. Three auditor
variants (org-scoped only, plus `setup.access`, plus an app-declared
capability) against six callers, four write shapes each (a direct grant,
its removal by id, its removal through the bulk delete door, a position
holding added and removed). No source file changes.
## Tests
The expected matrix, every cell asserted on its ADR-0112 envelope and on
the stored rows:
| Caller | + `setup.access` | + app-declared capability |
|---|---|---|
| organization administrator (both sets) | `403 PERMISSION_DENIED`,
naming the set | `403 PERMISSION_DENIED`, naming the set |
| delegate whose allowlist leaves the auditor set out | `403
DELEGATION_SCOPE_VIOLATION` | same |
| the same delegate, also an organization administrator | `403
DELEGATION_SCOPE_VIOLATION` | same |
| delegate whose allowlist names the auditor set, with or without the
organization administrator's set | admitted | admitted |
The control variant, an auditor set carrying only the org-scoped
`view_all_audit_log`, sits inside the boundary and is judged by the
organization administrator's right as ADR-0090 D12 (as amended) states
it, and by the allowlist on the delegated path; it proves each refusal
above is caused by the platform-scoped capability.
The last two rows are the owed measurement: the delegated allowlist path
admits and refuses a set carrying a platform-scoped capability exactly
as it does the org-scoped one.
<details><summary>Run on head 4dc3566</summary>
```
pnpm --filter @objectstack/plugin-security exec vitest run --maxWorkers=2 --reporter=verbose src/org-admin-assignment-boundary.posture.test.ts
Test Files 1 passed (1)
Tests 104 passed (104)
os-verify-lock: VERDICT command-exit 0
pnpm --filter @objectstack/plugin-security typecheck (tsc, scripts project, check:test-typecheck)
check:test-typecheck: OK — 0 file(s) / 0 error(s)
os-verify-lock: VERDICT command-exit 0
```
</details>
<details><summary>Mutation proof (one-off, restored)</summary>
The boundary's capability-scope condition was disabled in place
(`scripts/ablation-replace.mjs`, anchor hit 1 time, blob changed) and
only the new describe was run: 6 failed, 6 passed — exactly the cases
whose caller holds the organization administrator's set; the
pure-delegate cases stayed green, as the matrix predicts. Restored: blob
equals HEAD and `git diff HEAD` is empty.
</details>
<details><summary>Test budget</summary>
The file keeps `test-budget: 20`. On one shared box the tests phase
reads 29.0 s with the new cases and 20.8 s without them (ratio 1.39);
the twelve cases share one boot per posture and remove every row each
wrote. The last CI reading, 10.9 s, projects to 15.2 s, 19.0 s with the
1.25 headroom. The REASON line carries this reading.
</details>
## Acceptance notes
- Two existing docs lines predate the ADR-0090 D12 amendment and still
say the organization administrator's set is read-only on the RBAC
tables: `content/docs/permissions/authorization.mdx` (the
anti-escalation paragraph) and the `organization_admin` row of the
built-in sets table in `content/docs/permissions/permission-sets.mdx`.
The shipped set grants create and delete on both assignment tables. Not
changed here; noted for the docs lane.
- No changeset: the diff is a docs page and a test file;
`plugin-security` publishes `dist`, `README.md` and `CHANGELOG.md` only,
so nothing a package ships changes (`skip-changeset`).
## Verification
<details><summary>Local gate subset (dispatch-gates --commands, head
4dc3566)</summary>
- `node scripts/pm/dispatch-gates.mjs --commands` derived 85 families
for the 2 changed paths (the list is identical after a fresh fetch of
`origin/main`). Ran all 85 with exit codes captured before any pipe: 81
exit 0, 4 exit 3 (prerequisite not met, read as NOT MEASURED, left to
CI):
- `node scripts/check-plugin-teardown-shape.mjs --self-test`: its
positive control is pinned to a commit this shallow clone cannot reach;
- `pnpm --filter @objectstack/spec run check:skill-examples`, `pnpm
check:dual-build-cjs-loads`, `pnpm check:i18n`: each reads built output
of packages outside this diff's build closure.
- `dispatch-gates --ran` with the exit-annotated record: `85 derived
famil(ies) accounted for — 81 run, 4 NOT-MEASURED (4 DERIVED from a
recorded exit 3)`.
- The last commit (ee854bc) changes one docs paragraph only; the 41
derived families that read docs, ADR links, citations and wording were
re-run on it: 41 of 41 exit 0. The test file is unchanged since
4dc3566, where it ran.
- Every family CI runs is read from this PR's check-runs, not re-run
here.
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_012MmDsQg43GaB78K8X6U1sL)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 0ee43d6 commit c41b6ca
2 files changed
Lines changed: 259 additions & 10 deletions
File tree
- content/docs/permissions
- packages/plugins/plugin-security/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
84 | 85 | | |
85 | 86 | | |
86 | 87 | | |
87 | 88 | | |
88 | 89 | | |
89 | 90 | | |
90 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
91 | 160 | | |
92 | 161 | | |
93 | 162 | | |
| |||
0 commit comments