Skip to content

docs(skills): objectstack-data security.md teaches how a package position resolves its permission sets - #31858

Merged
os-zhuang merged 2 commits into
mainfrom
claude/project-thread-xklyph
Nov 9, 2026
Merged

os-zhuang merged 2 commits into
mainfrom
claude/project-thread-xklyph

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Steedos · project thread

Fixes #31819

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:技能文档 security.md 讲岗位授权的那一节新增一条:软件包里的岗位引用权限集时,先找本包的,再找它声明的依赖(加 sys)里唯一的那个;找不到或有两个就被拒绝,启动报告会列出来,这个岗位通过这个名字什么都不授予。另加一个评测用例。
  • 为什么改:ADR-0150 E3(PR feat(core, plugin-security)!: permission sets resolve by (package, name), and a package position's sets resolve from its package (ADR-0150 E3) #31815)已经上线这条规则,但技能文档没写,AI 写包时会写出一个能加载、却什么都不授予的岗位。
  • 风险与回滚:只改文档、评测和 token 上限,不动运行时代码。为装下新内容,security.md 的 token 上限从 3768 提到 3959(常设裁决 6513306068:「A:先削重复,余额按实测提高」)。回滚即 revert 本 PR。
  • 先看:skills/objectstack-data/rules/security.md「Positions grant only what they name」一节的新条目;scripts/check-skills-token-ratchet.mjs 该文件的上限行与注释;评测 hooks-security-seeds-datasources.json 的用例 19。
  • 两分钟验证:node scripts/check-skills-token-ratchet.mjs,预期 security.md is 3959 tokens (ceiling 3959; headroom 0) 且整体通过。
  • 需要你做的:在受管审批人复核后批准本 PR(Tier H,skills/**)。

What changes

  • skills/objectstack-data/rules/security.md, section "Positions grant only what they name": one new bullet, read from the merged ADR-0150 E3 code (PR feat(core, plugin-security)!: permission sets resolve by (package, name), and a package position's sets resolve from its package (ADR-0150 E3) #31815, 3487ccc1).
    • Rule. A package's position reads each permissionSets name as its own package's set, else the one holder in its declared dependencies closure plus sys. Otherwise the name is refused. Source: packages/core/src/security/security-catalog.ts resolvePermissionScoped (L497–556) over packages/core/src/package-scoped-resolution.ts resolvePackageScopedHolders (L547–590, steps 1–3) and packages/metadata-core/src/package-closure.ts packageResolutionClosure (L216).
    • Refusals, spelled as the code does. outside-closure: only a non-dependency holds the set (package-scoped-resolution.ts L584–589), or only the environment holds it (security-catalog.ts L538–556, the D3 (a) refusal naming the environment). ambiguous-in-closure: two holders it reaches (package-scoped-resolution.ts L582). One example each.
    • When it surfaces. The position still loads (no authoring-time check reads the closure for a position's sets). The boot's catalog reference report (packages/plugins/plugin-security/src/catalog-reference-report.ts L352–378, logged at L490–510) lists each refusal with every candidate. At run time the position grants nothing through that name and its other sets still grant (resolve-authz-context.ts catalogSetBody L1419–1432; test "a set one position cannot resolve is still granted through another position that can").
    • Who still resolves environment-wide. Stored grants, environment-authored positions, an administrator's overlay of a package position, and the everyone/guest anchors (security-catalog.ts referenceCaller L477–490).
    • The sentence above it now says a name "matching no set, or refused below, confers nothing".
  • skills/objectstack-data/evals/hooks-security-seeds-datasources.json: new case 19, placed after case 18. A package position names hd_agent from com.acme.helpdesk. The expected output declares dependencies: { 'com.acme.helpdesk': '^1.0.0' }. The assertions require permissionSets: ['hd_agent'], dependencies: { and outside-closure, and refuse name: 'hd_agent' (redeclaring the set). So an answer without a declared dependency fails.
  • scripts/check-skills-token-ratchet.mjs: the security.md ceiling row moves 3768 → 3959, with its comment.
  • .changeset/31819-data-security-position-permission-sets.md: '@objectstack/skills': patch.

Token budget

The ceiling is paid under standing ruling 6513306068, letter B, quoted verbatim: 「A:先削重复,余额按实测提高」.

Cut first (restatement, with its survivor):

Cut from security.md Bytes Survivor
secret paragraph: "Fail-closed: with no crypto provider, writes throw rather than persist cleartext." 86 rules/field-types.md L44, the secret row: "fail-closed (ADR-0100)"

No other passage in the file is restated elsewhere without being a pointer an agent follows (docs links, schema keys, helper names), so nothing else was cut.

Byte arithmetic (bytes / 4, rounded up):

  • origin/main (5377a12a): 15056 bytes = 3764 tokens; ceiling 3768 (15072 bytes), headroom 16 bytes.
  • Added 966 bytes, removed 188 bytes (the 86-byte cut plus re-flowed lines): net +778.
  • Landed: 15834 bytes = 3959 tokens. Remainder over the old ceiling: 15834 − 15072 = 762 bytes = 191 tokens. The ceiling rises by 191 to 3959, pinned at the measurement, headroom 0.

skills/** readings

Reading Before After
skills/objectstack-data/rules/security.md lines 317 327
skills/objectstack-data/rules/security.md tokens 3764 3959
All skills/*/SKILL.md, lines 4601 4601

Tests

No runtime code changes, so no test was added or run beyond the gates. The eval file parses as JSON, and its ids run 1–19 with no duplicate.

Acceptance notes

  • The two-holder refusal is rare in a real composition. The security catalog keeps one name per deployment for permission sets (packages/objectql/src/security-catalog-namespace.ts): a second package declaring a set name is refused when it registers. That refusal happens first, so the bullet says so beside the ambiguous-in-closure example. The order asked for the refusal to be taught, and it is, without claiming a path the registry blocks.
  • guest_portal resolves environment-wide whatever the caller (PLATFORM_REQUESTED_BARE_NAMES_BY_TYPE, package-scoped-resolution.ts L250). It is a name, not a caller, so the bullet does not list it.
  • The delegated-admin boundary also reads a refusal as a boundary failure (delegated-admin-gate.ts). That is outside an authoring rule, so the bullet does not teach it.

Verification

The derived sweep ran on 31a8d0f3. Merging origin/main then brought one commit (fix(drivers), #31831) that touches none of this PR's files; the token ratchet re-ran on the final head 4187450a, exit 0.

dispatch-gates: 62 derived, 61 run exit 0, 1 NOT MEASURED
  • node scripts/pm/dispatch-gates.mjs --ran FILE: "62 derived famil(ies) accounted for — 61 run, 1 NOT-MEASURED (1 DERIVED from a recorded exit 3)".
  • pnpm check:dual-build-cjs-loads exited 3 (PREREQUISITE NOT MET: it needs every package's dist, "Run pnpm build first"). Left to CI.
  • node scripts/check-skills-token-ratchet.mjs: exit 0, security.md is 3959 tokens (ceiling 3959; headroom 0).
  • pnpm check:pm-dispatch-gates: exit 0, 2205 fast-tier cases.
  • Prerequisite build under the verify lock: turbo run build for formula, lint and objectql, 14 tasks, VERDICT command-exit 0.

Generated by Claude Code

…tion resolves its permission sets

A package's position reads each permissionSets name as its own package's
set, else the one holder in its declared dependencies closure plus sys;
else the name is refused (outside-closure, ambiguous-in-closure), logged by
the boot's catalog reference report, and grants nothing. Eval case 19 pins
the declared dependency. The security.md token ceiling rises by the
measured remainder after one restatement cut (ruling 6513306068, letter B).

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jU2AtcY5Ky9skxahcy
@github-actions github-actions Bot added size/s documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 9, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:skills#2 · zhuangjianguo · session_01QsR2jT34CXs5fCn3BDirZw

维护者速读

  • 改了什么:数据技能 rules/security.md 的「职位只授予它点名的权限集」一节加了一条规则:软件包里的职位,按名字引用权限集时,先找本包的,再找它声明的 dependencies 闭包(含 sys)里唯一的持有者,否则拒绝。拒绝时职位照常加载,启动时的目录引用报告记下这次拒绝,这个名字不授任何权限。有两种拒绝:outside-closure(只有未声明依赖的包或环境持有)和 ambiguous-in-closure(能够到的持有者有两个)。仍按整个环境解析的情况也列了出来:存储的授权、环境自建的职位、管理员对包职位的覆盖、everyone/guest 锚点。另加 eval 第 19 条。
  • 为什么改:ADR-0150 E3(PR feat(core, plugin-security)!: permission sets resolve by (package, name), and a package position's sets resolve from its package (ADR-0150 E3) #31815)已经按职位所在的包解析权限集,技能却没写。AI 照着写,职位能加载,但什么都不授予。
  • 风险与回滚:只动技能文本、一条 eval、一个 ratchet 上限行和一个 changeset(@objectstack/skills patch)。回滚就是 revert 本 PR。
  • 先看:skills/objectstack-data/rules/security.md 新加的那条;scripts/check-skills-token-ratchet.mjs 里这个文件的上限行。
  • 两分钟验证:运行 node scripts/check-skills-token-ratchet.mjs,这个文件应为 3959 / 3959,退出码 0。
  • 需要你做的:批准并入队(Tier H,skills/**)。上限从 3768 提到 3959(+191),依据常设裁定 6513306068 字母 B。先删了 1 处重复(secret 的 fail-closed 句,field-types.md L44 仍保留「fail-closed (ADR-0100)」),余额按实测提高。今天 docs(skills): objectstack-data security.md teaches that a package's sharing rule resolves its queue recipient from its package #31777 已经在这个文件里删过 9 处重复,所以这次能删的只剩这一处。
  • 席位意见:ACCEPT。席位对照 feat(core, plugin-security)!: permission sets resolve by (package, name), and a package position's sets resolve from its package (ADR-0150 E3) #31815 合并的代码逐句核对过,没有不准确的地方。

席位核对

Head-sha: 4187450a30f4c538258f614b24c1ef4e03aabbed

  1. Shape: draft, base main, Fixes #31819, Clause-②: no, Metadata-protocol: none. 4 files, +51/−5. Tier H by skills/**.
  2. Premise measured: on main d6e28c0b, the section said only that a position grants the sets it names. It said nothing about which package's set a bare name reaches.
  3. Code read: the seat checked each clause at this head.
    • The step order and the refusals: security-catalog.ts resolvePermissionScoped runs resolvePackageScopedHolders with the position's package as caller. A refusal "is the answer, and it confers nothing" (never a fallback). A set that only the metadata service holds is the D3 (a) outside-closure refusal naming the environment.
    • The environment-wide callers: referenceCaller returns null for an audience anchor, for a position with no package or the overlay sentinel, and for a registry slot that is not the package's own shipped position (an environment row, overlay or .custom override).
    • The boot report: catalog-reference-report.ts L356–379 lists refusals with reason and every candidate.
    • "A second package shipping a name is refused at install first": objectql/src/security-catalog-namespace.ts keeps one holder per name for positions, permission sets and capabilities, across packages, the environment and built-ins. So ambiguous-in-closure is rare, and the bullet says so.
    • Eval 19 asserts permissionSets: ['hd_agent'], dependencies: { and outside-closure, and rejects redeclaring the set.
    • Gates: the dev derived 62 gates; 61 exit 0, and check:dual-build-cjs-loads exited 3 (NOT MEASURED, needs a full build; CI runs it). The ratchet was re-run at the final head and exits 0. Check-runs on this head: 29 success, 15 skipped, none red. K = 0.
  4. Accepted deviations: a single restatement cut. Its survivor keeps "fail-closed (ADR-0100)" but drops the "writes throw with no crypto provider" detail. That is acceptable for a pointer to a reference table.
  5. Out of scope / Skills-docs: Metadata-protocol: none, so no Skills-docs: line is owed. skills: objectstack-automation says a packaged assignment rule's queue and a packaged flow's queue approver resolve from the package and its declared dependencies (follow-up of #31790) #31853, the matching follow-up for assignment-rule and approval queues, is a separate card.
  6. Landing: Tier H. pm:awaiting-merge plus reviewers os-zhuang and hotlong. The PR stays draft until an authorized approval or a maintainer enqueue.

@objectstack-fleet objectstack-fleet Bot added the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 9, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review November 9, 2026 08:09
@os-zhuang
os-zhuang added this pull request to the merge queue Nov 9, 2026
Merged via the queue into main with commit e27efff Nov 9, 2026
50 checks passed
@os-zhuang
os-zhuang deleted the claude/project-thread-xklyph branch November 9, 2026 08:25
@objectstack-fleet objectstack-fleet Bot removed the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 9, 2026
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 size/s tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

skills: security.md says a package position's permission sets resolve from its package and declared dependencies (ADR-0150 E3 Skills-docs follow-up)

2 participants