Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .changeset/36055-view-all-stops-voting-on-fields.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
'@objectstack/core': major
'@objectstack/plugin-security': major
'@objectstack/lint': major
'@objectstack/spec': major
'@objectstack/metadata-core': minor
'@objectstack/scenarios': patch
'@objectstack/cli': patch
'@objectstack/service-automation': patch
---

feat(security)!: View All and Modify All stop opening fields; `viewAllFields` is the one "every field" bit

**BREAKING** (19.0.0): View All (`viewAllRecords`) and Modify All (`modifyAllRecords`) widen records only. They no longer cast a field vote, so a field that a permission set hides (`readable: false`) or locks (`editable: false`) stays hidden or locked for their holders. Reading every field of an object is `viewAllFields: true` on that object's entry; it votes read, never edit.

Clause-②: yes (narrowing)
Metadata-protocol: semantic

<!-- adr-0087: registered permission-view-all-fields-beside-record-bypass -->

FROM → TO:

- `objects.<name>: { viewAllRecords: true }` read every field of the object another set hides → it reads none of them. TO keep that read: `{ viewAllRecords: true, viewAllFields: true }`.
- `objects.<name>: { modifyAllRecords: true }` read and edited every field, the set's own rows included → it reads and edits only what the field rows allow. TO keep the read: `{ modifyAllRecords: true, viewAllFields: true }`. The edit of a field some set locks is not restored by any bit: grant it with an explicit `editable: true` row in the set that should edit it.
- The same holds on a `'*'` entry.

