Skip to content

feat(lint): warn when a permission set reads a roll-up summary over child data it cannot read - #31046

Merged
objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/sec-hardening-r14
Nov 6, 2026
Merged

objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/sec-hardening-r14

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

security#1 · os-tesla · session_01L9qibvynRbCtMndW8EHNGc

Clause-②: yes (widening) — @objectstack/lint exports one new rule function, validateRollupSourceVisibility, its two rule-id constants SECURITY_ROLLUP_SOURCE_UNREADABLE and SECURITY_ROLLUP_SOURCE_ROW_SCOPED, and two finding types; nothing that passed before is refused.
Metadata-protocol: none

维护者速读

  • 改了什么:@objectstack/lint 新增一条作者期提示规则。权限集能看到父对象上的汇总(roll-up)字段,但读不到子对象、读不到被汇总的子字段、读不到汇总 filter 用到的子字段,或子对象行被行级策略收窄时,os lint / os validate / os build 会提示。「能读」按运行时的三道门判断:对象授权、字段条目、requiredPermissions 能力门(View All 不解除能力门)。
  • 为什么改:按维护者裁决(2026-11-06,选项 A),汇总字段保持已文档化的语义:系统身份按整个子集合重算,读取时只看父字段自己的字段权限。作者配置权限集时需要被告知这一点,此前没有任何提示。
  • 风险与回滚:只有 warning 与 info,任何入口都不拒收,默认不会让 os lint / os validate 失败(仅 --strict 会把 warning 当错误);不上运行时发布门禁。示例应用实测:showcase 9 条 warning、2 条 info,crm / todo / multi-package 为 0。回滚即还原本 PR,无迁移。
  • 先看:packages/lint/src/validate-rollup-source-visibility.ts(三道门与判定顺序);packages/lint/src/authoring-rules.ts 新增条目(advisory、只在 CLI 的理由);packages/lint/src/validate-rollup-source-visibility.test.ts。
  • 两分钟验证:pnpm --filter @objectstack/lint exec vitest run --maxWorkers=2 src/validate-rollup-source-visibility.test.ts,预期 43 个测试全绿。
  • 需要你做的:无,席位落地

What changes

A summary (roll-up) field keeps its documented semantics: it is a stored column on the parent, recomputed as the system over the whole child collection after every child write, and on read it follows only the parent field's own field-level security (content/docs/data-modeling/fields.mdx, the roll-up section; the "Why the recompute is system-elevated" docblock in packages/objectql/src/engine-summaries-and-expansion.ts; ADR-0035 "Server-side rollup"). So a permission set that can see the summary column still reads the roll-up when it cannot read the child data the roll-up aggregates. Nothing told the author that when they configured the set. This adds an author-time rule that does.

"Can read", as the runtime decides it

The rule folds the three gates the runtime applies, on both sides of the roll-up:

  • Object grant. The set's own entry for the object, otherwise its '*' entry. A '*' entry covers an access.default: 'private' object only with View All / Modify All (resolveObjectPermission).

  • Field entry. readable: false hides the field, unless the set holds View All / Modify All on the object, which votes every field readable. A set with no entry for a field reads it.

  • Capability gate (ADR-0066 D3). The read is refused, or the field hidden, unless the set's systemPermissions hold every listed capability. It reads:

    • the object's requiredPermissions, as a list or as the read bucket of the per-operation map (objectReadAdmission step 4);
    • the field's requiredPermissions (foldFieldRequiredPermissions).

    View All and Modify All lift neither.

What is judged, per permission set × summary field

The pair is judged only when the set can see the summary column. That means it reads the parent object and the summary field through all three gates. A set that cannot see the column learns nothing from it and is not reported.

Then, over the child object summaryOperations.object names, in order, with one finding per pair:

