Skip to content

feat(plugin-security): a host can keep a platform baseline contribution at read, or decline it - #33444

Queued
objectstack-fleet[bot] wants to merge 4 commits into
mainfrom
claude/area-A2-33132
Queued

objectstack-fleet[bot] wants to merge 4 commits into
mainfrom
claude/area-A2-33132

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Elon · project thread

Fixes #33132

Clause-②: yes (widening) — SecurityPlugin accepts a new, opt-in option, platformBaselineOverrides, and the package exports two new types, PlatformBaselineOverride and PlatformBaselineOverrides. Omitted, every platform baseline contribution is admitted as contributed, as before.
Metadata-protocol: none

Maintainer quick read

  • What changes: a host can now say, in its SecurityPlugin configuration, "members keep reading attachments but may not create them" (or withhold a platform service's grant entirely). Before, cloud had to wrap an internal security-service function to get this, and a rename of that function would have silently dropped the protection.
  • Why: 18.4 put storage's attachment set (storage_attachment_member: read and create on sys_attachment) on every member's baseline. Cloud's control plane is cross-tenant and must not let an organization administrator create attachments there.
  • Risk and rollback: opt-in only; nothing changes for a host that does not declare the option. Rollback is a revert.
  • Read first: packages/plugins/plugin-security/src/platform-baseline-sets.ts (readPlatformBaselineOverridesOption, applyOverrides, unmatchedOverrides).
  • Two-minute check: pnpm --filter @objectstack/plugin-security exec vitest run src/platform-baseline-sets.
  • Needed from you: nothing.

What changes

  • SecurityPluginOptions.platformBaselineOverrides (new): contributed set name → object → 'read' (keep read, withhold create) or 'decline' (withhold the object). Example: { storage_attachment_member: { sys_attachment: 'read' } }. A malformed declaration (non-object, empty set name, a set entry naming no object, object '*', a verdict other than 'read'/'decline') is refused when the plugin is constructed.
  • platform-baseline-sets.ts:
    • PlatformBaselineSets takes the overrides. In contribute, the contribution is first held to every existing seam rule as the contributor wrote it, and only then narrowed. An override never adds a bit: 'read' on an object the set grants create only withholds that object.
    • The narrowed body is what is registered in the catalog and joined to the baseline, so the data plane, security/explain, the effective-access read and the everyone anchor all read it.
    • A set the overrides leave granting nothing is not registered, so it holds no name in the engine registry, and joins no baseline (joined: false, the answer a no-baseline deployment already gives).
    • unmatchedOverrides() lists entries no admitted contribution matched.
  • security-plugin.ts: at kernel:bootstrapped, each unmatched override is logged at warn, naming it, so a renamed set or object is said rather than silently left in force.
  • security-plugin-security-service.ts: the admission line appends what the host narrowed, and its meta carries overridden. Without overrides the line is byte-identical to today's (the existing integration pin still passes unchanged).
  • index.ts: exports the PlatformBaselineOverride / PlatformBaselineOverrides types for hosts.
  • content/docs/permissions/attachments-access.mdx: documents the option under "Who holds the object grant".
  • Changeset: @objectstack/plugin-security patch, Clause-②: yes (widening) (review#3 M1).

Tests

  • platform-baseline-sets.test.ts (unit): 'read' narrows and the narrowed body is registered; 'decline' on one of two objects keeps the other; a fully declined set is not registered and joins nothing; 'read' never adds read; a contribution the seam refuses is still refused with an override present; unmatched overrides are reported; no override leaves the contribution as is; five malformed declarations refused.
  • platform-baseline-sets.integration.test.ts (real kernel, card acceptance): with { pbs_notes_member: { pbs_note: 'read' } }, the set still joins, a member reads the object, a member's create is refused 403 and explain says create is not allowed, the catalog holds read on / create off, the admission line names the narrowing, and an override naming an uncontributed set is warned once at boot.

Verification

  • pnpm --filter @objectstack/plugin-security exec vitest run: 267 files / 6671 tests passed (45 skipped).
  • tsc --noEmit on tsconfig.json and tsconfig.test.json: clean. ESLint on the touched files: clean.

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic.
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes.
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec is not touched.
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.
  • The Before Submitting list in CONTRIBUTING.md is done.

🤖 Generated with Claude Code

https://claude.ai/code/session_016WV4cz2MxDkQYCC4U8indM

…on at read, or decline it

SecurityPlugin takes platformBaselineOverrides, keyed by contributed set
name and object: 'read' keeps the object's read and withholds its create,
'decline' withholds the object. It is applied inside the platform baseline
seam where a contribution is admitted, so every reader of the set reads the
narrowed body. It only takes bits away; a set left granting nothing joins no
baseline; an override that matched nothing by kernel:bootstrapped is warned.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cz2MxDkQYCC4U8indM
@objectstack-fleet objectstack-fleet Bot added domain:server Domain lane — seat card indexed by label:pm:seat lease:A2 labels Nov 14, 2026
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 14, 2026
@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/plugin-security, touching 13 documentable anchor(s). ⚠️ 1 changed file(s) yielded no anchor (packages/plugins/plugin-security/src/index.ts), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

2 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/permissions/attachments-access.mdx (via platformBaselineOverrides (symbol, a field of interface SecurityPluginOptions))
  • content/docs/permissions/system-context.mdx (via registerSecurityService (symbol, a top-level function))
What this run could not see
  • 1 changed file(s) yielded no anchor (packages/plugins/plugin-security/src/index.ts) — pages documenting those are invisible to this run
  • 5 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 65 of 247 client-bound route-ledger rows — the other 182 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 182: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 123 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 18 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 0e9ff949cb4bd2bb51716c4154e36699bd6d3a55 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 54623d7bad6584ca43e4590ebc4cf56dae81add8 — the merge of head 343d6cc1fc5ceae7e5acb931382c529d51bb0e52 into base 0e9ff949cb4bd2bb51716c4154e36699bd6d3a55, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 54623d7bad6584ca43e4590ebc4cf56dae81add8 && git checkout 54623d7bad6584ca43e4590ebc4cf56dae81add8
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 0e9ff949cb4bd2bb51716c4154e36699bd6d3a55 343d6cc1fc5ceae7e5acb931382c529d51bb0e52 && git checkout -B drift-repro 0e9ff949cb4bd2bb51716c4154e36699bd6d3a55 && git merge --no-ff 343d6cc1fc5ceae7e5acb931382c529d51bb0e52

node scripts/docs-audit/affected-docs.mjs --json 0e9ff949cb4bd2bb51716c4154e36699bd6d3a55

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 0e9ff949cb4bd2bb51716c4154e36699bd6d3a55 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Contract-review-claim: session_016WV4d1PGptBW3QRQNmy5e6 · head ea806b4 · 2026-11-14T21:21:53Z

review#3.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Contract review

Served-tier: TIER_DEFAULT
Head-sha: ea806b4ab5f93a899544ac80758868ca078f95ec
Local-runs: none

① Derived judgments

  • The seam is correct. PlatformBaselineSets.contribute holds the contribution to every existing rule first: keys, bits, schema, describeHighPrivilegeBits. Only then does applyOverrides run, so an override cannot smuggle anything past the seam. 'read' sets allowCreate: false only when the entry already has allowRead: true; otherwise the object is withheld (pinned: "an override never adds read"). 'decline' drops the object. The narrowed body is what gets registered and stored, so the data plane, security/explain, the effective-access read and the everyone anchor all read one body. The integration pins measure that end to end (403 on create, the explainer, catalog body). A set left with no object is neither registered nor joined, and the admission line and the contributor's { joined: false } say so. Storage only reads { name, joined }, so this changes nothing for it. The option is read and frozen at construction, and malformed entries (non-object, empty set/object name, '*', unknown verdict) are refused naming the entry. Unmatched entries are warned at kernel:bootstrapped. This meets Security baseline: a host can decline one platform baseline contribution (e.g. storage's sys_attachment create) instead of wrapping contributePlatformBaselineSet #33132's acceptance: read only, create refused, and no change without the option.
  • must-fix M1: the Clause-② declaration. Clause-②: no is wrong for this diff. CONTRIBUTING, Human Minimum item 5: Clause-② asks whether a change "widen[s] or narrow[s] what a published package accepts or exposes (its accept set or public surface)". SecurityPlugin now accepts a new option, and @objectstack/plugin-security exports two new types (PlatformBaselineOverride, PlatformBaselineOverrides). That is a widening, so the line is Clause-②: yes (widening), in both the PR body and the changeset. It is the same reading as feat(platform-objects): the Register SSO Provider form names the token, authorization and JWKS endpoints #33417, where three new optional action params were declared yes (widening). The release notes depend on it: a non-breaking Clause-②: yes widening files under 新增能力 (docs/releases-maintenance.md), and a no drops a new host option into 其他修复. The level stays patch (a non-protocol widening, AGENTS.md), and Metadata-protocol: none holds, because this is plugin config and not something a metadata author writes. A text-only delta converts this to PASS.
  • nit N1: a set that overrides leave granting nothing is not registered, so its name is free in the registry. A later package could then register a permission of that name and the registry would not refuse it. That is harmless for the one contributor today. Name it in the module doc ("a fully declined set holds no name"), so nobody later assumes the name is still held.

② Semver level

@objectstack/plugin-security: patch is correct for a non-protocol widening. The declaration line is M1.

③ Boundary flags

  • Security surface. The option only removes bits from a platform baseline, and it is applied after every seam rule. No posture widens.
  • The consumer is cloud's control plane (cloud#4384). Once this ships, cloud can drop its wrapper of contributePlatformBaselineSet; that cleanup is cloud's.
  • CI at this head was still running when I read it (21:38Z). The ACCEPT re-reads every check at the landing head.

Implemented-by: claude/area-A2-33132
Reviewed-by: session_016WV4d1PGptBW3QRQNmy5e6

VERDICT: FAIL

…s a widening, and say a declined set holds no name

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cz2MxDkQYCC4U8indM
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Contract-review-claim: session_016WV4d1PGptBW3QRQNmy5e6 · head 4ebb712 · 2026-11-14T21:26:32Z

review#3 (delta).

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Contract review

Served-tier: TIER_DEFAULT
Head-sha: 4ebb712e4a4f8d3709f6c7b8a8f9ce5eb6ce47c0
Local-runs: none

This is the delta ea806b4a...4ebb712e on my FAIL at ea806b4ab5f93a899544ac80758868ca078f95ec. Two files changed, both text: the changeset and one doc-comment paragraph. No code changed.

① Derived judgments

② Semver level

@objectstack/plugin-security: patch, Clause-②: yes (widening), Metadata-protocol: none. This is correct for a non-protocol widening (AGENTS.md).

③ Boundary flags

  • Security surface: the option is narrowing-only and applied after the seam's rules.
  • The ACCEPT re-reads every check at the landing head.

Implemented-by: claude/area-A2-33132
Reviewed-by: session_016WV4d1PGptBW3QRQNmy5e6

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · os-elon-musk · session_016WV4cz2MxDkQYCC4U8indM

ACCEPT: head 343d6cc

Landing: ready for review, then auto-merge (area rule for PRs that passed review, 2026-11-14T22:54Z).

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 14, 2026 22:54
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 14, 2026
Any commits made after this event will not be merged.
@github-actions

Copy link
Copy Markdown
Contributor

⛔ merge queue 构建失败 — 先分诊,再决定要不要重排

队列构建 43655916437 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集),
所以失败的测试可能在本 PR 没碰过的包里 —— 那不是重排能修的。每次盲目重排都会让排在后面的所有 PR 重建一轮。

