Skip to content

Commit 15ed46b

Browse files
committed
Merge origin/main into the AI family branch
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5pr7Ua2kPRCMZNupZg
2 parents 55c7023 + e735425 commit 15ed46b

49 files changed

Lines changed: 2058 additions & 121 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
'@objectstack/core': patch
3+
'@objectstack/plugin-security': patch
4+
'@objectstack/rest': patch
5+
'@objectstack/client': patch
6+
---
7+
8+
feat(security): read one user's effective permission sets, each with where it comes from
9+
10+
Clause-②: yes
11+
Metadata-protocol: none
12+
13+
A user page could list only the permission sets stored as that user's own grant rows. Sets that arrive through the `everyone` default binding or through a held position were never rows, so a user who holds plenty of access through defaults and positions showed none. Now one read lists them all, each with its origins.
14+
15+
- **`GET /api/v1/security/users/:id/effective-access`** (`@objectstack/rest`, beside `security/explain`) answers the spec's `EffectiveAccess`: the user, the organization it was resolved in, the positions held there, and the permission sets in force, each listed once with every origin it arrives through (`direct`, `position` with the position's name, `default`, or `derived` with its standing). It takes no query parameter: one is refused `400 VALIDATION_ERROR` naming it. A deployment whose security service does not serve the read answers `501`.
16+
- **Who may read whom is explain's caller gate**, now one function both reads call (`mayDescribeAnotherUser` in `@objectstack/plugin-security`): your own access always; someone else's with `manage_users`, as the organization administrator of an organization they belong to, or with a delegated `adminScope` covering them. An id no user has is refused with the same `403 PERMISSION_DENIED`, word for word, as a user you may not manage, for every caller. This is where the read differs from `security/explain`, which answers an admitted caller `404` for an unknown id.
17+
- **`ISecurityService.describeEffectiveAccess`** is served by `@objectstack/plugin-security`. The origins come from the resolver itself: `resolveUserAuthzGrants` (`@objectstack/core`) takes a new `withPermissionOrigins` option and returns `permissionOrigins`, recorded where each name is derived. Asking for it is a fresh resolution, like explain's. A resolution that does not ask returns the same envelope as before, from the same reads.
18+
- **`client.security.describeEffectiveAccess(userId)`** (`@objectstack/client`) returns `EffectiveAccess`.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
'@objectstack/metadata-protocol': patch
3+
'@objectstack/runtime': patch
4+
---
5+
6+
fix(metadata-protocol,runtime)!: the in-process uninstall verb is refused while an active validation rule reads a field the package adds through `objectExtensions`
7+
8+
Clause-②: yes (narrowing) — `protocol.deletePackage` now refuses, with `409 PACKAGE_DISABLE_RESTRICTED_BY_VALIDATION_RULE`, an uninstall it used to perform for an in-process caller: one whose package adds a field through `objectExtensions` that an active validation rule of another enabled package reads.
9+
Metadata-protocol: none
10+
11+
<!-- adr-0087: not-required (no-migration-prescription) No key of any schema is added, removed, renamed or re-shaped, and no stored row changes shape: what moves is the uninstall verb's answer to a request that would leave a validation rule reading a withdrawn field. Nothing at rest records that answer, so there is nothing for a migration to rewrite. -->
12+
13+
**BREAKING** accept-set narrowing at the uninstall verb (`@objectstack/metadata-protocol`, `@objectstack/runtime`): `deletePackage` asks every registered pre-uninstall guard before it reads or moves anything, and the runtime registers the dependent-rule check the package doors ask as one.
14+
15+
- **Before.** An in-process caller of `protocol.deletePackage` (a host's own uninstall tool, install-local's pair-install undo, the unmanaged-import rollback) withdrew the package's `objectExtensions` fields with no check. Another enabled package's active validation rule that read one of those fields then failed closed, so every write to that rule's object answered `400 VALIDATION_FAILED`, and with the package gone there was nothing left to re-enable.
16+
- **Now.** While such a rule exists, `deletePackage` throws before it reads or moves anything: an error with `code` `PACKAGE_DISABLE_RESTRICTED_BY_VALIDATION_RULE`, `status` `409`, and the package doors' sentence in its uninstall form under the lead `Package 'ID' cannot be uninstalled` (`… which the uninstall would withdraw — PACKAGE · OBJECT · RULE (reads FIELD). Switch off or change that rule first, or keep the package installed.`), naming every such rule with the fields it reads. `DELETE /api/v1/packages/:id` answers the same refusal through the same function, so the door and the verb cannot drift. The stored rows, the running registry, the environment's disable record and the uninstall cleanups are untouched. An uninstall no rule depends on, and an uninstall of a package that is already disabled, proceed exactly as before.
17+
- **The seam.** `ObjectStackProtocolImplementation#registerUninstallGuard(name, guard)` is the before-half of `registerUninstallCleanup`: a guard answers `undefined` to let the uninstall proceed, or `{ code, status, message }` to refuse it; guards are asked in registration order and the first refusal is thrown; a guard that throws refuses with its throw. The types `UninstallGuard` and `UninstallGuardRefusal` are exported from `@objectstack/metadata-protocol`. A protocol with no guard registered uninstalls exactly as before. `AppPlugin` registers the runtime's guard (`runtime.package-dependent-rules`) at start, beside the disable-record clear.
18+
- **Who moves.** An in-process caller that uninstalls a package whose field another package's active rule reads. The pair-install undo and the unmanaged-import rollback report the refusal as residue in their own failure answer, as they report any refused uninstall.
19+
20+
**The remedy.** Switch off or change the rules the message names first (a packaged rule can be switched off through the tenant overlay), then uninstall.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@object-ui/console': patch
3+
---
4+
5+
feat(console): the Access policy page shows the address the server judges beside Allowed IP ranges
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
An organization's `access_policy.allowed_ip_ranges` save is refused when the list leaves out the saving request's own address, and until now **Setup → Access policy** told the organization administrator that address only in the refusal. The page now reads `GET /api/v1/auth/client-address` (the organization administrator's read, answered to a caller holding `setup.write` in their current organization) and draws the note the Authentication page already draws under its own Allowed IP ranges: the address, and whether it came from a trusted proxy's forwarded headers or, with `trustProxy` off, from the connection itself (behind a proxy, the proxy's address); when the server cannot establish an address, that a non-empty list cannot be saved from here. The Authentication page keeps reading the platform administrator's route. A caller the route refuses, a server without the route, or any other failed read draws no note and no toast, and the page is otherwise unchanged. No translation key is added: the three existing note sentences are reused.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
'@objectstack/mcp': patch
3+
---
4+
5+
fix(mcp): the record data tools and the record resource answer a driver's own error code (`SQLITE_BUSY`) as `/api/v1/data` does, a sanitised server fault, never the driver's text
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
A database driver's error carries its own code on `.code` (`SQLITE_BUSY`, `ECONNRESET`, Postgres `40P01`) and no HTTP status. `query_records`, `aggregate_records`, `get_record`, `create_record`, `update_record`, `delete_record`, `delete_records`' selection read and the `objectstack://objects/{name}/records/{id}` resource read any thrown `code` as a coded refusal, so an agent got `{ "code": "SQLITE_BUSY", "message": "SQLITE_BUSY: database is locked" }` with no status. `/api/v1/data` answers the same throw `500 DATABASE_ERROR` `Internal data error` and logs the driver's text.
11+
12+
These faces now answer such a throw with the `/data` door's answer, read through that door's own classifier (`mapDataError`, `@objectstack/types`):
13+
14+
- `SQLITE_BUSY`: `{ "code": "DATABASE_ERROR", "message": "Internal data error", "status": 500 }` on the tools, `{ "error": "Internal data error", "code": "DATABASE_ERROR", "status": 500 }` on the resource;
15+
- a driver code whose text names no store (`ECONNRESET`): `500 INTERNAL_ERROR` `Internal server error`.
16+
17+
The driver's code and text are logged once on the server as a `[5xx]` line instead of being sent.
18+
19+
The rule is the door's: a thrown code that declared no HTTP status, and that the door answers as a server fault, is a fault, not a refusal. So a code thrown with no status that the door does not recognise as a refusal (for example `RECORD_LOCKED` with no `status`) now answers the door's `500 INTERNAL_ERROR` here too; declare the status you mean to keep the code. A code thrown with its status (`RECORD_LOCKED` / 409, `SERVICE_UNAVAILABLE` / 503), a code the door answers as a refusal without one (`PERMISSION_DENIED`), and a sandboxed hook's coded refusal are answered as before. `run_action`, `resume_run` and the metadata tools are not changed.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
'@objectstack/cli': patch
3+
---
4+
5+
fix(cli): `os serve` refuses to boot a standalone stack whose `plugins` lists an entry that may provide the crypto provider
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
When a stack's `plugins` lists no plugin instance (no entry with `init`), `os serve` boots the standalone stack and does not load the authored `plugins` entries. It now refuses that boot when one of those entries may provide the crypto provider (`crypto-provider`), which seals every secret field, datasource credential and encrypted setting, and names the entry:
11+
12+
- an entry that declares `providesServices: ['crypto-provider']`;
13+
- a package specifier that does not import, which declares nothing.
14+
15+
An entry whose `providesServices` does not name the crypto provider (or that declares none) keeps today's handling. To boot a provider plugin, list its plugin instance in the stack's `plugins`.

‎.claude/skills/checklist-test/SKILL.md‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,9 @@ QA-source: #运行记录号 · area.item · 条款
218218
或直接填实值。**唯一例外是 npm 冒烟**(§6):定位字段写冒烟选择器、条款写格号,如
219219
`QA-source: #运行记录号 · smoke:npm-18.2.0 · C3` —— 下一轮冒烟凭这一行重判它。
220220

221+
**关闭** —— 收口完成即由 QA 席当轮关记录 `completed`,一行指向收口评论;遗留项留在各
222+
自卡上,回测经 `retest-owed.mjs` 欠着,⛔ 不为等修复开着。
223+
221224
**Supersede 协议** —— 重跑覆盖了旧记录的地面时,旧记录关闭(`not_planned` + 一行
222225
`Superseded-by:` 指向新记录),但**先把新一轮没有重新判定的判定结转过去**:结转行
223226
(`Carried-forward:`,引旧记录号)落在**新记录**上,supersede 行落在**旧记录**上。⛔
@@ -241,8 +244,8 @@ QA-source: #运行记录号 · area.item · 条款
241244

242245
## 6. 常驻回归 —— 两次发版之间也重跑
243246

244-
维护者所定的两条例行(裁定评论 6501246005);定时任务由派发的 PM 会话建,⛔ 不是仓库代码,也
245-
不是合并门禁。
247+
维护者所定的两条例行(裁定评论 6501246005)归 QA 席 `qa#1`(pm-dispatch `lanes/qa.md`);其定时任务
248+
由维护者为该席建,⛔ 不是仓库代码,也不是合并门禁。
246249

247250
- **每周回归**,对 `main` HEAD,四张 `qa-run` 记录,一个选择器一张:
248251
- 欠测清单:标题选择器写 `owed:weekly`(⛔ 不带冒号的词会被读成区),清单里每个 id
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# 席位章程:QA 席(qa)
2+
见 checklist-test 技能 §4–§6;本文是本席岗位说明,现值状态恒在座位贴,⛔ 不迁入本文。
3+
4+
## 座位与唤醒
5+
6+
- 席位 `qa#N`,首席 `qa#1`;签名、座位贴、信箱同他席;无 `domain:*` 标签、无 `pm:queue`。
7+
- Routine 席:维护者在 Routines UI 建每周 fire,发版后敲一轮;⛔ 本席不自建、不改频率。
8+
- 发版只认维护者一句或总监席摘要的新 tag 族读数;⛔ 不自判发版。
9+
- 开席首轮:先 `retest-owed.mjs`,再立第一张 `owed:weekly` 记录;此后每 fire 一轮。
10+
11+
## 每轮
12+
13+
- 首动作 `node scripts/qa/retest-owed.mjs`(只读);欠测 id 即本轮 `owed:weekly` 记录的范围。
14+
- 每周回归照 §6 四张:`owed:weekly`、`touched:` 上周 subject、`priority:P0`、`surface:api`。
15+
- 发版后 `smoke:npm-<版本>` 照 §6;上轮冒烟抽出的修复卡在此重判。
16+
- 执行照 checklist-test 与 RUNNER;本席即派 runner 的会话,runner 的安全复现私报本席。
17+
- 每张记录当轮照 §5 收口:四分法处置、收口评论机器行、抽取卡带 `QA-source:` 行。
18+
- 收口完即关记录 `completed`,一行指向收口评论;遗留项留在各自卡上,⛔ 不为等修复开着。
19+
- 新记录覆盖旧地面 ⇒ 先结转、再关旧记录,照 §5 Supersede 协议。
20+
- 轮末 `node scripts/qa/qa-rollup.mjs` 读开着的 `qa-run` 数;非零逐张点名欠什么,进轮次记录。
21+
- 每轮记花费行(环境准备与测试墙钟、runner 花费);三周读数进座位贴,频率由维护者定。
22+
23+
## 边界
24+
25+
- ⛔ 不派 `os-dev`、不改产品代码、不开 PR;§3 清单修订同断言缺陷立卡交该项车道。
26+
- 抽出的缺陷卡照常进分诊首触,⛔ 不定级、不入队;安全发现只照 `../security-findings.md`。
27+
- 波次(发版候选全量、维护者点名目标)仍由维护者手动触发;本席只跑 §6 两条例行。
28+
- 技能文本归 `domain:skills`、RUNNER 归 `domain:devx`;本席见文本问题以 `finding` 报,⛔ 不自改。
29+
- GitHub 写只走 checklist-test §4 写入门;推维护者只限需其出手,⛔ 无周报聊天表。

‎.claude/skills/pm-dispatch/references/lanes/skills.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
- PM 循环工具与指令架构文件的归属见 SKILL.md 域车道表 `domain:skills` 行,⛔ 不另抄。
99
- 受管面治理执行文件:`.github/CODEOWNERS` 路由半边 + SUBJECT 是受管面本身的门禁/审计脚本。
1010
- 全量判据在 SKILL.md 域车道表;受管面定义与两层分档见 SKILL.md 〈路径分叉〉,⛔ 不另抄。
11-
- QA 管理循环执行归本席;qa-run 记录是协议载体不是工作。
11+
- QA 循环执行归 `qa#1` 席(`qa.md`),本席只管其技能文本;qa-run 记录是协议载体不是工作。
1212
- 契约复核归派发席席内、决裁勤务归总监席(`director.md`);本席保留 skill 与治理文本。
1313

1414
## 常设承诺
@@ -22,7 +22,7 @@
2222
- finding 归分诊首触,自分诊见 `triage-duties.md`;可附证据与「Instruments serve the fleet」答案。
2323
- 「Instruments serve the fleet」答不出的 finding ⇒ 建议 p3 或不做,⛔ 不自入队;定级归分诊。
2424
- 内部指令面中文,机器判据恒英文;认领前重读全线程;标签写 read-modify-write 加回读。
25-
- QA 波次由维护者手动触发,⛔ 不自启。
25+
- QA 波次由维护者手动触发,⛔ 不自启;checklist-test §6 两条例行按期由 `qa#1` 跑,不是波次。
2626

2727
## 席内判断
2828

‎.claude/skills/pm-dispatch/references/project-forms.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
- 项目指令只有一行:`pm-dispatch <席位> [<席位>…]`,如 `pm-dispatch 总监`、`pm-dispatch ui skills`。
1414
- 首词恒为技能目录名 `pm-dispatch`;⛔ 不用 `fleet`,它已是 bot 与中继的名字。
1515
- 席位词 = 中文名或车道文件名:总监 = `lanes/director.md`,分诊 = `triage.md`,复核 = `review.md`。
16-
- 其余席位词同 `lanes/<lane>.md` 文件名:ui、skills、devx、server、spec、hotcrm、mobile。
16+
- 其余席位词同 `lanes/<lane>.md` 文件名:ui、skills、devx、server、spec、hotcrm、mobile、qa。
1717
- 一车道多席:协调者取 🟢 行写本账号的那一席;无则取空席;再无则问维护者一次。
1818
- 其余一切住本文:⛔ 不往项目里贴模板;⛔ 不在账号层复制技能。
1919

‎content/docs/permissions/system-context.mdx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ bugs — it is the protection or the side effect that silently does not happen.
111111
| 7 | Write bypass = `true`, effective write scope = `org` | plugin-security | Get: widest write scope without holding any capability | `registerSecurityService` |
112112
| 8 | Metadata-plane schema masking exempt (ADR-0106 D4) | metadata-core | Get: unmasked object schema. Note: the exemption is a **caller** property — it short-circuits before the security service is consulted | `isObjectSchemaMaskExempt` |
113113
| 8b | Authoring-trail reads admitted | rest, runtime | Get: a metadata item's version history, audit rows and stored-version diff (`GET /meta/:type/:name/history`, `/audit`, `/diff`) without `studio.access` or `manage_metadata`, and a package's commit timeline (`GET /packages/:id/commits`) without `studio.access`. Note: narrower than the schema-mask exemption the draft switches ask (`isObjectSchemaMaskExempt`): neither door admits `setup.access`, which organization admins hold | `mayReadAuthoringTrail`, `requireCommitTrailReadCapability` |
114-
| 9 | `explain()` may target a principal other than the caller | plugin-security | Get: no `manage_users` / delegated-admin check | `explainAccessForCaller` |
114+
| 9 | `explain()` and the effective-access read (`describeEffectiveAccess`) may target a principal other than the caller | plugin-security | Get: no `manage_users` / delegated-admin check — both reads ask the one caller gate | `explainAccessForCaller`, `mayDescribeAnotherUser` |
115115
| 9b | The master-detail write check the `security` service serves (`checkControlledByParentWrite`, ADR-0055) answers `allow` | plugin-security | Get: `allow` for any record, with no master judged — the write path's own first exit, so a gate composing it admits exactly what the record's own system-context update would. Lose: nothing a caller reaches today: its two consumers, the `sys_attachment` and `sys_comment` parent gates, return before they ask for a system session | `checkControlledByParentWrite` |
116116
| 10 | Anonymous-deny treats the caller as authenticated | core | Get: passes the 401 seam with no `userId` | `shouldDenyAnonymous` |
117117
| 12 | Session-resolution middleware skipped | plugin-auth | Get: no session lookup attempted | `packages/plugins/plugin-auth/src/auth-plugin.ts#start` |
@@ -592,7 +592,8 @@ and CI refuses one that differs from what the tree produces.
592592
| `packages/plugins/plugin-security/src/position-catalog-refusal.ts#assertPositionNamesCatalogRow` | 1 | 23b |
593593
| `packages/plugins/plugin-security/src/security-plugin-authz-middleware.ts#registerAuthzMiddleware` | 1 | 1, 2, 30 |
594594
| `packages/plugins/plugin-security/src/security-plugin-cbp-write-gate.ts#checkControlledByParentWrite` | 1 | 9b |
595-
| `packages/plugins/plugin-security/src/security-plugin-explain-access.ts#explainAccessForCaller` | 2 | 9 |
595+
| `packages/plugins/plugin-security/src/security-plugin-explain-access.ts#explainAccessForCaller` | 1 | 9 |
596+
| `packages/plugins/plugin-security/src/security-plugin-explain-access.ts#mayDescribeAnotherUser` | 1 | 9 |
596597
| `packages/plugins/plugin-security/src/security-plugin-field-readers.ts#resolveProjectionFieldMask` | 1 | 4 |
597598
| `packages/plugins/plugin-security/src/security-plugin-object-admission.ts#canExport` | 1 | 5 |
598599
| `packages/plugins/plugin-security/src/security-plugin-object-admission.ts#canReadObject` | 1 | 6 |

0 commit comments

Comments
 (0)