Skip to content

tests(access-security): pin the FLS read side and the persona x CRUD cell matrix, and re-scope both checklist refs - #9570

Merged
os-zhuang merged 1 commit into
mainfrom
claude/issue-9481-fls-read-side-and-persona-crud-cells
Aug 18, 2026
Merged

os-zhuang merged 1 commit into
mainfrom
claude/issue-9481-fls-read-side-and-persona-crud-cells

Conversation

@os-zhuang

Copy link
Copy Markdown
Contributor

Fixes #9481

QA run #9401 scored two access-security items green on pins that reach only a subset of their acceptance clauses. This lands the two missing pins and re-scopes both items' automated.ref, including what stays manual — the second half is the point, not a footnote: a pin that covers more while the ref still claims the old scope leaves the same dishonesty pointing the other way.

Tests and checklist prose only. No runtime behaviour, wire shape, or accept/reject decision changes.

1. FLS read side — access-security.fls-mask-and-strip

packages/qa/dogfood/test/showcase-fls-read-mask-strip.dogfood.test.ts (8 tests).

The existing pin covers the write half only, and its ref says so. The read half is what an unentitled persona actually receives on the wire.

The distinction, asserted rather than assumed. The platform has two ways a field fails to reach a caller and they are not interchangeable:

mechanism declared by wire shape
stripped permission-set readable: false key deleted — absent from the object
masked field maskingRule (#8993) key present, value replaced by a mask image

A test that only checks "I did not get the real value" passes for both and pins neither. So the assertions are about the key: Object.prototype.hasOwnProperty.call(record, 'budget') must be false — which also distinguishes absent from present-and-null, where a toBeUndefined() would not.

Measured answer, and it settles an ambiguity in the item's own clause 4 ("absent or nulled"): the product strips. What is pinned:

  • the key is absent from the by-id record, from every listed row, and from an explicit select that names it (200, no error, no value);
  • a sibling currency field on the same object that the scratch set does not enumerate survives with its real value — the strip is per-field, not per-row;
  • filtering and sorting on the stripped field are refused 403 PERMISSION_DENIED naming the field — absence alone is only cosmetic hiding if the value stays binary-searchable;
  • the read deny's write complement is refused and the stored value is unchanged (value oracle, not status);
  • every one of the above is paired with the entitled caller's contrast on the same row and request. A read-side FLS suite that only asserted absence would stay green if the field vanished for everyone.

Fixture. Stock showcase authors no readable: false grant — the item's own knownGaps records this and #9308 fixture 4 is the card that would land it in the seed. The test authors a scratch permission set at runtime, which is exactly what this item's own steps prescribe; committed showcase metadata is untouched. Boots privately rather than on the worker-shared showcase, because it inserts a sys_permission_set row and the shared harness excludes permission-set metadata edits outright.

2. Persona x CRUD cells — access-security.crud-permission-matrix

packages/qa/dogfood/test/showcase-crud-persona-matrix.dogfood.test.ts (30 tests).

All 25 showcase_* rows of the showcase's access-matrix.json, driven over all four verbs by one fresh member per permission set. 100 cells: 50 effective-allow, 50 effective-deny.

The union is the whole trap. access-matrix.json lists what each set grants on its own; every authenticated member also holds showcase_member_default additively (ADR-0090 D5) and capability is a union. Judging a cell against the raw row turns 9 correctly-allowed cells into fabricated violations. The effective expectation is row[verb] OR baseline[verb], and those 9 baseline-only grants get their own assertion — if that count ever reaches 0 the union has stopped mattering and the sweep has silently stopped testing it.

Both sides, and the balance is checked. A matrix that only asserts denials stays green when everything denies. records the verdict of every cell asserts the exact 50/50 split, that every set and object was really driven, that every denial is 403 PERMISSION_DENIED specifically (never an incidental 404/400), and that every allow is 2xx. Narrowing the sweep breaks the build instead of quietly shrinking what is proven.

A denial here is a permission verdict, not a bad payload. Before any persona runs, the admin creates every object from the same payload builder. A showcase change that adds a required field fails that control naming the object, instead of every persona's 403 staying green for the wrong reason. (Both over-tightening ablations below were caught by this control first, which is the behaviour it exists for.)

Also pinned: denied CREATE leaves no row behind (clause 2); viewAllRecords reaches a foreign private note by id and in lists, with a persona lacking the bit denied both ways (clause 3); modifyAllRecords lets ops patch a foreign announcement while the same patch by a baseline member is refused and the row is unchanged (clause 4).

What is re-scoped as manual, and why

Stated in both refs, not implied:

  • The spec/security: field masking is all-or-nothing — no partial masking (phone last-4, ID middle-8), and maskingRule was pruned as dead in 2026-06 #8993 maskingRule path. No object anywhere in this repo declares a maskingRule — the showcase declares none — so the masked-value wire shape has no fixture, and authoring one would change what the stock showcase means. The read pin covers the strip mechanism only.
  • Both items' UI halves. No pin; the FLS one additionally needs Land the showcase seed fixtures that unblock the checklist's stock-fixture gaps (loginable 2nd member, publicSharing object, writable summary field, readable:false FLS grant) #9308's stock grant, since a console render cannot be driven off a set that exists only inside a test's stack.
  • The 6 showcase_field_ops_delegate x sys_* rows. Their verdicts are not plain cells. Measured: a member holding nothing but the app baseline reads /data/sys_user 200 (self-scoped) although the matrix lists sys_user read only for the delegate — the platform's own baseline sets grant part of that surface independently of the app matrix, so a missing row is not a prediction of denial there. And the delegate's sys_user_position writes are decided by the ADR-0090 D12 adminScope subtree gate, which showcase-permission-zoo.dogfood.test.ts already pins on both sides.
  • Clause 5's guest-anchor intake asymmetry (guest_portal create-without-read). Not observable on a member persona at all: the everyone baseline grants read on showcase_inquiry, so the union says read, and the test asserts the union because that is what a member holding the set may actually do. The asymmetry lives on the unauthenticated guest anchor, a different admission lane.

Red without the behaviour — predicted vs actual

Each ablation rebuilt the mutated package and was proven present in dist/ with scripts/ablation-dist-preflight.mjs before its colour was allowed to mean anything (dogfood resolves through built artifacts; an unrebuilt ablation stays green and certifies a vacuous test).

# ablation predicted actual
A FieldMasker.maskRecord stops deleting hidden fields 3 red / 5 green — the shape assertions only; oracle guards and the write complement are other enforcement sites 3 red / 5 green, exactly those three
B object CRUD gate widened (checkObjectPermission returns true) 24 of 25 sweep rows + verdict table 26 red / 4 green — those 25 plus MAMA; survivors were the only all-allow row, VAMA (OWD still hides it), the baseline-flip test and the exclusion test
C ADR-0090 D5 additive-baseline push removed the 9 flipped cells go 403 falsified — 30 passed. The baseline reaches a request by a second path (the everyone-anchor binding), so that push is redundant here. Reported as observed, not as predicted
D/E over-tighten the gate; drop a declared grant from the showcase per-cell allow-half red suite red at the admin control (D), and (E) the showcase build refused the drift outright — the ADR-0090 D6 access-matrix snapshot gate catches declaration drift at build time. Neither is per-cell, so both were superseded by F
F enforcement ignores a declared grant for non-wildcard sets (declared vs served) 4 red: auditor/contributor/ops x invoice + verdict table 5 red / 25 green — the extra is contributor x invoice_line, whose master-detail create cascades off the invoice it can no longer create. Prediction missed the cascade

F is the regression these pins exist to catch, and it is the one the D6 snapshot gate structurally cannot see: that gate compares declarations, this compares declaration against what the server actually serves.

All ablations reverted; ablation-dist-preflight --absent confirms no marker survives in any built artifact.

Verification

Union re-run on the pushed head 4ace9167c:

  • showcase-fls-read-mask-strip + showcase-crud-persona-matrix + the four neighbouring access-security pins + authz-conformance — 7 files passed, 117 tests passed
  • pnpm --filter @objectstack/dogfood typecheck — clean (script name echoed, not a zero-match filter)
  • check:type-check-debt --re-measure — 33 ledger entries, 1926 raw errors, "surplus: none", nothing above its recorded number
  • green: check:nul-bytes, check:cross-package-test-inputs, check:test-source-alias, check:type-source-resolution, check:query-options-erasure, check:engine-double-contract, check:where-matcher, check:type-check-coverage, check-platform-checklist, check-affected-docs, and spec's check:empty-state / check:liveness / check:strictness-ledger / check:variant-docs

check:cross-package-test-inputs was not assumed covered: injecting an undeclared path into the matrix test made it red naming both the path and my file, and it went green again on restore — so the existing examples/app-showcase/** glob demonstrably covers the access-matrix.json read.

Notes for review


Generated by Claude Code

…cell matrix (#9481)

QA run #9401 scored `access-security.fls-mask-and-strip` and
`access-security.crud-permission-matrix` green on pins that reach only a
subset of each item's acceptance clauses. Two new dogfood pins close the
named gaps, and both items' `automated.ref` are re-scoped so the next
Tier-1 run scores them honestly — including what stays manual.

FLS read side. A permission-set `readable: false` STRIPS the field: the key
is deleted, not nulled and not replaced by a placeholder. The pin asserts
key-absence on the by-id record, on every listed row and on an explicit
`select` that names the field, always against the entitled caller's
contrast on the same row and request; it also pins the filter and sort
oracle refusals (403 PERMISSION_DENIED naming the field) and the read
deny's write complement. The scratch `readable: false` set is authored at
runtime, exactly as the item's own steps prescribe — stock showcase
metadata is untouched.

Persona x CRUD cells. All 25 `showcase_*` rows of the showcase's
access-matrix.json are driven over all four verbs by one fresh member per
permission set: 100 cells, 50 effective-allow and 50 effective-deny, each
judged against the BASELINE-UNIONED expectation (ADR-0090 D5), whose 9
baseline-only grants are asserted as load-bearing in their own right. An
admin payload control runs first, so a persona 403 cannot be a 400 in
disguise.

Both refs now state what they do NOT reach: the #8993 maskingRule path has
no fixture anywhere in this repo, the UI halves have no pin, the 6 sys_*
delegate rows are not plain cells, and the guest-anchor intake asymmetry is
not observable on a member persona at all.

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

Nothing in this diff resolved to a documentable surface (no symbol, route or SDK anchor derived from 0 changed package(s)), so this run has no opinion about the docs.

@github-actions github-actions Bot added the tests label Aug 18, 2026
@os-zhuang os-zhuang added skip-changeset PR has no user-facing published change; bypasses the changeset gate and removed tests labels Aug 18, 2026 — with Claude
@os-zhuang
os-zhuang marked this pull request as ready for review August 18, 2026 11:12
@os-zhuang
os-zhuang enabled auto-merge August 18, 2026 11:12
@os-zhuang
os-zhuang marked this pull request as draft August 18, 2026 11:18
auto-merge was automatically disabled August 18, 2026 11:18

Pull request was converted to draft

@os-zhuang
os-zhuang marked this pull request as ready for review August 18, 2026 11:21
@os-zhuang
os-zhuang added this pull request to the merge queue Aug 18, 2026
Merged via the queue into main with commit 8d98268 Aug 18, 2026
31 checks passed
@os-zhuang
os-zhuang deleted the claude/issue-9481-fls-read-side-and-persona-crud-cells branch August 18, 2026 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/l skip-changeset PR has no user-facing published change; bypasses the changeset gate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tests(access-security): pin the read side of FLS mask/strip and the persona×CRUD cell matrix — coverage gaps from QA run #9401

2 participants