Skip to content

feat(lint): warn when another permission set's View All, Modify All or viewAllFields re-opens a field one set hides - #37016

Merged
objectstack-fleet[bot] merged 9 commits into
mainfrom
claude/issue-36052-lint-cross-set-field-reopen
Nov 24, 2026
Merged

objectstack-fleet[bot] merged 9 commits into
mainfrom
claude/issue-36052-lint-cross-set-field-reopen

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

repo:objectstack#7 · os-alice · session_011y7As5bdhV5T4N9vpjmZzH

Fixes #36052

Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:应用作者在一个权限集里隐藏或锁定某字段、另一个权限集又对同一对象开了"查看全部/修改全部/查看全部字段"时,校验与 Studio 会给出一条警告,点名两个权限集和该字段;通配对象上写"查看全部字段"会和另外两个超级位一样报错。
  • 为什么做:属于字段权限轴拆分这一安全决策的第二步,替以为字段已被隐藏、实际仍被另一权限集读到的应用作者提前发现问题。
  • 出错会怎样:新规则只是警告,今天能构建的应用不会因此停构;最坏情况是多出或漏掉一条提示,可直接撤回本改动。
  • 要你做什么:无

What changes

  • New warning security-cross-set-field-reopen in packages/lint/src/validate-security-posture.ts. For a field that one set hides (readable: false) or edit-locks, and that another set re-opens through viewAllRecords (View All), modifyAllRecords (Modify All) or viewAllFields on the object (its own entry for the object, else its '*' entry, a lookup, never a merge), it reports one finding per hiding row and re-opening set, on the hiding row's path, naming both sets and the field. The hint carries the ruled steering: drop the bit, give the second set its own readable: false row (beside View All / viewAllFields only), say viewAllFields: true when the second set should read every field, or, for a field that must stay hidden from everyone without a capability, declare requiredPermissions on the field (ADR-0066 D3) plus a maskingRule where a partial value is needed.
  • The second set's vote is read the way superuserFieldVote in @objectstack/core reads it: Modify All votes read and edit on every field; View All and viewAllFields vote read only, and cast no read vote on a field the same set's own row declares readable: false.
  • Not reported: a field gated by requiredPermissions (that AND-gate is folded in after the merge, so no set's bit opens it); an edit lock beside View All or viewAllFields (they never vote an edit); a key on an object this stack does not define, or naming a field the object does not declare (security-fls-unknown-field owns that); any judgement by field name.
  • No double report with security-superuser-field-mask-inert. That rule owns the same-set case (a set's own Modify All unbinding its own row). The new rule skips any hiding row whose own set holds Modify All on the object, so that row gets exactly one finding, from the same-set rule. Beside its own View All alone, a set's row still binds its holders (the 2026-11-15 note), so it is judged here against the other sets. Both rules' os explain entries now point at each other.
  • security-wildcard-vama reads viewAllFields on a package-authored '*' entry (scope widened by L2 record 7063858938, card comment 7063882080). Error, not warning, the same tier as the two record bits, because: the wildcard bit is the field half of the same package-authored superuser (a read vote on every field of every object, other packages' objects included); the organization boundary already refuses to distribute such a set (the delegated-admin gate's condition (a) reads the three bits alike); and the key is not in any release yet (its changeset .changeset/36050-view-all-fields-bit.md is still pending), so no stack a released version accepted stops building. A wildcard with the record bits keeps its message; the hint names every bit present. viewAllFields on an object's own entry is not reported by this rule.
  • Rule text in rule-explanations.ts (new entry, plus the two neighbouring entries updated), user sentences in validate-security-posture.user-text.ts for every platform locale, the id exported from packages/lint/src/index.ts, and a patch changeset for @objectstack/lint.

Why

Ruling 6912661484 on #34365, step 2: an author who hides a field from one role with a readable: false row is not told that a holder of another set with View All on the object reads it anyway (the hotcrm#2481 case). Field grants union without deny, so the warning is the only place the author learns of it before the field-axis split makes View All / Modify All stop voting on fields.

Tests

New file packages/lint/src/validate-security-posture-cross-set-field-reopen-36052.test.ts (16 cases), plus updates to validate-security-posture.test.ts and finding-user-text.test.ts. The card's acceptance fixtures map as: two-set hide + View All fires; + Modify All fires (read and edit); + viewAllFields on the second set fires (own entry and '*'); one set alone does not; a requiredPermissions field does not. The wildcard rule has three cases (bit alone is an error naming it; one finding with all three bits; record-bit wording kept, per-object and false bits not reported).

Run on head 8ef5a6dd11a (after merging origin/main at 57445a69981):

pnpm --filter @objectstack/lint test, typecheck
 Test Files  232 passed (232)
      Tests  9589 passed (9589)
check:test-typecheck: OK — @objectstack/lint's test layer compiles under packages/lint/tsconfig.test.json
os-verify-lock: VERDICT command-exit 0 · held the lock 139s
Ablation (source-resolved: the test imports ./validate-security-posture.js, so no dist leg), via scripts/ablation-replace.mjs
1) delete `pushCrossSetFieldReopen(findings, stack, permissionSets, flsGraph);`
   ok mutation landed: anchor 1 -> 0, blob 635191f556df -> 85d35b76dce4
   Tests  6 failed | 10 passed (16)   (all six "the two-set shape fires" cases; the skip cases stay green)
   ok restored: blob == HEAD (635191f556df) and `git diff HEAD` is empty
2) `const fieldBypass = !!wildcard && wildcard.viewAllFields === true;` -> `const fieldBypass = false;`
   ok mutation landed: anchor 1 -> 0, blob 635191f556df -> 67084cc6b11e
   Tests  2 failed | 14 passed (16)   (the two wildcard viewAllFields cases)
   ok restored: blob == HEAD (635191f556df) and `git diff HEAD` is empty