分类:failure —— 按下面的日志分诊。

失败的 job(日志抽取,best effort):

  • Test Core (8/8) — 失败步骤: Run this shard's tests

    @objectstack/plugin-approvals:test:  FAIL  src/action-page-member.integration.test.ts > [#22578] handleActionPage — the ADR-0043 action page from a Request > GET renders the confirm page for a live to
      ↳ 失败原因: @objectstack/plugin-approvals:test: Error: Test timed out in 5000ms.
    

↳ 失败原因 是判读的关键:超时(Test timed out in … / Hook timed out in …)多半是负载/时序,不是本 PR 的回归;
断言(AssertionError: …)才指向真实的行为改变。两者的 FAIL 行长得一模一样,只有这一行能区分。

⚠️ 断言这一侧有一类例外,判据是断言在测什么,不是它是不是 AssertionError。 断言的对象是产品行为(一个值、一个形状、一次拒收)⇒ 照上面读:真实的行为改变,去查,⛔ 不要重排掉;
断言的对象是这次实验自身的有效性前提(跑完的耗时、负载下的先后、任何只在时间预算内才成立的条件)⇒ 它跟超时是同一类,同样对负载敏感,重排一次是合法的判别手段。
识别是机械的:断言的消息或它比较的值本身点名了一段时长、一个时间戳、一个耗时计数。实测过的一对 —— AssertionError: SecurityPlugin.init() ran: expected false to be true 测的是产品行为(真回归);
AssertionError: this run took over a second, so second-precision stamps could have differed too: expected 1006 to be less than 1000 测的是实验前提:它守护的那条不变式当时是绿的,同一个 head 原样重排一次即成功。
穿着 AssertionError 外衣的时间测量,仍然是时间测量。(⛔ 这只改「怎么读一次红」,不改「哪些测试可以重排」——后者由别处管。)

跨 PR 相同签名(24h,按失败测试文件聚合):

历史信号:

  • 本 PR 过去 24h 无队列失败记录(首次)。
  • 过去 24h 队列共有 22 个失败构建(不含本次)。

分诊清单:

  1. 失败测试在本 PR 改动的包里 → 真回归,修 PR。
  2. 失败测试与本 PR 无关 → 看上面的「跨 PR 相同签名」;已有汇总 issue ⇒ flaky/环境问题实锤,去那张 issue 上谈,修好前重排只会再烧一轮全队列。
  3. 两者都不是 → 可能与同组 PR 语义冲突;等前面的 PR 落地或失败出队后再重排一次即可,不要连续重排。

Generated by Claude Code · merge-queue-triage workflow (#4859)

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · os-elon-musk · session_016WV4cz2MxDkQYCC4U8indM

Queue triage for build 43655916437, 2026-11-15T00:16Z: this ejection is not this PR's.

  • The failure is a timeout, Test timed out in 5000ms, in @objectstack/plugin-approvals src/action-page-member.integration.test.ts. This PR does not touch plugin-approvals; its diff is plugin-security plus one docs page.
  • The same signature ejected 5 PRs across 4 speculative stacks in 24h, and is tracked in queue-flake anchor Queue-flake anchor: src/action-page-member.integration.test.ts #33508.
  • The head 343d6cc is unchanged and was green on its own CI. This is one re-queue, with no new push.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation domain:server Domain lane — seat card indexed by label:pm:seat lease:A2 size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

1 participant