Arm Rule id Severity
(ii) the set cannot read the child object (no grant, or the object's read capability missing) security-rollup-source-unreadable warning
(i) the set cannot read summaryOperations.field (readable: false, or the field's capability missing) security-rollup-source-unreadable warning
(i′) the set cannot read a top-level field key of summaryOperations.filter, by the same test security-rollup-source-unreadable warning
(iii) all of the above are readable, but the set's reads of the child meet a row policy (see below) security-rollup-source-row-scoped info

Notes on the arms:

  • (i) and (ii) share one id because the consequence and the remedy are the same.
  • A count reads no value, so its field is not judged. Its filter is judged.
  • In a filter, a dotted key reads through a lookup into another object and is not judged.
  • A child object this stack does not define is not judged.

Row policies for (iii):

  • Policies that count:

    • one of the set's own read-class rowLevelSecurity entries: select or all, on the child or '*', not enabled: false, with a using;
    • when the set carries none of those, the child's defaultRowScope.
  • View All / Modify All on the child skips this arm only on the postures where the runtime's read filter skips business row security (posturePermits in security-plugin-rls-filter.ts):

    • a private child;
    • a child with tenancy off;
    • an auth-managed child.

    On any other child the set's policies still narrow its rows and are noted.

Example findings (from the test fixture)

permission set "warehouse_staff" · summary field "invoice.total"
"invoice.total" summarizes "invoice_line.amount", which permission set "warehouse_staff" cannot read without capability "finance.read"; a roll-up aggregates the whole child collection and follows only the parent field's own permissions
fix: If its value should not be visible to this set, set fields["invoice.total"]: { readable: false } on it. That hides "invoice.total" from every holder of the set, and a co-held set with no entry for it does not restore it (View All or Modify All on "invoice" does); to keep it for some holders, declare fields["invoice.total"]: { readable: true } in the sets they hold
"invoice.high_lines" counts "invoice_line" records filtered on "invoice_line.band", which permission set "warehouse_staff" cannot read without capability "grading"; …

The fix line states how far the remedy reaches. In the field merge only sets that declare an entry vote, so readable: false on one set hides the column from every holder of that set. When the set holds View All or Modify All on the parent, the fix line says to remove that bit first, because a readable: false entry does not hide a field from a set holding either.

Registration

Files

  • packages/lint/src/validate-rollup-source-visibility.ts (new): the rule, the two ids, the finding types.
  • packages/lint/src/authoring-rules.ts: the registry entry.
  • packages/lint/src/index.ts: exports the function, the two ids and the types.
  • packages/lint/src/rule-explanations.ts: an os explain entry for each id. They cover:
    • the three gates;
    • the filter fields judged, and dotted filter keys not judged;
    • the row-security posture of View All;
    • the reach of the remedy.
  • packages/lint/src/validate-rollup-source-visibility.test.ts (new): 43 cases.
  • content/docs/data-modeling/fields.mdx: the roll-up section's sentence on the rule and the reach of the remedy.
  • content/docs/deployment/validating-metadata.mdx: the rule's row in the four-doors table, plus the transcript's rule count.
  • content/docs/deployment/cli.mdx, content/docs/getting-started/build-with-claude-code.mdx, content/docs/ui/react-pages.mdx: the CLI transcript's author-time rule count, 63 to 64 (check:docs-transcript-drift).
  • .changeset/rollup-source-visibility-lint.md: @objectstack/lint patch.

Tests

validate-rollup-source-visibility.test.ts has 43 cases. Every positive case runs through the registry runner (runAuthoringRules), so the cases go red when the registration goes.

  • (i) hidden child field:
    • invoice_line.amount hidden warns on invoice.total, and not on the count beside it;
    • the same answer on lint, validate and build, never as an error;
    • a set parsed by PermissionSetSchema answers what the raw one does.
  • (ii) unreadable child object:
    • no entry on the child;
    • an entry with allowRead: false;
    • a '*' read grant beside a private child;
    • the count is reported too, and there is one finding per summary.
  • Capability gate:
    • Warns:
      • a gated child field the set lacks the capability for;
      • several capabilities, with the missing ones named;
      • a gated child object, in both the list form and the { read } map form, with the count included;
      • View All / Modify All on the child with a missing field or object capability.
    • Silent:
      • a gated summary column, including under View All on the parent;
      • a gated parent object, in both forms.
    • Controls:
      • a held capability reads the field, the object, the summary column and the parent;
      • a map that gates only update / delete does not gate a read.
  • Filter fields:
    • a filter on a hidden field warns on the filtered count and the filtered sum;
    • a filter on a capability-gated field warns, and holding the capability is the control;
    • every authored filter shape is read: $and / $or, $not, an AST triple, an AST and group;
    • silent when every filtered field is readable;
    • a dotted key is not judged.
  • (iii) row-scoped note:
    • the set's own select policy, an all policy, a '*' policy, the child's defaultRowScope, and positions named in the message;
    • policies that do not scope a read are silent: disabled, update, another object, check-only;
    • a held read-class policy displaces the default row scope.
  • View All on the child:
    • it makes a hidden child field readable;
    • on a public child, the set's read policy and the child's default row scope are still noted;
    • silent on a private child, tenancy.enabled: false, systemFields.tenant: false and managedBy: 'better-auth', for both bits;
    • control: a tenancy-off child without the bypass is noted.
  • Other negatives:
    • the set reads the source;
    • the summary column is hidden for the set;
    • the set cannot read the parent;
    • a '*' grant over a public child;
    • a child this stack does not define.
  • Verdict text:
    • inline snapshots of the message for each arm (hidden field, unreadable object, capability-gated field, capability-gated filter field, row policy);
    • inline snapshots of the hint, both normal and with View All on the parent;
    • one line each;
    • an os explain entry for each id;
    • the registry entry is advisory and has a surfaceReason.

Ablations on 44f8346. Each was a one-shot node scripts/ablation-replace.mjs over the new test file plus authoring-rule-wiring.test.ts (69 tests). Each was restored by git checkout HEAD -- <file>, the restored blob equals HEAD, and the tree was clean afterwards.

Ablation Change Result Blob after restore
Registration the AUTHORING_RULES entry deleted 29 failed / 40 passed 823eb6d538
Capability gate missingCapabilities always empty 9 failed / 60 passed: every capability-gate positive and silence case, the capability filter case and the snapshot case. The controls stay green. f5a9fc04d6
Row-security posture the posture test forced true 2 failed / 67 passed: the two public-child View All note cases f5a9fc04d6
Filter fields filter keys dropped 4 failed / 65 passed: the three filter positives and the snapshot case f5a9fc04d6

Acceptance notes

  • Example apps, measured on 44f8346 with os lint --json and os validate --json (exit 0 on all four):
    • app-showcase: 9 warnings and 2 notes, the same findings as before this round;
    • app-crm, app-todo, app-multi-package: none.
    • No example object or field declares requiredPermissions, so the capability arm adds nothing there.
    • Showcase's filtered roll-ups (rejected_count, approved_amount and the others on showcase_expense_report) are already reported through the child-object arm for showcase_member_default.
    • The apps are unchanged.
    • Showcase's breakdown:
      • showcase_member_default cannot read showcase_expense_line: 6 warnings;
      • showcase_client_liaison cannot read showcase_task: 2 warnings;
      • showcase_ops cannot read showcase_invoice_line: 1 warning;
      • showcase_contributor's task_own_rows narrows showcase_task: 2 notes.
  • Left out of (iii), by design: record sharing (sharingModel, readScope). Only a policy's presence is judged, never its predicate.
  • Each set is judged on its own: a holder of two sets reads what their union grants, capabilities included.
  • Left to separate cards, per the review:
    • the runtime publish gate (option B);
    • an acknowledgement for intentional roll-ups, and fixing the showcase sets after that decision.
  • Not catalogued in skills/objectstack-data/references/lint-rules.md: that table is a selection, and skills/** is a governed surface.

Verification

Everything below ran on 44f8346, the head. The commit before it, ee601bf, is the fix round; 44f8346 only moves a tracker id out of the surfaceReason string into an adjacent comment.

  • pnpm --filter @objectstack/lint test: Test Files 197 passed (197), Tests 8331 passed.
  • pnpm --filter @objectstack/lint typecheck: exit 0 (check:test-typecheck: OK). The public surface is unchanged from the previous head (same exports, same types), so the consumer typecheck from the first round (77 of 77 turbo tasks) still covers it. Type Check · consumer gates and Type Check · workspace are green on this head.
  • node scripts/pm/dispatch-gates.mjs --commands on 44f8346: 88 commands, each run with stdin from /dev/null, all exit 0, including check:doc-authoring. --ran with the recorded exit codes: 88 derived, 88 run, 0 NOT-MEASURED, 0 UNRUN.
  • node scripts/pm/check-governed-merges.mjs --branch origin/claude/sec-hardening-r14: NOT governed, 0 of 11 paths, 1228 changed lines (+1224 / −4).
  • CI on 44f8346: 57 success, 8 skipped, 0 failure.
  • Dogfood: not derived (no ! in the title, no (narrowing) arm).

Generated by Claude Code

@github-actions github-actions Bot added size/l 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 6, 2026
@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/lint, touching 41 documentable anchor(s). ⚠️ 1 changed file(s) yielded no anchor (packages/lint/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.

25 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: node scripts/docs-audit/affected-docs.mjs --json e1dac19257184aa28115ead12c4ce0918d55b2b4.

⛔ 3 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails.

What this run could not see
  • 1 changed file(s) yielded no anchor (packages/lint/src/index.ts) — pages documenting those are invisible to this run
  • 14 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 63 of 224 client-bound route-ledger rows — the other 161 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 161: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 57 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 104 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 — 4 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 e1dac19257184aa28115ead12c4ce0918d55b2b4 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 39d564057e55f81f5f6799713909eb06b0645f63 — the merge of head 44f83463eae437ec760d31c6f9a7863f8b2949b3 into base e1dac19257184aa28115ead12c4ce0918d55b2b4, 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 39d564057e55f81f5f6799713909eb06b0645f63 && git checkout 39d564057e55f81f5f6799713909eb06b0645f63
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin e1dac19257184aa28115ead12c4ce0918d55b2b4 44f83463eae437ec760d31c6f9a7863f8b2949b3 && git checkout -B drift-repro e1dac19257184aa28115ead12c4ce0918d55b2b4 && git merge --no-ff 44f83463eae437ec760d31c6f9a7863f8b2949b3

node scripts/docs-audit/affected-docs.mjs --json e1dac19257184aa28115ead12c4ce0918d55b2b4

⚠️ 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 e1dac19257184aa28115ead12c4ce0918d55b2b4 → 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

security#1 · os-tesla · session_01L9qibvynRbCtMndW8EHNGc

Contract review

Served-tier: TIER_DEFAULT
Head-sha: 3b340ba21456c28faab599a6e2c9eeb23a382048
Local-runs: none

Reviewed 2026-11-06T20:37Z on the net diff origin/main...3b340ba214 (merge base 41dc302496, 11 files, +799 −4), the PR body, the file list and the head's check-runs. The rule's semantics were judged against the cited code on main only.

Check-runs on this head, as they stand: 61 runs: 17 success, 8 skipped, 0 failure, 36 still in progress. The success runs include Check Changeset, Governed Surface Queue Guard, Lint · ESLint, Lint · PM dispatch-gates, PR-body guards, Spec property liveness, Type Check · source gates, Check Documentation Links and Dogfood Regression Gate. Still in progress: Build Core, Build Docs, Build and E2E UI, Live E2E UI, Test Core 1–8 of 8, Test UI 1–16 of 16, Type Check UI, Type Check · workspace, Type Check · consumer gates, Type Check · debt ledger, and Lint · CI, release and engine gates, docs and code guards, repo and tooling gates, scoped slot lookup and corpus. check:docs-transcript-drift, which judges the 63→64 edits, runs in one of the Lint jobs that has not finished. None of these is red yet. None of them is green yet either.

① Derived judgments

Public surface (packages/lint/src/index.ts): right. It adds validateRollupSourceVisibility, SECURITY_ROLLUP_SOURCE_UNREADABLE, SECURITY_ROLLUP_SOURCE_ROW_SCOPED, RollupSourceVisibilityFinding and RollupSourceVisibilitySeverity. They follow the existing shape for security rules (the SecurityFinding / SecuritySeverity pair beside them). Nothing is removed or renamed.

Rule ids: right. security-rollup-source-unreadable (warning) and security-rollup-source-row-scoped (info) sit in the security- family. Arms (i) and (ii) share one id, and that holds up: both tell the author the same consequence and give the same remedy. Each id has an os explain entry in RULE_EXPLANATIONS.

Registry entry: right on every field except the reason text.

  • tier: 'advisory': right. The rule emits only warning and info, so no stack that loaded before is refused.
  • input: 'parsed': right. Every key it reads is declared by the spec (enabled, operation, readable and their defaults).
  • commands: ALL: right.
  • surfaces: CLI_ONLY: acceptable for this PR (see ③(1)).
  • surfaceReason: present, but it names the wrong precedent (S4).
  • Count: the registry on origin/main has 63 entries and the head has 64. The CLI prints registered.length (compile.ts:558, validate.ts:514), so the four transcript edits from 63 to 64 match the tree. No other (63) is left in content/.

Docs. The four-doors row is correct: the columns are validate / build / lint / runtime publish, and the row reads ✓ ✓ ✓ —, which is CLI-only. The #the-one-gate-four-doors anchor exists. The new sentence in fields.mdx ("os lint, os validate and os build warn about each such set") and its remedy clause promise more than the rule does (M1, S2).

Where "can read" matches the runtime. These points were checked against main:

  • The set's explicit object entry, otherwise its '*' entry, and a private object covered by '*' only through View All / Modify All. Same as resolveObjectPermission in permission-evaluator.ts.
  • isPrivate means access.default === 'private'. Same as security-plugin.ts.
  • The read verb goes through objectPermissionGrants, the same fold the evaluator uses.
  • A field with no entry is readable. readable defaults to true in FieldPermissionSchema. readable: false beside a when is refused at parse, so no hide is ever conditional.
  • A readable: false next to View All on the parent does nothing, as superuserFieldVote decides. An explicit entry shadows a super-user '*' entry, as holdsSuperuserBypass in core decides; the lint copy is identical.
  • Which RLS policies apply: enabled, the object or '*', and select / all, as in RLSCompiler.getApplicablePolicies. The positions domain is named in the message rather than judged.
  • defaultRowScope gives way to any applicable policy the set holds, as object-default-row-scope.ts does.

Where "can read" does not match the runtime.

  • M1 (must-fix): the ADR-0066 D3 capability gate is not modelled on either side.
    The runtime refuses an object read when the caller lacks a capability in the object's requiredPermissions read bucket, however permissive the grants are. View All does not lift this (objectReadAdmission, step 4). It also hides a field whose requiredPermissions the caller does not fully hold. That fold runs after the super-user vote, so View All does not lift it either (foldFieldRequiredPermissions). The rule reads neither the field's or object's requiredPermissions nor the set's systemPermissions. What the author is then told:

    • (a) Nothing, when the aggregated child field or the child object is gated by a capability the set lacks. This is the platform's own way of keeping a sensitive field from a population, which makes it the textbook case for this rule.
    • (b) A warning, plus a remedy that changes nothing, when the summary column or the parent object is gated by a capability the set lacks. In that case the set cannot read the roll-up at all.
    • (c) The View All parent hint says the column "cannot be hidden from this set while it holds View All or Modify All". That is false for a column that carries requiredPermissions.
    • (d) The child-side skip claims a View All / Modify All holder "reads every child row and field". That is false for a capability-gated field.

    Sentence (d) is in the explain entry, the changeset body (which ships as CHANGELOG.md), the PR body and the docblock. The fix: judge requiredPermissions against the set's own systemPermissions, field-level and object-level read bucket, on both parent and child. Add one negative and one positive test for each side. Then align the sentences in the explain entry, the changeset and fields.mdx.

  • S1 (should-fix): the View All / Modify All skip on the child is wider than the runtime for arm (iii).
    The read filter skips business RLS for a super-user only when the object's posture permits it: private access, tenancy disabled, or auth-managed (security-plugin-rls-filter.ts, where superuserBypass is false unless posturePermits). On a public child, a View All holder's own read policies and the child's defaultRowScope still narrow the rows it reads. The case "the set holds View All or Modify All on the child" pins silence for a public child that carries a select policy. Apply the arm-(iii) half of the skip only to a private child. The field half can stay.

  • S2 (should-fix): the remedy does not say that it reaches every holder of the set.
    In the field merge (getFieldPermissions), only sets that declare an entry vote. So fields["…summary"]: { readable: false } on one set hides the column from every holder of that set, including holders who read the child through another set. A co-held set with no entry for the column casts no vote and does not restore the read. Six of the showcase's nine warnings are on showcase_member_default, the additive everyone baseline (isDefault: true). Following the hint there would hide the expense totals from contributors who read the lines. The hint and the explain entry should say this, and name the alternative: declare readable: true on the column in the sets that should keep it.

  • S3 (should-fix): summaryOperations.filter reads child fields that are not judged.
    A filtered count or sum over a predicate on a field the set cannot read tells the reader something about that field. Examples: a count where a hidden band field matches, or the showcase's filtered rejected_count / approved_amount shapes. Either judge the filter's field references under arm (i), or state in the explain entry that they are not judged.

  • Per-set judgment (a holder of two sets reads their union) is declared plainly and is a fair limit for a rule that never refuses.

Dev deviation: messages pinned by inline snapshots. Accepted. This is the first toMatchInlineSnapshot under packages/. It pins the exact one-line text the author reads, and that text is the contract here. The only cost is that vitest -u can rewrite a snapshot without anyone deciding to. A reviewer should therefore read any snapshot change in a diff as a change to the message.

② Semver level

The patch changeset on @objectstack/lint matches what the diff publishes.

  • No other package changes. content/ is not a package.
  • Metadata-protocol: none is right: nothing an author can write is added, refused or redefined.
  • AGENTS.md post-task step 3 maps none to patch.
  • Clause-②: yes (widening) is right: the package's public exports widen, and nothing that passed is refused.
  • A new warning failing an os lint --strict run is the documented opt-in of --strict, not a narrowing. The changeset says so, as the 30804-lint-namespace-prefix-every-name precedent does.
  • Both declaration lines open a line in the PR body and in the changeset. Check Changeset is green.

The M1 fix reads keys the spec already declares, so the level stays none / patch.

③ Boundary flags

(1) Runtime publish gate. Answer: A for this PR. B as a separate card, sent to the maintainer.

S4 (should-fix): the shipped surfaceReason treats a permission-write crossing as needing the object-door volume fence's ruling. That fence is written about object rules. Reword it to give the actual reason: there is no per-write measurement on permission writes yet, and object writes would be fenced.

(2) Record sharing in the row-scope arm. Answer: no, not in this PR.

  • On an owner-scoped private child, every set without View All defaults to own depth (getEffectiveScope). A note there would fire on nearly every lookup roll-up over a private child.
  • A controlled_by_parent detail takes its access from the master, so for the master-detail roll-up shape sharing narrows nothing the reader cannot already see through the parent.
  • The explain entry already says sharingModel / readScope are not read, which is the honest statement.
  • If this is wanted later, a separate card can scope it narrowly: a private child that is not controlled_by_parent, where the set declares a readScope narrower than org. Measure it on the example apps first.

(3) Intentional roll-ups warn permanently. Answer: leave it in this PR. Send the decision to a separate card. Do not edit the showcase sets as a reflex.

  • Per S2, the hint's remedy applied to the everyone baseline would also hide totals from contributors.
  • An acknowledgement key is a new key an author can write: Metadata-protocol: added, minor, with its own ruling. It should be designed once across warning-only rules, not for one rule.
  • The card should choose between:
    • (a) Treating an explicitly authored readable: true on the summary column, in that set, as the acknowledgement. No new key is needed, but the parse materializes readable: true as a default, so the rule would have to read the normalized input to tell an authored value from a default.
    • (b) A generic acknowledgement key.
  • Then fix the showcase per the decision. Nine standing warnings in the reference app teach authors to ignore the channel, so this should not wait long.

Implemented-by: claude/sec-hardening-r14
Reviewed-by: session_01L9qibvynRbCtMndW8EHNGc

VERDICT: FAIL

…filter fields and the row-security posture

"Can read" now folds the capability gate on both sides of the roll-up: an
object's requiredPermissions (the list, or the read bucket of the
per-operation map) and a field's requiredPermissions against the set's own
systemPermissions. A set that cannot see the summary column through it is not
reported; a set that cannot read the child object or field through it is,
even with View All or Modify All on the child, which do not lift the gate.

The child fields summaryOperations.filter tests are judged like the
aggregated field, top-level keys only.

The View All / Modify All skip of the row-scope note applies only to a
private, tenancy-off or auth-managed child, the postures on which the bypass
skips row security; on any other child the set's row policies still narrow
its reads and are noted.

The fix line now states the reach of the remedy: readable: false on a set
hides the summary column from every holder of that set, a co-held set with no
entry does not restore it, and readable: true in the sets whose holders
should keep it does. The registry entry's surfaceReason names the actual
reason the rule stays CLI-only.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibvynRbCtMndW8EHNGc
@github-actions github-actions Bot added size/xl and removed size/l labels Nov 6, 2026
…n string

The precedent the reason names moves to an adjacent comment; the string
names it by the rule that crossed.

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

Copy link
Copy Markdown
Contributor Author

security#1 · os-tesla · session_01L9qibvynRbCtMndW8EHNGc

Contract review

Served-tier: TIER_DEFAULT
Head-sha: 44f83463eae437ec760d31c6f9a7863f8b2949b3
Local-runs: none

Reviewed 2026-11-06T22:32Z on the net diff origin/main...44f83463ea (merge base 41dc302496, 11 files, +1224 −4), the delta 3b340ba214..44f83463ea (7 files, +556 −131), the PR body as rewritten at this head, the file list and the head's check-runs. The rule's semantics were judged against the cited code on main. Every cited runtime and spec file is byte-unchanged between the merge base and origin/main at bd1b7685fc, and main still registers 63 author-time rules, so the 63→64 transcript edits still match.

This record supersedes the FAIL on 3b340ba214 (2026-11-06T20:37:41Z).

Check-runs on this head: 69 runs, 59 success, 10 skipped, 0 failure, none in progress. Nine of the ten required contexts are success: Lint & Repo Gates, TypeScript Type Check, Test Core, Build Core, Governed Surface Queue Guard, Type Check UI, Test UI, Build & E2E UI and Live E2E UI. Lint UI is skipped. Check Changeset, PR-body guards, every Lint · job (which carries check:docs-transcript-drift and check:doc-authoring), the Type Check · jobs and Dogfood Regression Gate are success.

① Derived judgments

The previous must-fix and should-fixes, judged in the tree.

  • M1 (capability gate): answered.
    • Object side. objectReadCapabilities reads the string[] form as gating every operation, and the per-operation map through its read bucket alone. That is normalizeRequiredPermissions followed by requiredCapsForOperation(spec, 'find') on main: find maps to allowRead, which maps to the read bucket, and the map form's all bucket is always empty. PerOperationRequiredPermissionsSchema is .strict() over read / create / update / delete, so no other key can carry a read gate.
    • Field side. fieldCapabilities reads the field's requiredPermissions, which is what getObjectSecurityMeta collects into fieldRequiredPermissions, from both the list and the map form of fields.
    • The fold. missingCapabilities is the AND-gate against the set's own systemPermissions, which is getSystemPermissions restricted to one set. It ignores the super-user bits. That matches objectReadAdmission step 4, which runs ahead of the grant, and foldFieldRequiredPermissions, which runs after the getFieldPermissions super-user vote in maskOperationResult.
    • Both sides of the roll-up are covered. The parent object and the summary column go through all three gates before a pair is judged. The child object, the aggregated child field and the filter fields go through the same gates.
    • The four sentences the previous record named are corrected:
      • (a) A gated child object or field now warns, with the missing capabilities named.
      • (b) A gated parent or summary column is now silent, including under View All on the parent.
      • (c) The View All parent hint now says that readable: false does not hide a field from a set holding either bit. It no longer says the column cannot be hidden.
      • (d) "reads every child row and field" is gone from the docblock, the explain entry, the changeset and the PR body. A tree-wide grep finds no copy left.
    • Tests cover both forms, the controls (a held capability, and a map that gates only writes) and View All not lifting either gate.
  • S1 (View All skip on the child): answered. postureSkipsRowSecurityForSuperuser takes four postures: access.default: 'private', tenancy.enabled === false, systemFields.tenant === false and managedBy: 'better-auth'. Those are the runtime's posturePermits (meta.isPrivate || meta.tenancyDisabled || meta.isBetterAuthManaged), with tenancyDisabled spelled as the same two clauses in getObjectSecurityMeta. The tenancyDisabledCache does not enter posturePermits, and it does not enter the rule either. The skip now applies only to arm (iii). The field half still comes from fieldHidden's super-user vote, and the capability half is never skipped. On a public child, the runtime's superuserBypass is false, collectRLSPolicies runs and an empty collection falls through to the child's defaultRowScope, which is what the two public-child cases pin. The control case (a tenancy-off child without the bypass, still noted) is there.
  • S2 (reach of the fix line): answered in the hint and the explain entries, and partly in fields.mdx (S6). The hint now says that the entry hides the column from every holder of the set, that a co-held set with no entry does not restore it, that View All or Modify All on the parent in a co-held set does, and that readable: true keeps it for chosen holders. That is the getFieldPermissions merge, where only declaring sets vote and superuserFieldVote applies afterwards.
  • S3 (filter fields): answered for bare keys. filterFieldKeys walks summaryOperations.filter with the shared walkFilterFieldKeys. That covers $and / $or, $not, operator leaves and implicit equality. It also covers the AST and view-rule shapes, which the parse refuses before this rule runs on filter, so they are harmless extras. Each bare key goes through the field gates. A count's field is still not judged, and its filter is.
  • S4 (surfaceReason precedent): answered. The reason now says that no per-write measurement exists of what a permission save hands the rule. That is exactly the measurement the validateRetiredPermissionResidue entry on main records as taken before it crossed on permission writes. Object writes are named as falling under RUNTIME_OBJECT_ADVISORY_VOLUME. The tracker id now sits in the adjacent comment, not the runtime string.

Tested against the new logic, beyond the fixes: held.

  • Map form against list form, and a map that gates only update / delete: no read gate, which matches requiredCapsForOperation.
  • View All on the child against a gated child field or object: it still warns, because the field fold runs after the super-user vote and the object gate runs ahead of the grant.
  • View All on the parent against a gated summary column: silent, because the column is hidden whatever the bits.
  • A '*' View All entry on a private child: it grants the read, as resolveObjectPermission does, and it counts for the posture skip, as holdsSuperuserBypass in core does (the lint copy is identical).
  • rowLevelSecurity[].operation is required by the spec, so the select / all test does not depend on a default.
  • Arm order (object, value, filter, row) and one finding per pair: the first unreadable filter key names the finding. That is a fair choice for a one-line verdict.

New should-fixes.

  • S5 (should-fix): a dotted or nested filter key is skipped whole, including its first hop, which is a child field.
    • Both spellings of a relation condition are skipped. { 'account.region': 'emea' } reaches the walker dotted. { account: { region: 'emea' } } is turned into the dotted account.region by conditionFieldKeys.
    • filterFieldKeys drops every key that contains a dot. So a set with fields["invoice_line.account"]: { readable: false } reads a count filtered through account and is told nothing. The docblock's own arm 3, "it cannot read a child field summaryOperations.filter tests", covers that hop.
    • Proposed fix: judge the first segment (field.split('.')[0]) as a child field under the same three gates. Leave the far object unjudged, or judge it against the stack's object graph.
    • Otherwise, narrow the wording to what the tree does in all three places: the explain entry, the docblock and the PR body. Each would say: "a relation key, dotted or nested, is not judged, its first hop included". The explain entry also calls the judged keys "top-level", although keys inside $and / $or / $not are judged too. "Bare" is the accurate word.
  • S6 (should-fix): the remedy sentence in fields.mdx leaves out the View All caveat that the hint and the explain entry carry. It reads "set readable: false on the summary field in that set: it hides the field from every holder of the set". On a set holding View All or Modify All on the parent, that entry is inert (superuserFieldVote), so a reader who follows the doc changes nothing. The fix is one clause: "(a set holding View All or Modify All on the parent must drop that bit first)".

Non-blocking notes.

  • The registry entry's leading comment in authoring-rules.ts still lists only "a hidden source field, an unreadable child object, or child rows a row-level policy narrows". It does not mention the capability gate or the filter fields.
  • The rule reads posture from the authored stack. A deployment that declares an object platform-global gets systemFields.tenant: false from the registry at boot. The rule cannot see that, so for a View All holder there it may emit an info note that the runtime would not apply. This is the off-stack limit every CLI-only rule has.
  • On a child field that carries both a maskingRule and requiredPermissions, a caller without the capability is served the masked value. The finding's "cannot read without capability" is then loosely true: the set reads the field masked, never in full. It is not misleading enough to change.
  • PR body: "CI on 44f8346: 57 success, 8 skipped" is a snapshot. The head now reads 59 success and 10 skipped. The "43 cases" claim matches the tree.
  • Inline snapshots: the previous record's acceptance carries forward. Five toMatchInlineSnapshot sites pin the message and hint text. Read any snapshot change in a diff as a change to the message.

② Semver level

The patch changeset on @objectstack/lint matches what the diff publishes now.

  • The delta does not touch packages/lint/src/index.ts. The five exports and two types are the ones the previous record judged, and no other package moves.
  • Metadata-protocol: none is right. The capability fold reads requiredPermissions and systemPermissions, which the spec already declares. Nothing an author can write is added, refused or redefined. AGENTS.md post-task step 3 maps none to patch.
  • Clause-②: yes (widening) is right. The package's public exports widen, and nothing that passed before is refused. A new warning failing a --strict run is the documented opt-in, not a narrowing.
  • Both declaration lines are line-initial in the PR body and in the changeset, and Check Changeset is green.
  • The S5 and S6 fixes read declared keys and edit prose, so the level stays none / patch.

③ Boundary flags

The delta changes none of the three answers. They carry forward from the previous record.

  • (1) Runtime publish gate: A for this PR (CLI-only). B as a separate card, sent to the maintainer. The S4 rewording now states this answer's actual reason in surfaceReason. Crossing on permission writes needs the per-write measurement the residue rule took first. Crossing on object writes stays behind the object-door volume fence. Neither is opened here.
  • (2) Record sharing in the row-scope arm: no, not in this PR. The explain entry and the PR body say that sharingModel / readScope are not read, and that is the honest statement. A later card could scope it narrowly, as the previous record described.
  • (3) Intentional roll-ups that warn permanently: the acknowledgement question is its own card. Do not edit the showcase sets as a reflex. With S2's reach now in the hint, an author is told that hiding the totals on showcase_member_default, the additive everyone baseline, would hide them from every holder. The showcase still carries 9 warnings and 2 notes, so the card should not wait long.
  • New dev flag, accepted: the rule is not catalogued in skills/objectstack-data/references/lint-rules.md. That table is a selection, and skills/** is a Tier H governed surface. Leaving it out keeps this PR off the governed register: 0 of 11 paths are governed, and 1228 changed lines is under the 3,000 line class.

Implemented-by: claude/sec-hardening-r14
Reviewed-by: session_01L9qibvynRbCtMndW8EHNGc

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

security#1 · os-tesla · session_01L9qibvynRbCtMndW8EHNGc

席位核对

ACCEPT · 2026-11-06T22:33Z · head 44f83463eae437ec760d31c6f9a7863f8b2949b3

  • Contract review: PASS at this head, TIER_DEFAULT (declaration face: the changeset's Clause-②: yes (widening)), record 6697493774. It supersedes the FAIL on 3b340ba214 (6694954022): its must-fix (the permission capability gate left out of "can read") and its four should-fixes are answered in the tree. No must-fix. Two new should-fixes (dotted filter keys; the View All caveat in one docs sentence) are follow-ups this seat carries.
  • What lands: an author-time check, CLI only (os lint, os validate, os build), that warns when a permission set can read a roll-up field but not its source (the summarised child field, the child object, or a filter field, each judged with the capability gate), and notes when the set's own row scope on the child narrows what the roll-up counts. It never refuses a stack. This is the author-time half of the maintainer's 2026-11-06 choice for roll-ups (keep the current rule, add an author-time check).
  • Checks: every check-run on this head is success (59) or skipped (10). git merge-tree against current main is clean.
  • Gates (dev, at this head): lint suite 197 files / 8331 tests; lint typecheck OK; dispatch-gates --commands 88 derived / 88 run / 0 NOT-MEASURED; ablations (registration, capability gate, row-security posture, filter keys) each red as predicted and restored. Example apps: app-showcase raises 9 warnings and 2 notes, and the other apps none. Every run exits 0. The showcase sets stay as they are; that question goes to its own card.
  • Shape: base main, no closing keyword. @objectstack/lint patch, Clause-②: yes (widening), Metadata-protocol: none. Title feat(lint): …, no !.
  • Governed: check-governed-merges.mjs --pr 31046: not governed (0 of 11 paths); 1228 changed lines ≤ 3000 ⇒ Tier S.
  • Landing authority: the maintainer's standing approval for this seat's security PRs at Tier S (2026-11-06 card answer in the seat's thread) and 「你应该是使用 pm-dispatch 技能自主审核和落地 pr」.
  • Next: relay pr_ready + automerge_enable.

Generated by Claude Code

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 6, 2026 22:35
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge November 6, 2026 22:35
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 6, 2026
Merged via the queue into main with commit 13227b5 Nov 6, 2026
70 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/sec-hardening-r14 branch November 6, 2026 22:56
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/xl tests 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.

2 participants