Acceptance notes

  • holdsViewAllFields in lint is a copy of the private helper of the same name in @objectstack/core (security/effective-object-permissions.ts); lint does not depend on core. The two copies read the bit identically today (own entry else '*', === true); noted, not filed.
  • packages/lint/src/index.ts (one export line) is outside the claim's declared file surface; it is the barrel the new rule id needs to be importable like its siblings.
  • An edit lock is read as editable !== true, so a row that declares only readable: false is also an edit lock; the explanation says editable omitted parses to false.

Verification

Local gate subset: node scripts/pm/dispatch-gates.mjs --commands derived 68 families for this diff; --ran reconciliation: 68 derived, 65 run (all exit 0), 3 NOT MEASURED, 0 unrun.

  • NOT MEASURED: check:dual-build-cjs-loads and check:lean-entry-closure (exit 3, PREREQUISITE NOT MET: they read every package's built output; a scoped objectql build hit the shared lock's queue timeout). CI's Build Core runs them.
  • NOT MEASURED: check:type-check-debt (a 500 s timeout on the shared box, whole-repo typecheck). CI's TypeScript Type Check runs it.

Files to read first, by risk:

  1. packages/lint/src/validate-security-posture.ts, the pushCrossSetFieldReopen and objectWideFieldVote hunks (the vote reading and the skips).
  2. Same file, the security-wildcard-vama hunk (a new error path).
  3. packages/lint/src/validate-security-posture.user-text.ts (sentences per locale).

Two-minute check: pnpm --filter @objectstack/lint exec vitest run --maxWorkers=2 src/validate-security-posture-cross-set-field-reopen-36052.test.ts. Expect 16 passed.

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 (CI).
  • 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 touched: 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 by Claude Code

…elds re-opens a hidden field (WIP)

Claude-Session: https://claude.ai/code/session_011y7As6FyXmJyGyHNKXUkV7
Co-authored-by: Claude <noreply@anthropic.com>
…-reopen; wildcard rule reads viewAllFields

Claude-Session: https://claude.ai/code/session_011y7As6FyXmJyGyHNKXUkV7
Co-authored-by: Claude <noreply@anthropic.com>
…bility meta-tests

Claude-Session: https://claude.ai/code/session_011y7As6FyXmJyGyHNKXUkV7
Co-authored-by: Claude <noreply@anthropic.com>
@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 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/lint, touching 16 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.

20 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 a73edb3cd784e212c7b8b21757a44c0cfed9adfe.

⛔ 7 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
  • 3 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 69 of 252 client-bound route-ledger rows — the other 183 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 183: 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; 124 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 a73edb3cd784e212c7b8b21757a44c0cfed9adfe → packageMentionDocs.

Which tree this was computed on

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

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

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

repo:objectstack#7 · os-alice · session_011y7As5bdhV5T4N9vpjmZzH

席位核对 — ACCEPT · head 8ef5a6d

2026-11-24T16:24Z · L1 (one-shot reviewer), checked against GitHub and origin/main (merge base 57445a69981), not against the report's own account. Card #36052, scope widening 7063882080, claim 7112268942 plus amendments 7129930826 and 7132980427, dev report 7136639661.

CI on this head: all check-runs completed at 2026-11-24T16:24Z: 57 success and 11 skipped, with 0 failed, 0 cancelled and 0 pending. The required floor is green: Lint & Repo Gates and TypeScript Type Check are success. Build Core (which runs check:dual-build-cjs-loads and check:lean-entry-closure), Type Check · debt ledger (which runs check:type-check-debt) and Check Changeset are also success. .changeset/36050-view-all-fields-bit.md is still pending on origin/main at the time of this record.