**Check your permission sets in one step.** A permission set is affected when one of its `objects` entries, the `'*'` entry included, has `viewAllRecords: true` or `modifyAllRecords: true` and does not have `viewAllFields: true`. For each such entry, add `viewAllFields: true` to it if the set should still read every field of that object. Nothing else is needed for the read: with the bit, the set reads what View All read before. (Beside Modify All, the set's own `readable: false` rows now bind; before, Modify All overrode them.)

- Sets in your source: `os migrate meta --from 18 --write` adds `viewAllFields: true` beside every such bit (ADR-0087 conversion `permission-view-all-fields-beside-record-bypass`).
- Sets saved in a running deployment (Studio-saved, stored in `sys_metadata`): they are **not** rewritten on upgrade, and from 19 they are read with the new meaning. Studio's permission matrix has no control for `viewAllFields` today (it keeps the key when it saves a set that already carries it), so add it to the set's entry through the metadata API. No command lists the affected stored sets yet; a review list is follow-up #37375.

The protocol-19 upgrade guide carries the same check as the semantic entry `permission-view-all-modify-all-cast-no-field-vote`.

The error direction is safe: an unconverted set sees **fewer** fields after the upgrade, never more. No field that was hidden opens. A set whose object has no field row in any set changes nothing at all, because a field no set names already follows the object grant.

Also in this change:

- The built-in admin sets (`admin_full_access`, `organization_admin`) already carry `viewAllFields: true` on their `'*'` entry, so they still read every field. They no longer edit a field that another set they hold locks.
- Explain no longer reports a row-conditioned field lock as "superseded by the Modify All Data field vote": the lock binds per row for every caller.
- `@objectstack/lint`: the warning `security-superuser-field-mask-inert` is retired, since a set's own field rows now bind beside its own View All or Modify All. `security-cross-set-field-reopen` now reports only a field one set hides that another set's `viewAllFields` re-opens. `security-controlled-by-parent-master-reference-hidden` and the roll-up source-visibility rules now judge a mask beside Modify All like any other mask.
- `@objectstack/spec` and `@objectstack/metadata-core`: the conversion is a default flip, retired from the load path from day one. Only `os migrate meta --from 18` replays it: the authoring funnel, the artifact-ingestion door and every stored-row read (`applyConversionsToStoredItem`, `os migrate meta --stored` included) refuse it by id, so an artifact or stored set is read with the 19 meaning and never handed a field read its author did not write.
- `@objectstack/core`: `superuserFieldVote` is replaced by `viewAllFieldsReadVote(sets, object, field)`, which answers whether a set's `viewAllFields` reads the field. `holdsSuperuserBypass` is unchanged and answers the record bypass only.
- `@objectstack/scenarios`: the persona-grant scoring no longer treats Modify All as overriding a field lock.
- `@objectstack/cli` and `@objectstack/service-automation`: test comments only, restated for the 19 meaning.
28 changes: 12 additions & 16 deletions content/docs/permissions/authorization.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -153,27 +153,23 @@ implementation detail:
<Callout type="warn">
**FLS posture (ADR-0066 ⑧):** runtime field security is block-list-shaped —
an **undeclared** field is visible by default, and field grants union (one
set's `readable: true` out-votes another's `false`). A set that holds View All
(`viewAllRecords`) on an object also votes `readable: true` on every field of
that object, and a set that holds Modify All (`modifyAllRecords`) votes
`readable: true` and `editable: true`; View All never grants an edit. So
set's `readable: true` out-votes another's `false`). View All
(`viewAllRecords`) and Modify All (`modifyAllRecords`) widen records only and
cast no field vote. A set that carries `viewAllFields` on an object votes
`readable: true` on every field of that object, and never an edit vote. So
another set's `readable: false` never hides a field from a caller who also
holds a View All or Modify All set on its object; a field's
`requiredPermissions` capability gate still applies to every caller. One
exception: a View All set casts no read vote on a field its **own**
holds a `viewAllFields` set on its object; a field's `requiredPermissions`
capability gate still applies to every caller. One exception: a
`viewAllFields` set casts no read vote on a field its **own**
`readable: false` entry hides, so that entry binds the set's holders, unless
another set they hold casts a read vote on the field (its own `readable: true`
entry, or View All or Modify All on the object); a co-held set that says
nothing about the field does not restore it. A Modify All set still votes on
every field, its own entries included. Otherwise union without deny is
unchanged. A set that carries `viewAllFields` on the object casts the same
read vote as View All, under the same own-entry exception, and never an edit
vote. From v19 View All and Modify All stop voting on fields: where a set
should read every field, grant
entry, or `viewAllFields` on the object); a co-held set that says nothing about
the field does not restore it. Otherwise union without deny is unchanged. Up
to v18 View All and Modify All also voted on fields; where a set should read
every field, grant
[`viewAllFields`](/docs/permissions/field-level-security#viewallfields-a-set-that-reads-every-field).
Until the muting layer lands, protect sensitive fields by granting them only
in the sets that need them, grant the object without Modify All to a set that
must withhold a field from its own holders, and treat "sensitive field on a
in the sets that need them, and treat "sensitive field on a
public object" as a review smell.
</Callout>

Expand Down
31 changes: 13 additions & 18 deletions content/docs/permissions/field-level-security.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ of them:
| **Fields** | `fields` rows, `viewAllFields`, and a field's own `requiredPermissions` | Which fields of those records the caller reads and edits. |

<Callout type="warn">
**From v19, View All and Modify All stop opening fields.** Until then a set
that holds `viewAllRecords` on an object also reads every field of it, and a
set that holds `modifyAllRecords` reads and edits every field (the exact votes
are under [Server-side enforcement](#server-side-enforcement-of-declared-rules)).
Do not build on that: where a set should read every field, grant
[`viewAllFields`](#viewallfields-a-set-that-reads-every-field).
**View All and Modify All do not open fields (v19).** A set that holds
`viewAllRecords` or `modifyAllRecords` on an object reaches every record of
it and casts no field vote: a field another set hides stays hidden, and the
set's own `fields` rows still hide or lock their fields. Where a set should
read every field, grant
[`viewAllFields`](#viewallfields-a-set-that-reads-every-field). Up to v18 the
two bits also read (and Modify All also edited) every field;
`os migrate meta --from 18` adds `viewAllFields: true` beside them in source.
</Callout>

## Choosing by sensitivity
Expand Down Expand Up @@ -242,8 +244,8 @@ roll-up is not a computed field in this sense: it does not follow the
fields it aggregates, so mask it on its own where a set must not see it.
The record the engine echoes for a
public-form submission carries no computed field that reads through a
reference. View All, Modify All and `viewAllFields` lift a permission set's
`readable: false`, not a capability gate or a masking rule, so their holders
reference. `viewAllFields` lifts a permission set's
`readable: false`, not a capability gate or a masking rule, so its holders
are withheld a computed field over such a field too. To let a permission
set's holders read a computed field, grant that set read on every field
the expression reads, unmasked: the capability a field's
Expand Down Expand Up @@ -284,16 +286,9 @@ only constrain fields they explicitly enumerate, and field grants union
most-permissively across a user's sets (one set's `readable: true`
out-votes another set's `false`). Until a subtractive muting layer lands
(ADR-0066 ⑧), a `{ readable: false }` rule masks the field only as long
as **no other set the user holds** declares it `readable: true`, carries
`viewAllFields` on that object, or holds
View All (`viewAllRecords`, reads every field of the object) or Modify All
(`modifyAllRecords`, reads and edits every field) on that object, and
the set that declares it does not itself hold Modify All on that object:
the set's own View All or `viewAllFields` leaves its `readable: false`
binding, while its
own Modify All still reads and edits every field of the object, its own
rows included (`security-superuser-field-mask-inert` warns on such a row),
until v19, when View All and Modify All stop voting on fields — so
as **no other set the user holds** declares it `readable: true` or carries
`viewAllFields` on that object (View All and Modify All cast no field vote)
— so
gate a high-sensitivity field with `requiredPermissions`
([Choosing by sensitivity](#choosing-by-sensitivity)), grant a
position-dependent field only in the sets that need
Expand Down
2 changes: 1 addition & 1 deletion content/docs/permissions/permissions-matrix.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ Field-level security controls visibility and editability of individual fields pe
| `opportunity.amount` | Visible, Editable | Visible, Editable | Visible, Editable | Visible | Visible |
| `opportunity.margin` | Visible, Editable | Visible, Editable | Hidden | Hidden | Hidden |

**View All / Modify All reach every field.** The Sales Manager column follows from section 2: `sales_manager_access` holds `viewAllRecords` on `contact` and `modifyAllRecords` on `opportunity`, and a set holding View All on an object reads every field of it that its own field rules do not hide, while Modify All reads and edits every field (ADR-0066 D2 ⑧ as amended). Field rules in other sets cannot hide `contact.ssn` from that manager. To keep a field from someone, withhold it in a set that grants the object without Modify All, and give them no other set that reads the field. From v19 these two bits stop reaching fields: a set that should read every field carries `viewAllFields`, and a high-sensitivity field is gated by `requiredPermissions` on the field itself ([Field-level security](/docs/permissions/field-level-security#choosing-by-sensitivity)).
**View All / Modify All widen records, not fields.** Each column is one set held alone: `sales_manager_access` names none of these fields, so each follows its object grant. View All (`viewAllRecords`) and Modify All (`modifyAllRecords`) reach every record of the object and cast no field vote (ADR-0066 D2 ⑧, v19), so a manager who also holds `sales_rep_access` does not read `contact.ssn` or `opportunity.margin` through them: the rep set's `readable: false` row is the only vote on those fields. A set that must read every field whatever other sets say carries `viewAllFields: true` on the object; it votes read, never edit. A high-sensitivity field is gated by `requiredPermissions` on the field itself ([Field-level security](/docs/permissions/field-level-security#choosing-by-sensitivity)).

### FLS States

Expand Down
8 changes: 4 additions & 4 deletions content/docs/references/api/auth.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ const result = AuthProvider.parse(data);
| **allowPurge** | `never` | optional | [REMOVED] `objects.<object>.allowPurge` was removed in @objectstack/spec 17 (ADR-0049): the `purge` ObjectQL operation it claimed to gate did not exist then, so granting the bit delivered nothing (a compliance/GDPR erase the author believed was permission-locked was not). Delete the key. The operation now exists with the recycle bin (ADR-0148), and its grant is spelled `manageRecycleBin` (purge an entry, empty an object's entries, and the permanent delete). Run `os migrate meta --from 17` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. |
| **allowRestoreOwnDeleted** | `boolean` | optional | Recycle bin: restore the entries of this object the caller deleted. Bounded by read; implied by manageRecycleBin and modifyAllRecords, not by allowDelete. |
| **manageRecycleBin** | `boolean` | optional | Recycle bin administration on this object: restore any entry, not only your own, and purge (the permanent delete, purging one entry, emptying the object's entries). Bounded by read; implied by modifyAllRecords. |
| **viewAllRecords** | `boolean` | optional (default: `false`) | View All Data (Bypass Sharing) |
| **modifyAllRecords** | `boolean` | optional (default: `false`) | Modify All Data (Bypass Sharing) — bypasses sharing rules and ownership on the objects record sharing enforces on; on an object with NO owner field sharing abstains, so the platform created_by write floor still applies. Includes delete: an omitted allowDelete parses to true, and an explicit allowDelete: false beside it is refused. |
| **viewAllRecords** | `boolean` | optional (default: `false`) | View All Data (Bypass Sharing): reads every record of the object. Casts no field vote: a field another permission set hides stays hidden; reading every field is viewAllFields. |
| **modifyAllRecords** | `boolean` | optional (default: `false`) | Modify All Data (Bypass Sharing) — bypasses sharing rules and ownership on the objects record sharing enforces on; on an object with NO owner field sharing abstains, so the platform created_by write floor still applies. Includes delete: an omitted allowDelete parses to true, and an explicit allowDelete: false beside it is refused. Casts no field vote: field rows (this set's and others') still hide or lock their fields; reading every field is viewAllFields. |
| **viewAllFields** | `boolean` | optional | View All Fields: a read vote on every field of this object, including fields added later. Casts no edit vote: edits come from the default or from explicit editable: true field rows. A field row of the same set beats it, so an own readable: false row keeps the field hidden for this set. Grants no object access and widens no record. Allowed on the '*' entry. |
| **readScope** | `Enum<'own' \| 'own_and_reports' \| 'unit' \| 'unit_and_below' \| 'org'>` | optional | [ADR-0057 D1] Read depth: own\|unit\|unit_and_below\|org |
| **writeScope** | `Enum<'own' \| 'own_and_reports' \| 'unit' \| 'unit_and_below' \| 'org'>` | optional | [ADR-0057 D1] Write depth: own\|unit\|unit_and_below\|org |
Expand Down Expand Up @@ -178,8 +178,8 @@ This schema accepts one of the following structures:
| **allowPurge** | `never` | optional | [REMOVED] `objects.<object>.allowPurge` was removed in @objectstack/spec 17 (ADR-0049): the `purge` ObjectQL operation it claimed to gate did not exist then, so granting the bit delivered nothing (a compliance/GDPR erase the author believed was permission-locked was not). Delete the key. The operation now exists with the recycle bin (ADR-0148), and its grant is spelled `manageRecycleBin` (purge an entry, empty an object's entries, and the permanent delete). Run `os migrate meta --from 17` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. |
| **allowRestoreOwnDeleted** | `boolean` | optional | Recycle bin: restore the entries of this object the caller deleted. Bounded by read; implied by manageRecycleBin and modifyAllRecords, not by allowDelete. |
| **manageRecycleBin** | `boolean` | optional | Recycle bin administration on this object: restore any entry, not only your own, and purge (the permanent delete, purging one entry, emptying the object's entries). Bounded by read; implied by modifyAllRecords. |
| **viewAllRecords** | `boolean` | optional (default: `false`) | View All Data (Bypass Sharing) |
| **modifyAllRecords** | `boolean` | optional (default: `false`) | Modify All Data (Bypass Sharing) — bypasses sharing rules and ownership on the objects record sharing enforces on; on an object with NO owner field sharing abstains, so the platform created_by write floor still applies. Includes delete: an omitted allowDelete parses to true, and an explicit allowDelete: false beside it is refused. |
| **viewAllRecords** | `boolean` | optional (default: `false`) | View All Data (Bypass Sharing): reads every record of the object. Casts no field vote: a field another permission set hides stays hidden; reading every field is viewAllFields. |
| **modifyAllRecords** | `boolean` | optional (default: `false`) | Modify All Data (Bypass Sharing) — bypasses sharing rules and ownership on the objects record sharing enforces on; on an object with NO owner field sharing abstains, so the platform created_by write floor still applies. Includes delete: an omitted allowDelete parses to true, and an explicit allowDelete: false beside it is refused. Casts no field vote: field rows (this set's and others') still hide or lock their fields; reading every field is viewAllFields. |
| **viewAllFields** | `boolean` | optional | View All Fields: a read vote on every field of this object, including fields added later. Casts no edit vote: edits come from the default or from explicit editable: true field rows. A field row of the same set beats it, so an own readable: false row keeps the field hidden for this set. Grants no object access and widens no record. Allowed on the '*' entry. |
| **readScope** | `Enum<'own' \| 'own_and_reports' \| 'unit' \| 'unit_and_below' \| 'org'>` | optional | [ADR-0057 D1] Read depth: own\|unit\|unit_and_below\|org |
| **writeScope** | `Enum<'own' \| 'own_and_reports' \| 'unit' \| 'unit_and_below' \| 'org'>` | optional | [ADR-0057 D1] Write depth: own\|unit\|unit_and_below\|org |
Expand Down
Loading
Loading