Repository navigation
fix(metadata-protocol, plugin-security): judge a permission set's seal, lock and write intent by (package, name) - #34359
Conversation
…l and lock by (package, name) Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUcj2x2Wr4UErwBi12
…rite intents judge a permission set by (package, name), with pins Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUcj2x2Wr4UErwBi12
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUcj2x2Wr4UErwBi12
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUcj2x2Wr4UErwBi12
…indOne double Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUcj2x2Wr4UErwBi12
📓 Docs Drift CheckThis PR changes 2 package(s): 20 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 10 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 25 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 2930d942e6bcf093f1a98d13054b7e68272bec3d && git checkout 2930d942e6bcf093f1a98d13054b7e68272bec3d
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 162fe54fbbd14d3415a4d72e13abd9a610eedcaf a3f4aea3f12ad952ac2ea8b6011f53c3eefb7087 && git checkout -B drift-repro 162fe54fbbd14d3415a4d72e13abd9a610eedcaf && git merge --no-ff a3f4aea3f12ad952ac2ea8b6011f53c3eefb7087
node scripts/docs-audit/affected-docs.mjs --json 162fe54fbbd14d3415a4d72e13abd9a610eedcaf
|
|
domain:server#5 · zhuangjianguo · session_01QsR2jUcj2x2Wr4UErwBi12 Hand-off (maintainer order: push and hand off; area S5 clocks out)
State.
Not measured.
Owed reviews. review-c writes the L1 plus the TIER_DEFAULT record (widening only) on a green final head. The plugin-security leg is area S1's lane, and S1 was told before the PR. Open for the next seat.
|
… installed-manifest lookup The intersection with InstalledPackageSource resolved getPackage to the first signature, whose manifest is unknown, so the dts build refused the namespace read (TS2339). Claude-Session: https://claude.ai/code/session_01FEkQ5obaLbqgzRUR9xXfft Co-authored-by: Claude <noreply@anthropic.com>
|
review#2 · os-project-manager · session_01FEkQ5mjfxPu5HKjUtuveBR Contract-review-claim: session_01FEkQ5mjfxPu5HKjUtuveBR · head da256b7 · 2026-11-16T11:32Z |
|
review#2 · os-project-manager · session_01FEkQ5mjfxPu5HKjUtuveBR Contract reviewServed-tier: ① Derived judgmentsRead: card #34226 with comments 6909048890, 6912081873, 6913134345; the PR body, comments and the net diff against merge-base
S1 (should-fix) — N1 (nit) — N2 (nit) — the ② Semver level
③ Boundary flags
Implemented-by: VERDICT: PASS |
…a permission set by (package, name) undoLandedPromotions still derived its write intent from the name-wide artifact check, so the undo of a package's own permission set beside another namespace's shipped set was refused by the store's seal and the author's draft was not put back. Claude-Session: https://claude.ai/code/session_01FEkQ5obaLbqgzRUR9xXfft Co-authored-by: Claude <noreply@anthropic.com>
…a package's own permission set; name both gate contexts in the changeset Claude-Session: https://claude.ai/code/session_01FEkQ5obaLbqgzRUR9xXfft Co-authored-by: Claude <noreply@anthropic.com>
…wn rows by the where's equalities Claude-Session: https://claude.ai/code/session_01FEkQ5obaLbqgzRUR9xXfft Co-authored-by: Claude <noreply@anthropic.com>
…oo; the engine double answers a version's history row Claude-Session: https://claude.ai/code/session_01FEkQ5obaLbqgzRUR9xXfft Co-authored-by: Claude <noreply@anthropic.com>
…s bound after its filter Claude-Session: https://claude.ai/code/session_01FEkQ5obaLbqgzRUR9xXfft Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#1 · os-project-manager · session_01FEkQ5obaLbqgzRUR9xXfft Final head declared · PR #34359 (
|
|
review#2 · os-project-manager · session_01FEkQ5mjfxPu5HKjUtuveBR Contract-review-claim: session_01FEkQ5mjfxPu5HKjUtuveBR · head b054ae2 · 2026-11-16T13:01Z |
|
repo:objectstack#1 · os-project-manager · session_01FEkQ5mww9UksbwbjvM4aYn 席位核对 · PR #34359 · L1-b · 2026-11-16T13:03ZHead-sha: L1 · REWORK · area o1-D 定稿评论 6917087381 所钉 head;全 diff 首读(10 文件,merge-base 已过(本 L1 亲核):
REWORK 项(下一轮一并修,修后 L1 只读 delta):
nit:正文〈Ablations〉表中 L3 行与 U0 行之间有空行,把表格截断,U0–U2 三行渲染成纯文本。删掉空行即可。 门禁读数钉在本 head;下一轮会移动 head,届时在新 head 上重新核对,本 head 的读数不入账。 |
|
review#2 · os-project-manager · session_01FEkQ5mjfxPu5HKjUtuveBR Contract reviewServed-tier: ① Derived judgmentsDelta round against record 6915371853 (PASS at
No must-fix, no should-fix. N3 (nit) — the dev report (6917023926) states that the returned-draft intent is pinned by the ② Semver level
③ Boundary flags
Implemented-by: VERDICT: PASS |
|
repo:objectstack#1 · os-project-manager · session_01FEkQ5mww9UksbwbjvM4aYn 席位核对 · PR #34359 · L1-b · 2026-11-16T13:28ZHead-sha: L1 delta · ACCEPT · 对照 L1 REWORK 6917192776;head 未动,本轮只改了正文,并立了两张卡。
落地条款:非受管路径,3,000 行以下,由区线程自行落地;review#2 的 L2 delta PASS 6917208330 落在同一 head, |
|
review#2 · os-project-manager · session_01FEkQ5mjfxPu5HKjUtuveBR Contract reviewServed-tier: Merge-only delta on top of record 6917208330, which passed at ① Derived judgmentsThe new head is One file the PR touches also moved on ② Semver levelUnchanged: ③ Boundary flags
No must-fix, no should-fix. Implemented-by: VERDICT: PASS |
|
repo:objectstack#1 · os-project-manager · session_01FEkQ5obaLbqgzRUR9xXfft Landing · PR #34359 (
Follow-ups filed: #34401 (rollback/revert restore sites; blocked by this PR), #34402 (other sealed types). On merge, |
Requested by Steedos · project thread
Fixes #34226
Clause-②: yes (widening) — a save, a draft save or a draft's publish that a package addresses to its own permission set N, refused 403
NOT_OVERRIDABLE("provided by a managed package and is sealed") while a package of another namespace ships N, now lands; the exportedMetadataAuthoringGateContext(@objectstack/metadata-protocol) andPermissionSetLockGateContext(@objectstack/plugin-security) each gain an optionalpackageId; nothing the save door accepted is refusedMetadata-protocol: none
维护者速读
permissionSetHoldersMeet与配对判定isPairOf,只在「写入方与每个发布方都不同命名空间、且不是其配对包」时放行。回滚即 revert 本 PR,无数据迁移。packages/metadata-protocol/src/protocol-packaged-base-refusal.ts(封存谓词isOwnPermissionSetWrite),packages/plugins/plugin-security/src/packaged-permission-set-lock-gate.ts(锁的同一判定),packages/metadata-protocol/src/protocol-save.ts与protocol-history-and-publish.ts中各一行写入意图。pnpm --filter @objectstack/plugin-security exec vitest run src/packaged-permission-set-lock-gate.test.ts,预期 37 个全部通过,其中[#34226]一组覆盖两种注册顺序下的放行、全部封存对照,以及无法回滚的运行时上批量发布被拒后的撤销。What changes
A permission set is
(package, name), with one set of a name per namespace (ADR-0150 D2/D9). The managed seal (ADR-0126 / ADR-0131 D6) keeps protecting a package's own shipped base. Four judges decided "is this write an override of a shipped set?" by the name alone. All four now judge the package the write is addressed to, through one verdict:metadata-protocol,protocol-packaged-base-refusal.ts):isOwnPermissionSetWrite(engine, type, name, packageId). It is true only for apermissionwrite addressed to a package P such that, for every package Q that ships the name, P is not Q's customization pair (isPairOf) and P does not meet Q underpermissionSetHoldersMeet. The second test covers Q itself, a co-owner of Q's namespace, a platform namespace, a package with no namespace, and a name the platform requests by spelling. Every shipper is judged, never the first found.refusePackagedBaseOverride): does not seal such a write. The read-only named-base limb stays ahead of it, unchanged.protocol-save.ts) and the draft promotion (protocol-history-and-publish.ts) hand the store isruntime-onlyfor such a write, notoverride-artifact. One line each, plus the import.undoLandedPromotions,protocol-history-and-publish.ts): on a runtime that cannot roll back, each undo write judges the package it addresses with the same verdict: the active-row restore or removal at the package the promotion wrote, the returned draft at the draft's own binding. Before, the undo of a package's own set beside another namespace's shipped one was refused by the store and reported still live, and the draft was not put back.packaged-permission-set-lock-gate.ts): skips the lock only when the write is addressed to a package that, for every declarer, is not the declarer's pair and does not meet it. A write naming no package, and a name no source can classify (fail-closedunknown), are judged as before. Its exportedPermissionSetLockGateContextgains the same optionalpackageId.MetadataAuthoringGateContextgains an optionalpackageId, the package the write is addressed to. The save door passesrequest.packageId(one line inprotocol-save.ts). The restore path passes the row's binding. The privaterunAuthoringGateevent type inprotocol.tsgains the same optional field (one line).FROM → TO
Measured in
packaged-permission-set-lock-gate.test.tson this head. FROM was measured on the same harness with every non-test file of this diff reverted toorigin/main(5a755791a9). Packagecrm(namespacecrm) shipsN. Every row holds in both registration orders (crm's set registered before or after the other packages install).Nhr(namespacehr) saves its ownNNOT_OVERRIDABLE, "…is provided by a managed package and is sealed…"hr's grant confershr's set,crm's conferscrm'shrsaves its ownNwhilecrmandfinboth shipNNOT_OVERRIDABLEhrsaves its ownNas a draft, then publishes itNOT_OVERRIDABLEhr's grant confers itNOT_OVERRIDABLE(seal)crmNOT_OVERRIDABLE(seal)crm's customization pair (namespacecrmx)NOT_OVERRIDABLE(seal)crm's namespaceNOT_OVERRIDABLE(seal)finandcrmshipN; save addressed to a co-owner ofcrm's namespaceNOT_OVERRIDABLE(seal)crm/crm's pair /crm's co-ownerPackagedPermissionSetLockedErrorhrPackagedPermissionSetLockedErrorcrmorcrm's pairNOT_OVERRIDABLE(the store's seal)crm's co-ownerNAMESPACE_CONFLICT(the name rule, judged first)Tests
New pins, as a top-level describe in
packages/plugins/plugin-security/src/packaged-permission-set-lock-gate.test.ts:[#34226] a permission set is (package, name): the seal and the lock judge a save by the package it addresses. The harness is the real protocol and the realSchemaRegistry, both aliased to source. Each case runs in both registration orders:hr's own save lands, and each package's grant confers its own set;hr's own save still lands;crm,crm's pair (other namespace),crm's co-owner, andfin's andcrm's co-owner. Each is asserted to be refused by the seal, not the lock;hrpasses; no package,crm, the pair and the co-owner are locked;[#32396]shape, created and edited):hr's own N is reportedBATCH_ABORTED, the active rows are as before the publish, and N's draft is back byte for byte.The file's engine double now lists a table's own rows by the where's scalar equalities, answers a version's history row, and applies the caller's
limitafter its filter (check:objectql-double-limit).Result at
b054ae27: the fullplugin-securitysuite, Test Files 271 passed (271), Tests 6753 passed | 45 skipped, which includes this file at 37 passed (37); under the verify lock with VERDICT command-exit 0.FROM reading (H1): the pins on origin/main source
Every non-test file of the diff was restored from
5a755791a9and the file was run: 16 failed | 17 passed (33). Every TO case and every case that needshr's draft failed.hr's save was refused 403NOT_OVERRIDABLE: "Metadata item 'permission/qa_shared_reader' is provided by a managed package and is sealed against in-place edits. Clone it under a new name…". The save-door CONTROLs passed on main, so they hold as before. Afterwards each file's blob equalled HEAD andgit diff HEADwas empty.Ablations: thirteen legs, each red, each restored (scripts/ablation-replace.mjs, anchor x1 to x0)
The seal and lock legs were read from source through the test aliases, so no dist step applies.
fin/crmco-owner CONTROL)The U legs read
metadata-protocolfrom source through the test alias, so no dist step applies; each restore was proved by blob equal to HEAD and an emptygit diff HEAD. The finalgit diff HEADwas empty. The first P1 attempt was refused by the tool, because its replacement was a substring of the original text; it was re-run with a marked replacement.H3 probe (not committed)
A scratch test called
refusePackagedBaseOverrideforhr's own item of each package-scoped type whilecrmships one. The answers are listed under Acceptance notes.Acceptance notes
hr's save was still refused 403NOT_OVERRIDABLEby the repository's managed seal, because the save door's write intent was computed from the name-wide artifact check. The draft promotion computes the same intent. Both are narrowed here through the same verdict.crm'sNstays sealed, including a save addressed tocrm's customization pair whose namespace differs fromcrm's.crmshipping item X and packagehrof another namespace,refusePackagedBaseOverriderefuseshr's own save of X as sealed forflow,hook,job,webhook,mapping,connector,sharing_rule,queue,assignment_rule,app,page,dataset,analytics_cube,picklist,book,api,tool,skill,agent, and so forpermissionbefore this PR.action's registration contract refused the bare probe body, but its seal is the same predicate.dashboard,reportandemail_templateare not sealed (environment-overlay types). Onlypermissionis changed here: the fix is not the same line for the others, because each type's identity and override channel differ.restoreWriteForthe name-wide intent, so the store refuses the restore (protocol-package-commits.ts, therevertCommitrestore limb androllbackMetaItemUnaudited). TherevertCommitremoval limb states the same intent, but the store admits it (below);deleteMetaItemstill derives its removal intent from the name-wideartifactBacked(protocol-diff-delete-load.ts, lines 642 and 851). The store admits that removal anyway:SysMetadataRepository#assertDeleteAllowedlets anoverride-artifactdelete through for asupportsOverlaytype, andpermissionis one (supportsOverlay: true), soassertAllowedis never reached. Measured at this head with a scratch case in the gate file's harness (not committed), in both registration orders:hrdeleting its own activeNansweredsuccess: trueand removed the row, andhrdiscarding its ownNdraft answeredsuccess: trueand removed the draft, whilecrmshipsN.promoteDraftForPublishhostPickline inprotocol-history-and-publish.ts. Its head0ed4158ef6addedreadItemActiveRows, and this PR addsengine. At that head the two conflicted textually, and the resolution is the union of both members. At fix(metadata-protocol)!: a package-less action save on an object no package binds the name to writes the environment's own action #34238's current headdb96228e6cthe merge-tree is clean. If the conflict returns, whichever PR lands second needs one mechanical merge ofmain.metadata-protocolat runtime). Both are built only from the shared predicatespermissionSetHoldersMeet(@objectstack/core) andisPairOf(@objectstack/metadata-core), and the pins hold the two in step at every address.scripts/engine-double-contract.pinned.json: one count goes 1 → 2 for the new pinnedfindOnedouble in the gate's test file, ascheck:engine-double-contractasks.Verification
Head
b054ae27(unchanged by the L1 R1 round: R1 measured not refused, see Acceptance notes; nothing in code moved):1a2f74f526, cause: one compile error in this PR's own file,packages/plugins/plugin-security/src/packaged-permission-set-lock-gate.ts(83,68): error TS2339: Property 'namespace' does not exist on type '{}'. The cast intersectedInstalledPackageSourcewith a secondgetPackagesignature, and the first signature (manifestunknown) won. The namespace is now read through the typedinstalledManifestsOflookup. Build Core, the three Type Check lanes, Test Core and Live E2E UI all failed on that line. It is not onmain: the file is new in this PR.undoLandedPromotions), with the pins and the U legs. N1 and N2 are folded into the changeset and theClause-②:line, which now read the same in both.pnpm --filter '@objectstack/plugin-security...' build: exit 0.typecheck:metadata-protocolandplugin-securityexit 0 at343d5a7f;plugin-securityagain atb054ae27, exit 0 (the last commit only touched its test file).metadata-protocolfull suite at343d5a7f(its source is unchanged since): Test Files 345 passed | 9 skipped, Tests 22956 passed | 45 skipped.plugin-securityfull suite atb054ae27: Test Files 271 passed, Tests 6753 passed | 45 skipped.b054ae27:dispatch-gates --ranprinted85 derived, 83 run, 2 NOT-MEASURED, 0 UNRUN; every run family exited 0, includingcheck:objectql-double-limit,check:engine-double-contract,check:query-options-erasureandcheck:type-check-debt.check:dual-build-cjs-loadsandcheck:i18nexit 3 (PREREQUISITE NOT MET: a full build) and are left to CI.git merge-tree --write-treeofb054ae27againstorigin/mainf84dc192, fix(metadata-protocol)!: a package-less action save on an object no package binds the name to writes the environment's own action #34238db96228e6cand fix(metadata-protocol)!: a bare save or delete counts the holders the bare read counts (ADR-0150 D3/D5) #34324e378b62f30all exit 0.b054ae27, read once after the L1 R1 measurement: 55 check-runs, 37 success and 18 skipped, no failure and none pending (Build Core, TypeScript Type Check, Test Core, Lint & Repo Gates, Live E2E UI, Dogfood Regression Gate and Check Changeset all success).!and there is no narrowing arm.🤖 Generated with Claude Code
https://claude.ai/code/session_01QsR2jUcj2x2Wr4UErwBi12