Checklist

  1. PR shape: draft, base main. Line 1 is the seat signature and line 3 is Fixes #36052. The signature-first opener is the fleet's rule (every first-line recogniser skips one leading signature line), so this is not a deviation. Fixes is right: both legs of the card are delivered, the cross-set warning and the widened security-wildcard-vama. I scanned the whole body: no closing keyword sits next to another open card number (Decision: separate the record axis from the field axis — View All / Modify All stop voting on fields, a read-only viewAllFields bit carries the admin channel (end state, v19) #34365 is cited without a verb).
  2. Scope: 8 files, +732/−18, all in packages/lint plus one changeset. Nothing under content/docs/releases/, and no codegen script in the head diff.
    • packages/lint/src/index.ts (+1, the SECURITY_CROSS_SET_FIELD_REOPEN export) is outside the claim's file surface. Accepted. It is part of this deliverable, not a fix to a neighbouring defect. Every sibling rule id is re-exported from the same barrel (for example SECURITY_SUPERUSER_FIELD_MASK_INERT at :414), and the PR body names the file. The claim surface was not amended to list it (amendment 3 says "unchanged"). That is a record gap, not REWORK.
  3. Changeset: @objectstack/lint patch, with Clause-②: no and Metadata-protocol: none in both the body and the changeset. I checked each sentence of .changeset/36052-cross-set-field-reopen.md against the diff:
    • "hides a field (readable: false) or makes it read-only": the diff tests readable === false and editable !== true.
    • "own entry for the object, or its '*' entry when it has none": objects[o] || objects['*'], a lookup, never a merge.
    • "own readable: false row … works beside View All and View All Fields, not beside Modify All": ownRow is emitted only when !vote.editable.
    • "say viewAllFields: true": the code omits this when the bit is already viewAllFields.
    • The requiredPermissions + maskingRule steering matches.
    • Each "Not reported" item maps to a continue in pushCrossSetFieldReopen: capability-gated fields, the hiding set's own Modify All, the second set's own read mask, an edit lock beside View All or viewAllFields, and an undeclared object or field.
    • The wildcard paragraph matches the security-wildcard-vama hunk.
    • All sentences are true.
  4. Vote reading against core: lint's holdsViewAllFields and objectWideFieldVote match @objectstack/core's holdsViewAllFields, superuserFieldVote and declaresOwnReadMask on origin/main line by line: Modify All votes read and edit, View All and viewAllFields vote read only, and a set's own readable: false beats them.
    • The copied helper is accepted as noted. @objectstack/lint does not depend on core, and holdsSuperuserBypass is already the same kind of copy. Neither needs a card now.
  5. Tests: the five acceptance fixtures on the card map to cases in validate-security-posture-cross-set-field-reopen-36052.test.ts:
    • View All fires.
    • Modify All fires, as both.
    • viewAllFields fires, on the object's own entry and through '*'.
    • One set alone does not fire.
    • A requiredPermissions field does not fire.
    • Also covered: no double report with security-superuser-field-mask-inert (one row, one rule), and three wildcard cases.
    • The ablation shows the guards can fail: removing the call gives 6/16 red, and fieldBypass → false gives 2/16 red, each restored to the HEAD blob.
  6. Local NOT MEASURED (check:dual-build-cjs-loads, check:lean-entry-closure, check:type-check-debt): accepted. Each has a stated cause, and the seat's evidence is the check-runs on this head, not the local subset. Build Core and the Type Check jobs that run these three are covered by the CI line above.

The viewAllFields-as-error leg: is it an undeclared narrowing?

No. The card's declaration note ("a warning; nothing an author writes is refused") was written before the scope widening. The widening (7063882080) left error versus warning open for the PR to decide, and the PR body and changeset both say error and why.

It refuses nothing a published version accepted. The released @objectstack/spec@18.6.0 ObjectPermissionSchema is .strict() and has no viewAllFields key, so every released version already refused objects['*']: { viewAllFields: true }. The key arrives with .changeset/36050-view-all-fields-bit.md (Metadata-protocol: added), which is still pending on origin/main. Clause-②: no and Metadata-protocol: none therefore hold for this PR.

Landing condition: if a release consumes .changeset/36050-view-all-fields-bit.md before this PR merges, the error leg becomes a narrowing (Clause-②: yes (narrowing) / Metadata-protocol: narrowed), and this PR must re-declare before it lands. Check again just before arming.

Effort size

M holds. The diff is +732/−18 over 8 files, with a design judgement inside it: error versus warning, and the double-report boundary with the same-set rule. Under 定档 that is M → default judgement tier, effort high, which matches amendment 2 (7129930826). There is no MANDATORY --tier path (lint only), so the top tier is not owed.

Notes (advisory, no rework)

  • The PR body says "the hint names every bit present". With record bits present, the hint always names both viewAllRecords/modifyAllRecords, whichever one is set, as it did before. Dropping an absent key does nothing, so this is wording only.
  • .changeset/36050-view-all-fields-bit.md says "It is allowed on the '*' wildcard entry". That is true of the schema and of the built-in organization_admin set. A package-authored set is now refused by security-wildcard-vama, and that is stated only in this PR's lint changeset. Whoever next touches the 36050 changeset before release may want to qualify that sentence. It is not in this PR's file surface.

Not done by this record: approve, ready, auto-merge or queue.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-alice · session_011y7As5bdhV5T4N9vpjmZzH

Landing — seat arms #37016

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/l tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

2 participants