From 83f522fbe1c445e7ba9c72109188cffcc7a242dc Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 25 Nov 2026 23:24:03 +0000 Subject: [PATCH 01/11] wip(security): View All / Modify All stop voting on fields (core, plugin-security, lint, scenarios) Claude-Session: https://claude.ai/code/session_011y7As8b4YLdvodeGAQWNTQ Co-Authored-By: Claude --- .../security/effective-object-permissions.ts | 104 ++-- packages/core/src/security/index.ts | 7 +- packages/lint/src/index.ts | 1 - packages/lint/src/rule-explanations.ts | 87 +-- .../src/validate-rollup-source-visibility.ts | 39 +- .../lint/src/validate-security-posture.ts | 192 ++----- .../validate-security-posture.user-text.ts | 511 +++--------------- .../plugin-security/src/explain-engine.ts | 32 +- .../src/objects/default-permission-sets.ts | 24 +- .../src/permission-evaluator.ts | 81 +-- .../qa/scenarios/src/score/scenario-tags.ts | 13 +- packages/spec/liveness/permission.json | 6 +- 12 files changed, 272 insertions(+), 825 deletions(-) diff --git a/packages/core/src/security/effective-object-permissions.ts b/packages/core/src/security/effective-object-permissions.ts index a105b3c534b..b4c72981bb8 100644 --- a/packages/core/src/security/effective-object-permissions.ts +++ b/packages/core/src/security/effective-object-permissions.ts @@ -998,8 +998,10 @@ export function fieldPermissionVote( * bypass on `objectName`? The ONE reading of that question: * `PermissionEvaluator.superuserBypassSets` (`@objectstack/plugin-security`, * the row-level bypass every RLS, sharing and explain consumer folds through) - * asks it per set, and so does the field merge's super-user vote below, so the - * two can never disagree about who is a super-user on an object. + * asks it per set, so every row-level reader agrees about who is a super-user + * on an object. Since the field-axis split (ruling of record 6912661484, step + * 3) the answer reaches no field: the field merge's one "all fields" vote is + * `viewAllFields` ({@link viewAllFieldsReadVote}). * * The set's own entry for the object answers when it has one; otherwise its * `'*'` wildcard does (`resolveObjectPermission` in the evaluator: lookup, not @@ -1025,59 +1027,45 @@ export function holdsSuperuserBypass( } /** - * [ADR-0066 D2 ⑧ as amended — ruling of record 6573563853, letter A] The - * super-user vote in the field merge: when any of `sets` holds the bypass on - * `objectName` ({@link holdsSuperuserBypass}), it votes on EVERY field of that - * object — `viewAllRecords` votes `readable: true`, `modifyAllRecords` votes - * `readable: true` and `editable: true`. `null` when no set holds it. + * [ADR-0066 D2 ⑧; the field-axis split, ruling of record 6912661484, letter + * A, step 3] The one "all fields" vote in the field merge: does any of + * `sets` cast a READ vote on `.` through `viewAllFields`? * - * A set that grants the object through its super-user bits but names no field - * used to cast no vote at all, so another set's `readable: false` hid the - * field from a platform admin who also held that set. Union without deny is - * otherwise unchanged: a caller who holds no super-user set on the object is - * narrowed by a declared mask as before. Applied to the fields the merge - * already holds an entry for; an absent field is unrestricted anyway. + * A set that carries `viewAllFields` on the object ({@link holdsViewAllFields}) + * votes `readable: true` on every field of it, including fields added later, + * except a field its OWN row declares `readable: false`: inside one set, + * specific beats general ({@link declaresOwnReadMask}). It never votes an edit + * (ruled read-only): edits come from the default (a field no set names follows + * the object grant) or from an explicit `editable: true` row. * - * [ADR-0066 D2 ⑧ note of 2026-11-15] With `fieldName`, the vote is the one cast - * on that field: a set that holds View All on the object WITHOUT Modify All - * casts no read vote on a field its OWN row declares `readable: false` - * ({@link declaresOwnReadMask}), so a set can grant View All on an object and - * still hide a field of it from its holders. Every other vote stands: - * another set's View All or Modify All still reads the field (the admin case - * above), and a set holding Modify All votes on every field as before, its - * own rows included. View All never granted an edit, so an edit lock beside - * it binds as it always did. Without `fieldName` the answer is the object-wide - * one, for a reader that asks only whether an edit vote exists. - * - * [Field-axis split, ruling of record 6912661484, letter A] A set that - * carries `viewAllFields` on the object ({@link holdsViewAllFields}) casts the - * same READ vote as View All, under the same own-row rule: inside one set, - * specific beats general, so its own `readable: false` row on the field means - * it casts no read vote there. It never casts an edit vote (ruled read-only). - * On a set that also holds View All or Modify All it duplicates the vote - * those bits already cast, so the built-in admin sets that carry it answer - * exactly as before. + * `viewAllRecords` and `modifyAllRecords` cast NO field vote. They widen which + * records the caller reaches ({@link holdsSuperuserBypass}) and nothing else, + * so one set's View All or Modify All no longer re-opens a field another set + * hides. Until protocol 19 they voted on every field of the object (ruling of + * record 6573563853, the ADR-0066 D2 ⑧ notes of 2026-11-02 and 2026-11-15); + * the ADR-0087 conversion `permission-view-all-fields-beside-record-bypass` + * writes `viewAllFields: true` beside them in a source that predates the + * switch, which keeps every read that vote cast. * * Both merges apply it per field after their declared-entry votes — * `PermissionEvaluator.getFieldPermissions` per object and - * {@link buildEffectiveFieldPermissions} for every object. + * {@link buildEffectiveFieldPermissions} for every object — to the fields the + * merge already holds an entry for; a field no set names is unrestricted + * anyway. */ -export function superuserFieldVote( +export function viewAllFieldsReadVote( sets: ReadonlyArray< { objects?: Record | null; fields?: Record | null } | null | undefined >, objectName: string, - fieldName?: string, -): { readable: true; editable: boolean } | null { - let read = false; + fieldName: string, +): boolean { for (const ps of sets) { - if (holdsSuperuserBypass(ps, objectName, 'modify')) return { readable: true, editable: true }; - if (read) continue; - if (!holdsSuperuserBypass(ps, objectName, 'view') && !holdsViewAllFields(ps, objectName)) continue; - if (fieldName !== undefined && declaresOwnReadMask(ps, objectName, fieldName)) continue; - read = true; + if (!holdsViewAllFields(ps, objectName)) continue; + if (declaresOwnReadMask(ps, objectName, fieldName)) continue; + return true; } - return read ? { readable: true, editable: false } : null; + return false; } /** @@ -1085,15 +1073,14 @@ export function superuserFieldVote( * letter A] Does `set` carry `viewAllFields` on `objectName`? The set's own * entry for the object answers when it has one, otherwise its `'*'` wildcard * does: the same lookup {@link holdsSuperuserBypass} takes, so a set's - * explicit entry for an object is its whole answer for that object on both - * bits, and the bit on the built-in admin wildcards duplicates exactly the - * vote their super-user bits already cast. + * explicit entry for an object is its whole answer for that object on every + * object-wide bit. * * A FIELD-axis question only. It is deliberately NOT a disjunct of * {@link holdsSuperuserBypass}: that predicate is the row-level bypass every * RLS, sharing and explain consumer folds through, and `viewAllFields` * widens no record (nor any admin posture, ADR-0095 D3, nor the private-posture - * wildcard rule, ADR-0066 D2). Its one reader is {@link superuserFieldVote}, + * wildcard rule, ADR-0066 D2). Its one reader is {@link viewAllFieldsReadVote}, * where it casts a read vote and never an edit vote (ruled read-only). */ function holdsViewAllFields( @@ -1127,7 +1114,7 @@ function declaresOwnReadMask( /** A resolved permission set, as far as the field merge reads it. */ export interface EffectiveFieldPermissionsInputSet { fields?: Record | null; - /** Read only for the super-user and `viewAllFields` vote ({@link superuserFieldVote}). */ + /** Read only for the `viewAllFields` vote ({@link viewAllFieldsReadVote}). */ objects?: Record | null; } @@ -1141,12 +1128,10 @@ export interface EffectiveFieldPermissionsInputSet { * this map never advertises an edit the write gate refuses, and may hide one it * admits on the rows the condition does not name. * - * A set holding the super-user bypass on an object then votes on every field - * of it ({@link superuserFieldVote}, ruling of record 6573563853), except - * that a View All set casts no read vote on a field its own row declares - * `readable: false` (ADR-0066 D2 ⑧ note of 2026-11-15). A set carrying - * `viewAllFields` on the object casts that same read vote, under the same - * own-row rule, and never an edit vote (ruling of record 6912661484). + * A set carrying `viewAllFields` on an object then casts a read vote on every + * field of it the map names, except a field its own row declares + * `readable: false`, and never an edit vote ({@link viewAllFieldsReadVote}, + * ruling of record 6912661484). View All and Modify All cast no field vote. * * Every entry is a FRESH object, as {@link buildEffectiveObjectPermissions}'s are. */ @@ -1166,16 +1151,13 @@ export function buildEffectiveFieldPermissions( fields[key] = acc; } } - // [Ruling of record 6573563853; ADR-0066 D2 ⑧ note of 2026-11-15] The - // super-user vote, per field the map names — the same function - // `getFieldPermissions` applies per field of its object. + // [Ruling of record 6912661484] The `viewAllFields` read vote, per field the + // map names — the same function `getFieldPermissions` applies per field of + // its object. for (const [key, acc] of Object.entries(fields)) { const dot = key.indexOf('.'); if (dot <= 0) continue; - const vote = superuserFieldVote(sets, key.slice(0, dot), key.slice(dot + 1)); - if (!vote) continue; - acc.readable = true; - if (vote.editable) acc.editable = true; + if (viewAllFieldsReadVote(sets, key.slice(0, dot), key.slice(dot + 1))) acc.readable = true; } return fields; } diff --git a/packages/core/src/security/index.ts b/packages/core/src/security/index.ts index aa9840cb8fc..2ded64d5c8c 100644 --- a/packages/core/src/security/index.ts +++ b/packages/core/src/security/index.ts @@ -433,10 +433,11 @@ export { // field-permission entry's vote under its row condition (`when`). buildEffectiveFieldPermissions, fieldPermissionVote, - // [ADR-0066 ⑧, ruling of record 6573563853] The one super-user predicate - // (row bypass and field vote alike) and the field merge's super-user vote. + // [ADR-0066 ⑧] The one super-user predicate (the row bypass), and the field + // merge's one "all fields" vote, `viewAllFields` (the field-axis split, + // ruling of record 6912661484: View All / Modify All cast no field vote). holdsSuperuserBypass, - superuserFieldVote, + viewAllFieldsReadVote, type FieldConditionVerdict, type FieldPermissionEntryLike, type EffectiveFieldPermissionsInputSet, diff --git a/packages/lint/src/index.ts b/packages/lint/src/index.ts index 8880a48921c..5857c42a370 100644 --- a/packages/lint/src/index.ts +++ b/packages/lint/src/index.ts @@ -437,7 +437,6 @@ export { SECURITY_CBP_AMBIGUOUS_RELATION, SECURITY_CBP_OWNER_POLICY_WITHOUT_OPT_IN, SECURITY_CBP_MASTER_REFERENCE_HIDDEN, - SECURITY_SUPERUSER_FIELD_MASK_INERT, SECURITY_CROSS_SET_FIELD_REOPEN, SECURITY_UPDATE_POLICY_NO_CHECK, holdsSuperuserBypass, diff --git a/packages/lint/src/rule-explanations.ts b/packages/lint/src/rule-explanations.ts index 34b8b040634..16a2d8a9f75 100644 --- a/packages/lint/src/rule-explanations.ts +++ b/packages/lint/src/rule-explanations.ts @@ -833,10 +833,9 @@ const SECURITY_CBP_MASTER_REFERENCE_HIDDEN_EXPLANATION: RuleExplanation = { 'parent record of this detail" ("no read permission" where read is the question), which names no master object, no master record and no check. The ' + 'writer has no way to tell from the refusal which record to ask for access to.', 'Reported for each permission set whose own entry for the master reference reads `readable: false` (an ' + - 'omitted `readable` is `true`), on a detail this stack declares with one master. Not reported when the ' + - 'same set holds Modify All on the detail, because that bit makes the entry inert ' + - '(`security-superuser-field-mask-inert`). Reported beside View All alone, where the set\'s own ' + - '`readable: false` binds.', + 'omitted `readable` is `true`), on a detail this stack declares with one master. The set\'s own ' + + '`readable: false` binds beside any object-wide bit the set holds: View All and Modify All cast no ' + + 'field vote, and a set\'s own row beats its own `viewAllFields`.', 'This is a warning, not an error: hiding the reference is legal and no door refuses it. To fix it, make ' + 'the reference readable (`readable: true`, or delete the entry) when the set\'s holders should see why ' + 'a write is refused. Keep it hidden when a generic refusal is what is meant.', @@ -1001,67 +1000,32 @@ const SECURITY_MODIFY_ALL_DELETE_WITHHELD_EXPLANATION: RuleExplanation = { ], }; -const SECURITY_SUPERUSER_FIELD_MASK_INERT_EXPLANATION: RuleExplanation = { - rule: 'security-superuser-field-mask-inert', - covers: 'why a field mask beside Modify All restricts nothing', - paragraphs: [ - '`modifyAllRecords` (Modify All) is the super-user write bypass on an object. A set that holds it votes ' + - 'on every field of that object when the field permissions are merged: `readable: true` and ' + - '`editable: true`, on its own field entries too (ADR-0066 D2 as amended). The merge is a union, so a ' + - '`readable: false` the same set declares on that object hides the field from none of the set\'s ' + - 'holders, and its edit lock (`editable: false`, or `editable` omitted, which parses to false) holds ' + - 'none of them back either. The stored set still reads as masked, which is why an author or a reviewer ' + - 'takes the field to be protected.', - '`viewAllRecords` (View All) alone is not reported. It votes only `readable: true`, and it casts no ' + - 'vote on a field the same set declares `readable: false`, so a set can grant View All on an object ' + - 'and still hide a field of it from its holders. View All never widens a write, so an edit lock beside ' + - 'it binds as well.', - 'The set\'s bypass is read the way the runtime reads it: its own entry for the object when it has one, ' + - 'otherwise its `\'*\'` entry, as a lookup and never a merge. Only the set that declares the entry is ' + - 'judged here. A holder of two sets is unmasked by the other set\'s View All, Modify All or ' + - '`viewAllFields` too; that is `security-cross-set-field-reopen`, which skips a row this rule reports, ' + - 'so one row earns one finding.', - 'This is a warning, not an error: the pair is legal and no door refuses it. To fix it, decide which half ' + - 'is meant. If the field must stay hidden or read-only, remove `modifyAllRecords` from the object entry ' + - 'and reach every row another way, with `readScope: \'org\'` / `writeScope: \'org\'` on the entry or a ' + - '`rowLevelSecurity` policy whose condition every row satisfies; the mask then binds. `viewAllRecords` ' + - 'may stay, since the set\'s own `readable: false` binds beside it. If the bypass is meant, delete the ' + - 'field entry, which never took effect.', - ], -}; - const SECURITY_CROSS_SET_FIELD_REOPEN_EXPLANATION: RuleExplanation = { rule: 'security-cross-set-field-reopen', covers: 'why a field one set hides is still read through another set', paragraphs: [ 'Field permissions from every set a caller holds are merged as a union, with no deny. A set that holds ' + - '`viewAllRecords` (View All), `modifyAllRecords` (Modify All) or `viewAllFields` on an object votes ' + - '`readable: true` on every field of it, and Modify All votes `editable: true` as well. So when one set ' + - 'hides a field (`readable: false`) or locks it (`editable: false`, or `editable` omitted, which parses ' + - 'to false), a caller who also holds a second set with one of those bits on the object reads the field ' + - '(and, under Modify All, edits it). The first set still reads as protecting the field, and nothing ' + - 'refuses the pair, which is why an author takes the field to be hidden.', - 'The bits are read the way the runtime reads them: the second set\'s own entry for the object when it ' + - 'has one, otherwise its `\'*\'` entry, as a lookup and never a merge. Inside one set the specific row ' + - 'beats the general bit: a second set whose own row declares the field `readable: false` beside View ' + - 'All or `viewAllFields` casts no read vote on it, so it is not reported. View All and `viewAllFields` ' + - 'never vote an edit, so an edit lock beside them binds and is not reported either. A row its own set\'s ' + - 'Modify All already unbinds is `security-superuser-field-mask-inert`, not this rule, so one row earns ' + - 'one finding.', + '`viewAllFields` on an object votes `readable: true` on every field of it, including fields added ' + + 'later. So when one set hides a field (`readable: false`), a caller who also holds a second set with ' + + '`viewAllFields` on the object reads the field. The first set still reads as protecting the field, and ' + + 'nothing refuses the pair, which is why an author takes the field to be hidden.', + '`viewAllRecords` (View All) and `modifyAllRecords` (Modify All) are not reported: they widen which ' + + 'records a caller reaches and cast no vote on any field, so they re-open nothing. `viewAllFields` never ' + + 'votes an edit, so an edit lock beside it binds and is not reported either.', + 'The bit is read the way the runtime reads it: the second set\'s own entry for the object when it has ' + + 'one, otherwise its `\'*\'` entry, as a lookup and never a merge. Inside one set the specific row beats ' + + 'the general bit: a second set whose own row declares the field `readable: false` beside its ' + + '`viewAllFields` casts no read vote on it, so it is not reported.', 'What is not reported: a field that declares `requiredPermissions` (ADR-0066 D3), because that AND-gate ' + 'is applied after the merge and no set\'s bit opens it to a caller without the capabilities; a key on ' + 'an object this stack does not define, or naming a field the object does not declare; and any field ' + 'judged by its name. The rule reads only the declared two-set shape.', 'This is a warning, not an error: the pair is legal and no door refuses it. To fix it, decide what the ' + - 'second set means. If it should not read the field, drop the bit from its entry (reach the rows with ' + - '`readScope` / `writeScope` or a row-level policy instead of View All or Modify All), or give it its own ' + - '`readable: false` row on the field, which binds beside View All and `viewAllFields` but not beside ' + - 'Modify All. If it really should read every field, say so with `viewAllFields: true` on its entry: that ' + - 'read then survives the major release in which View All and Modify All stop voting on fields. A field ' + - 'that must stay hidden from everyone without a capability, such as a salary or an ID number, is ' + - 'protected on the field itself: declare `requiredPermissions` on it (ADR-0066 D3), and add a ' + - '`maskingRule` where a partial value is needed, so the rule no longer depends on which sets a caller ' + - 'holds.', + 'second set means. If it should not read the field, drop `viewAllFields` from its entry, or give it its ' + + 'own `readable: false` row on the field, which binds beside the bit. A field that must stay hidden from ' + + 'everyone without a capability, such as a salary or an ID number, is protected on the field itself: ' + + 'declare `requiredPermissions` on it (ADR-0066 D3), and add a `maskingRule` where a partial value is ' + + 'needed, so the rule no longer depends on which sets a caller holds.', ], }; @@ -1103,8 +1067,8 @@ const SECURITY_ROLLUP_SOURCE_UNREADABLE_EXPLANATION: RuleExplanation = { 'minimum, maximum or count of child values it cannot read one by one.', '"Can read" is judged as the runtime decides it, through three gates. The object grant: the set\'s own ' + 'entry for the object, otherwise its `\'*\'` entry, which covers a private object only with View All ' + - 'or Modify All. The field entry: `readable: false` hides the field, unless the set holds Modify All ' + - 'on the object; a set with no entry for a field reads it. The capability gate: an object\'s ' + + 'or Modify All. The field entry: `readable: false` hides the field, whatever object-wide bit the set ' + + 'holds; a set with no entry for a field reads it. The capability gate: an object\'s ' + '`requiredPermissions` (the list, or the `read` bucket of the per-operation map) and a field\'s ' + '`requiredPermissions` refuse the read unless the set\'s `systemPermissions` hold every listed ' + 'capability. View All and Modify All do not lift the capability gate, so a set holding them on the ' + @@ -1119,11 +1083,9 @@ const SECURITY_ROLLUP_SOURCE_UNREADABLE_EXPLANATION: RuleExplanation = { 'staff who may not see line costs. If the value should not be visible to the set, hide the summary ' + 'column for it with `fields: { \'.\': { readable: false } }`. That entry hides the ' + 'column from every holder of the set, and a co-held set with no entry for the column does not restore ' + - 'it, because only sets that declare an entry vote in the field merge (View All or Modify All on the ' + - 'parent in a co-held set does restore it); to keep the column for some ' + - 'holders, declare `readable: true` on it in the sets they hold. A set that holds Modify All on the ' + - 'parent must drop that bit first, because Modify All makes the entry inert. If the set may see ' + - 'the child data, grant the read on the child instead.', + 'it, because only sets that declare an entry vote in the field merge (`viewAllFields` on the parent in ' + + 'a co-held set does restore it); to keep the column for some holders, declare `readable: true` on it ' + + 'in the sets they hold. If the set may see the child data, grant the read on the child instead.', 'If the pair is meant, say so on the set: `fields: { \'.\': { readable: true, ' + 'rollupSourceUnreadableReason: \'\' } }`. That one finding, ' + 'for this set and this column, is then reported as a note that quotes the reason, so `--strict` passes ' + @@ -6864,7 +6826,6 @@ export const RULE_EXPLANATIONS: Readonly> = Obje [SECURITY_MASTER_DETAIL_UNGRANTED_EXPLANATION.rule]: SECURITY_MASTER_DETAIL_UNGRANTED_EXPLANATION, [SECURITY_WILDCARD_VAMA_EXPLANATION.rule]: SECURITY_WILDCARD_VAMA_EXPLANATION, [SECURITY_MODIFY_ALL_DELETE_WITHHELD_EXPLANATION.rule]: SECURITY_MODIFY_ALL_DELETE_WITHHELD_EXPLANATION, - [SECURITY_SUPERUSER_FIELD_MASK_INERT_EXPLANATION.rule]: SECURITY_SUPERUSER_FIELD_MASK_INERT_EXPLANATION, [SECURITY_UPDATE_POLICY_NO_CHECK_EXPLANATION.rule]: SECURITY_UPDATE_POLICY_NO_CHECK_EXPLANATION, [SECURITY_ROLLUP_SOURCE_UNREADABLE_EXPLANATION.rule]: SECURITY_ROLLUP_SOURCE_UNREADABLE_EXPLANATION, [SECURITY_ROLLUP_SOURCE_ROW_SCOPED_EXPLANATION.rule]: SECURITY_ROLLUP_SOURCE_ROW_SCOPED_EXPLANATION, diff --git a/packages/lint/src/validate-rollup-source-visibility.ts b/packages/lint/src/validate-rollup-source-visibility.ts index 3818ee38257..0b98735dfce 100644 --- a/packages/lint/src/validate-rollup-source-visibility.ts +++ b/packages/lint/src/validate-rollup-source-visibility.ts @@ -56,10 +56,9 @@ * - the object grant: the set's own entry for the object, otherwise its `'*'` * entry, which covers a `private` object only when it carries View All / * Modify All ({@link grantFor}, `resolveObjectPermission`); - * - the field entry: `readable: false` hides the field, unless the set's - * Modify All on the object votes every field readable (ADR-0066 D2 ⑧ as - * amended). Beside View All alone the set's own entry binds (note of - * 2026-11-15). No entry ⇒ readable, as the merge does with an absent key + * - the field entry: `readable: false` hides the field, whatever + * object-wide bit the set holds (the field-axis split, ruling of record + * 6912661484). No entry ⇒ readable, as the merge does with an absent key * ({@link fieldHidden}); * - the capability gate (ADR-0066 D3): an object's `requiredPermissions` — * the `string[]` form, or the `read` bucket of the per-operation map @@ -226,18 +225,15 @@ function grantFor(set: AnyRec, objectName: string, isPrivate: boolean): Effectiv /** * Does the set's own field entry hide `objectName.fieldName`? `readable: false` - * hides it unless the set's Modify All on the object votes every field - * readable (ADR-0066 D2 ⑧ as amended). The set's View All alone casts no vote - * on a field its own entry hides (note of 2026-11-15), so the entry binds - * there. Nor does its `viewAllFields`: inside one set the specific row beats - * the general bit (the field-axis split, ruling of record 6912661484), so the - * bit never lifts this answer. No entry ⇒ not hidden. + * hides it whatever object-wide bit the set holds (the field-axis split, + * ruling of record 6912661484): View All and Modify All cast no field vote, + * and inside one set the specific row beats the general `viewAllFields` bit. + * No entry ⇒ not hidden. */ function fieldHidden(set: AnyRec, objectName: string, fieldName: string): boolean { const fields = isRec(set.fields) ? set.fields : undefined; const entry = fields?.[`${objectName}.${fieldName}`]; - if (!isRec(entry) || entry.readable !== false) return false; - return !holdsSuperuserBypass(set as { objects?: Record }, objectName, 'modify'); + return isRec(entry) && entry.readable === false; } /** @@ -404,23 +400,16 @@ function acknowledgedReason(set: AnyRec, column: string): string | undefined { /** * The remedy, with its reach: in the field merge only DECLARING sets vote, so * `readable: false` on this set hides the column from every holder of the set, - * and only an entry with `readable: true` (or View All / Modify All on the - * parent) in a co-held set restores it. + * and only an entry with `readable: true` (or `viewAllFields` on the parent) + * in a co-held set restores it. */ -function hintFor(set: AnyRec, d: SummaryDescriptor): string { +function hintFor(d: SummaryDescriptor): string { const column = `${d.parent.name}.${d.field}`; const entry = `fields["${column}"]: { readable: false }`; const reach = `That hides "${column}" 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 "${d.parent.name}" does); to keep it for some holders, declare ` + + `restore it (viewAllFields on "${d.parent.name}" does); to keep it for some holders, declare ` + `fields["${column}"]: { readable: true } in the sets they hold`; - if (holdsSuperuserBypass(set as { objects?: Record }, d.parent.name, 'modify')) { - return ( - `If its value should not be visible to this set, first remove Modify All on ` + - `"${d.parent.name}" from it, since ${entry} does not hide a field from a set holding it, then set ` + - `${entry} on it. ${reach}` - ); - } return `If its value should not be visible to this set, set ${entry} on it. ${reach}`; } @@ -446,7 +435,7 @@ export function validateRollupSourceVisibility(stack: AnyRec): RollupSourceVisib where: `permission set "${setName}" · summary field "${column}"`, path: `permissions[${i}].fields["${column}"]`, message: `${message}; ${ROLLUP_SEMANTICS}`, - hint: hintFor(set, d), + hint: hintFor(d), } : { severity: 'info', @@ -514,7 +503,7 @@ export function validateRollupSourceVisibility(stack: AnyRec): RollupSourceVisib message: `${rollupPhrase(d, { everyRow: true })}, while ${by} narrows the rows permission set ` + `"${setName}" reads${forHolders}; ${ROLLUP_SEMANTICS}`, - hint: hintFor(set, d), + hint: hintFor(d), }); } }); diff --git a/packages/lint/src/validate-security-posture.ts b/packages/lint/src/validate-security-posture.ts index 635191f556d..db31aafa9db 100644 --- a/packages/lint/src/validate-security-posture.ts +++ b/packages/lint/src/validate-security-posture.ts @@ -22,9 +22,8 @@ * | security-cbp-ambiguous-relation(error) | #14747 order-dependent master; runtime refusal since #23100 | * | security-modify-all-delete-withheld(error) | #25575 Modify All includes delete — UNPARSED intakes only, see the arm | * | security-controlled-by-parent-owner-policy-without-opt-in (warning) | ADR-0055 §3 amendment (ruling 6398566164): a caller-keyed update policy on a detail admits nobody the master gate refuses — unless it keys `owner_id` and the detail opted in (#26591: the opt-in is prescribed only there) | - * | security-superuser-field-mask-inert (warning) | ADR-0066 D2 ⑧ as amended (ruling 6573563853, letter A; note of 2026-11-15): a set's Modify All on an object votes on every field of it, so its own `readable: false` or edit lock on that object binds none of its holders. Beside View All alone the set's own `readable: false` binds, and is not reported | * | security-controlled-by-parent-master-reference-hidden (warning) | ADR-0055 §3: a write of a detail needs edit access to the master its stored reference names, so a set's `readable: false` on that reference hides a field that still decides its holders' writes, and a holder refused there gets a refusal that names no master | - * | security-cross-set-field-reopen (warning) | ADR-0066 D2 ⑧; the field-axis split, ruling 6912661484, step 2: one set's `readable: false` or edit lock on a field binds no holder of a second set whose View All, Modify All or `viewAllFields` on the object votes that field open; the same-set case is `security-superuser-field-mask-inert`'s | + * | security-cross-set-field-reopen (warning) | ADR-0066 D2 ⑧; the field-axis split, ruling 6912661484, steps 2 and 3: one set's `readable: false` on a field binds no holder of a second set whose `viewAllFields` on the object votes that field readable. View All and Modify All cast no field vote since step 3 (the same step retired `security-superuser-field-mask-inert`) | * | security-update-policy-no-check (info) | ADR-0058 D4 write-check composition: a USING-only `update` / `all` policy keyed on a caller column other than `created_by` lets the ownership floor admit a row's new image too; info tier, so neither `os lint --strict` nor `os validate --strict` fails on it | * * Per ADR-0049 discipline these are NOT advisory security: every `error` rule @@ -182,7 +181,6 @@ export const SECURITY_CBP_NO_RELATION = 'security-controlled-by-parent-no-relati export const SECURITY_CBP_AMBIGUOUS_RELATION = 'security-controlled-by-parent-ambiguous-relation'; export const SECURITY_MODIFY_ALL_DELETE_WITHHELD = 'security-modify-all-delete-withheld'; export const SECURITY_CBP_OWNER_POLICY_WITHOUT_OPT_IN = 'security-controlled-by-parent-owner-policy-without-opt-in'; -export const SECURITY_SUPERUSER_FIELD_MASK_INERT = 'security-superuser-field-mask-inert'; export const SECURITY_CROSS_SET_FIELD_REOPEN = 'security-cross-set-field-reopen'; export const SECURITY_CBP_MASTER_REFERENCE_HIDDEN = 'security-controlled-by-parent-master-reference-hidden'; export const SECURITY_UPDATE_POLICY_NO_CHECK = 'security-update-policy-no-check'; @@ -311,7 +309,8 @@ export function isSystemObject(obj: AnyRec): boolean { * [ADR-0066 D2 / ①] Does `set` hold the super-user ("View/Modify All Data") * bypass on `objectName`? A verbatim copy of `holdsSuperuserBypass` in * `@objectstack/core` (`security/effective-object-permissions.ts`), the ONE - * reading the runtime's row bypass and both field merges ask. Copied, not + * reading of the runtime's row bypass; it reaches no field (the field-axis + * split, ruling of record 6912661484, step 3). Copied, not * imported, because this package depends on `@objectstack/spec` alone; * `packages/cli/test/superuser-bypass-mirror-parity.test.ts` runs both over * one case matrix, so a change to either reds it until the other follows. @@ -342,7 +341,7 @@ export function holdsSuperuserBypass( * A] Does `set` carry `viewAllFields` on `objectName`? A copy of the private * `holdsViewAllFields` in `@objectstack/core` * (`security/effective-object-permissions.ts`), the reading - * `superuserFieldVote` asks: the set's own entry for the object when it has + * `viewAllFieldsReadVote` asks: the set's own entry for the object when it has * one, otherwise its `'*'` wildcard (a lookup, never a merge), and the bit * read as `=== true`. A field-axis question only, so it is deliberately not a * disjunct of {@link holdsSuperuserBypass}: the bit widens no record. @@ -917,69 +916,42 @@ function pushExtensionMergedCbpFindings(findings: SecurityFinding[], stack: AnyR } /** - * The bit through which one set votes a field of `objectName` open, named the - * way `security-cross-set-field-reopen`'s user sentence selects its label. + * [ADR-0066 D2 ⑧; the field-axis split, ruling of record 6912661484, step 3] + * The read vote ONE set casts on `.` through + * `viewAllFields`, read as `viewAllFieldsReadVote` (`@objectstack/core`) + * reads it for that set: a read vote on every field, except a field the set's + * own row declares `readable: false` (inside one set, specific beats general), + * and never an edit vote. `undefined` when the set casts none. `via` names the + * entry the lookup answered from: the set's own entry for the object when it + * has one, otherwise `'*'`. View All and Modify All cast no field vote. */ -type FieldReopenBit = 'view-all' | 'modify-all' | 'view-all-fields'; - -const FIELD_REOPEN_BIT_KEY: Readonly> = { - 'view-all': 'viewAllRecords', - 'modify-all': 'modifyAllRecords', - 'view-all-fields': 'viewAllFields', -}; - -/** - * [ADR-0066 D2 ⑧ as amended; the field-axis split, ruling of record - * 6912661484] The vote ONE set casts on `.` through - * its object-wide bits, read as `superuserFieldVote` (`@objectstack/core`) - * reads it for that set: Modify All votes `readable` and `editable` on every - * field, its own rows included; View All and `viewAllFields` vote `readable` - * only, and cast no vote on a field the set's own row declares - * `readable: false` (inside one set, specific beats general). `undefined` - * when the set casts no such vote. `via` names the entry the lookup answered - * from: the set's own entry for the object when it has one, otherwise `'*'`. - */ -function objectWideFieldVote( - set: AnyRec, - objectName: string, - fieldName: string, -): { bit: FieldReopenBit; via: string; editable: boolean } | undefined { +function viewAllFieldsVoteOf(set: AnyRec, objectName: string, fieldName: string): { via: string } | undefined { + if (!holdsViewAllFields(set, objectName)) return undefined; const objects = set.objects && typeof set.objects === 'object' ? (set.objects as AnyRec) : undefined; - const via = objects?.[objectName] ? `objects.${objectName}` : `objects['*']`; - if (holdsSuperuserBypass(set, objectName, 'modify')) return { bit: 'modify-all', via, editable: true }; - const viewAll = holdsSuperuserBypass(set, objectName, 'view'); - if (!viewAll && !holdsViewAllFields(set, objectName)) return undefined; const fields = set.fields && typeof set.fields === 'object' ? (set.fields as AnyRec) : undefined; const own = fields?.[`${objectName}.${fieldName}`]; if (own && typeof own === 'object' && (own as AnyRec).readable === false) return undefined; - return { bit: viewAll ? 'view-all' : 'view-all-fields', via, editable: false }; + return { via: objects?.[objectName] ? `objects.${objectName}` : `objects['*']` }; } /** - * [ADR-0066 D2 ⑧ as amended; the field-axis split, ruling of record - * 6912661484, step 2] `security-cross-set-field-reopen`: one set hides a - * field (`readable: false`) or locks it (`editable` not `true`), and ANOTHER - * set's View All, Modify All or `viewAllFields` on the object votes that field - * open. Field grants union without deny, so a caller holding both sets reads - * the field (and, under Modify All, edits it), while the first set reads as - * protecting it. The case behind it: a field hidden from one role by a - * `readable: false` row, read anyway by a holder who also has View All on the - * object through another set. + * [ADR-0066 D2 ⑧; the field-axis split, ruling of record 6912661484, steps 2 + * and 3] `security-cross-set-field-reopen`: one set hides a field + * (`readable: false`), and ANOTHER set's `viewAllFields` on the object votes + * that field readable. Field grants union without deny, so a caller holding + * both sets reads the field, while the first set reads as protecting it. * - * What it reads, and why each skip: + * Since step 3 `viewAllFields` is the only object-wide bit that votes on a + * field: View All and Modify All widen which records the caller reaches and + * nothing else, so they re-open no field and this rule no longer names them. + * `viewAllFields` votes no edit, so an edit lock binds beside it and is never + * reported either. What the rule reads, and why each skip: * * - Only the declared two-set shape. No field-name heuristic: a field is * judged by its rows and its object's bits, never by what it is called. - * - The hiding set's own Modify All on the object makes its own row inert: - * that is the same-set case `security-superuser-field-mask-inert` reports, - * so the row is skipped here and no row earns two findings for one cause. - * Beside its own View All alone the row binds that set's holders (the note - * of 2026-11-15), so it is judged here. - * - The second set casts the vote `superuserFieldVote` casts for it - * ({@link objectWideFieldVote}): its own `readable: false` row beside View - * All or `viewAllFields` keeps the field closed for it, so it re-opens - * nothing. View All and `viewAllFields` vote read only, so an edit lock - * beside them binds and is not reported. + * - The second set casts the vote `viewAllFieldsReadVote` casts for it + * ({@link viewAllFieldsVoteOf}): its own `readable: false` row beside its + * `viewAllFields` keeps the field closed for it, so it re-opens nothing. * - A field gated on the field itself by `requiredPermissions` (ADR-0066 D3) * is not reported: that AND-gate is folded in after the merge, so no set's * bit opens it to a caller without the capabilities. It is the ruled place @@ -1021,6 +993,7 @@ function pushCrossSetFieldReopen( const flsMap = ps.fields && typeof ps.fields === 'object' ? (ps.fields as AnyRec) : {}; for (const [flsKey, flsEntry] of Object.entries(flsMap)) { if (!flsEntry || typeof flsEntry !== 'object') continue; + if ((flsEntry as AnyRec).readable !== false) continue; const dot = flsKey.indexOf('.'); if (dot <= 0) continue; // unqualified: `security-fls-unqualified-key` const objectName = flsKey.slice(0, dot); @@ -1029,58 +1002,32 @@ function pushCrossSetFieldReopen( if (!surface) continue; // not this stack's object, or no readable field map if (!surface.names.has(fieldName) && !surface.injected.has(fieldName)) continue; // `security-fls-unknown-field` if (capabilityGated.get(objectName)?.has(fieldName)) continue; // ADR-0066 D3 gates it after the merge - if (holdsSuperuserBypass(ps, objectName, 'modify')) continue; // same-set: `security-superuser-field-mask-inert` - const mask = flsEntry as AnyRec; - const readMasked = mask.readable === false; - const editLocked = mask.editable !== true; - if (!readMasked && !editLocked) continue; for (let j = 0; j < permissionSets.length; j++) { if (j === i) continue; const set = permissionSets[j]; if (!set || typeof set !== 'object') continue; - const vote = objectWideFieldVote(set, objectName, fieldName); + const vote = viewAllFieldsVoteOf(set, objectName, fieldName); if (!vote) continue; - const reopensRead = readMasked; - const reopensEdit = editLocked && vote.editable; - if (!reopensRead && !reopensEdit) continue; const otherName = typeof set.name === 'string' ? set.name : `(permission set ${j})`; - const bitKey = FIELD_REOPEN_BIT_KEY[vote.bit]; - const reopened = reopensRead && reopensEdit ? 'both' : reopensRead ? 'read' : 'edit'; - const votes = { both: 'readable and editable', read: 'readable', edit: 'editable' }[reopened]; - const restriction = { both: 'readable: false and the edit lock', read: 'readable: false', edit: 'the edit lock' }[ - reopened - ]; - const binds = reopened === 'both' ? 'bind' : 'binds'; - const drop = - vote.bit === 'view-all-fields' - ? `Drop viewAllFields from "${otherName}"'s ${vote.via} entry` - : `Drop ${bitKey} from "${otherName}"'s ${vote.via} entry and reach the rows with readScope/writeScope or a row-level policy`; - const ownRow = vote.editable ? '' : `, or give "${otherName}" its own '${flsKey}': { readable: false } row`; - const allFields = - reopensRead && vote.bit !== 'view-all-fields' - ? `; if "${otherName}" really should read every field, say so with viewAllFields: true on that entry` - : ''; - const capability = reopensRead - ? `; a field that must stay hidden from everyone without a capability (salary, an ID number) declares ` + - `requiredPermissions on the field (ADR-0066 D3), plus a maskingRule where a partial value is needed` - : `; a field no one may edit without a capability declares requiredPermissions on the field (ADR-0066 D3)`; findings.push({ severity: 'warning', rule: SECURITY_CROSS_SET_FIELD_REOPEN, where: `permission set "${hidingName}"`, path: `permissions[${i}].fields["${flsKey}"]`, message: - `permission set "${otherName}" holds ${bitKey} on ${vote.via}, which votes ${votes} on every field of ` + - `"${objectName}", so ${restriction} on '${flsKey}' ${binds} no holder of both sets`, - hint: `${drop}${ownRow}${allFields}${capability}`, + `permission set "${otherName}" holds viewAllFields on ${vote.via}, which votes readable on every field ` + + `of "${objectName}", so readable: false on '${flsKey}' binds no holder of both sets`, + hint: + `Drop viewAllFields from "${otherName}"'s ${vote.via} entry, or give "${otherName}" its own ` + + `'${flsKey}': { readable: false } row; a field that must stay hidden from everyone without a ` + + `capability (salary, an ID number) declares requiredPermissions on the field (ADR-0066 D3), plus a ` + + `maskingRule where a partial value is needed`, userTextParams: { permissionSet: hidingName, otherSet: otherName, field: flsKey, object: objectName, - bit: vote.bit, - reopened, }, }); } @@ -1309,10 +1256,10 @@ export function validateSecurityPosture(stack: AnyRec, opts?: { nowMs?: number } // read from the stored row whatever the writer may read, so the hidden // field still decides the holder's write, and a holder refused there is // told only the rule, with no master named. Read as the field merges - // read the entry (an omitted `readable` is `true`), and not reported - // beside the set's own Modify All on the detail, which makes the mask - // inert (`security-superuser-field-mask-inert`). Beside View All alone - // the set's own mask binds (ADR-0066 D2 ⑧ note of 2026-11-15), so the + // read the entry (an omitted `readable` is `true`). The set's own mask + // binds beside any object-wide bit it holds (the field-axis split, + // ruling of record 6912661484: View All and Modify All cast no field + // vote, and a set's own row beats its own `viewAllFields`), so the // reference is hidden and this rule speaks. // `warning`: hiding the reference is legal, and no door refuses it. const flsEntries = ps.fields && typeof ps.fields === 'object' ? (ps.fields as AnyRec) : {}; @@ -1323,7 +1270,6 @@ export function validateSecurityPosture(stack: AnyRec, opts?: { nowMs?: number } const detailName = flsKey.slice(0, dot); const detail = cbpDetails.get(detailName); if (!detail || flsKey.slice(dot + 1) !== detail.masterField) continue; - if (holdsSuperuserBypass(ps, detailName, 'modify')) continue; pushCbpMasterReferenceHidden(findings, psName, `permissions[${i}].fields["${flsKey}"]`, flsKey); } const policies = recordsOf(ps.rowLevelSecurity); @@ -1592,62 +1538,6 @@ export function validateSecurityPosture(stack: AnyRec, opts?: { nowMs?: number } }); } - // [ADR-0066 D2 ⑧ as amended — ruling of record 6573563853, letter A; note - // of 2026-11-15] A field mask this set's OWN Modify All unbinds. A set - // holding Modify All on an object votes `readable: true` and - // `editable: true` on every field of it in both field merges - // (`superuserFieldVote`, `@objectstack/core`), its own rows included. So - // beside Modify All neither a `readable: false` nor an edit lock binds - // the set's holders. - // - // View All alone is NOT reported. It votes only `readable: true`, and it - // casts no vote on a field the set's own row declares `readable: false`, - // so that mask binds; it never widened a write, so an edit lock beside it - // binds as well. - // - // `warning`, never `error`: the pair is legal, it only does not do what - // it reads as. The bypass is read by `holdsSuperuserBypass` below, the - // runtime's one reading copied verbatim (this package depends on spec - // alone); `packages/cli/test/superuser-bypass-mirror-parity.test.ts` - // holds the copy equal to core's. The entry's bits are read as parsing - // writes them (an omitted `readable` is `true`, an omitted `editable` is - // `false`), which is what both merges then read, so a raw set and its - // parse answer the same. One set at a time: another set's bypass unmasks - // a holder of both, but no author wrote an inert entry there. - for (const [flsKey, flsEntry] of Object.entries(flsMap)) { - if (!flsEntry || typeof flsEntry !== 'object') continue; - const dot = flsKey.indexOf('.'); - if (dot <= 0) continue; // unqualified, judged above; both merges skip it too - const flsObject = flsKey.slice(0, dot); - if (!holdsSuperuserBypass(ps, flsObject, 'modify')) continue; - const mask = flsEntry as AnyRec; - const readMasked = mask.readable === false; - const editLocked = mask.editable !== true; - const inertBits = [readMasked ? 'readable: false' : '', editLocked ? 'the edit lock' : ''].filter(Boolean); - if (inertBits.length === 0) continue; - const binds = inertBits.length > 1 ? 'bind' : 'binds'; - const via = objectsMap[flsObject] ? `objects.${flsObject}` : `objects['*']`; - findings.push({ - severity: 'warning', - rule: SECURITY_SUPERUSER_FIELD_MASK_INERT, - where: `permission set "${psName}"`, - path: `${psPath}.fields["${flsKey}"]`, - message: - `modifyAllRecords on ${via} votes on every field of "${flsObject}", so ${inertBits.join(' and ')} ` + - `on '${flsKey}' ${binds} none of this set's holders`, - hint: - `Remove modifyAllRecords from ${via} and reach the rows with readScope/writeScope or a row-level policy, ` + - `or delete the entry if the bypass is meant`, - // `inert` names the half the user sentence may call ineffective. - userTextParams: { - permissionSet: psName, - field: flsKey, - object: flsObject, - inert: inertBits.length > 1 ? 'both' : readMasked ? 'read' : 'edit', - }, - }); - } - // [#25575] `allowDelete: false` beside `modifyAllRecords: true`. Modify All // is the write bypass for edit, delete and transfer, so the evaluator // grants delete and never reads the false. The schema refuses the pair, so diff --git a/packages/lint/src/validate-security-posture.user-text.ts b/packages/lint/src/validate-security-posture.user-text.ts index 9da7dd16ac8..bb135ae9289 100644 --- a/packages/lint/src/validate-security-posture.user-text.ts +++ b/packages/lint/src/validate-security-posture.user-text.ts @@ -23,10 +23,9 @@ * | `security-private-no-readscope` | `permissionSet`, `object` | * | `security-master-detail-ungranted` | `object`, `master` (`''` when the runtime's parent names none) | * | `security-book-audience-unknown-set` | `book`, `permissionSet` | - * | `security-superuser-field-mask-inert` | `permissionSet`, `field`, `object`, `inert` (`read` · `edit` · `both`) | * | `security-controlled-by-parent-master-reference-hidden` | `permissionSet`, `field` | * | `security-update-policy-no-check` | `permissionSet`, `policy` | - * | `security-cross-set-field-reopen` | `permissionSet` (the set that hides the field), `otherSet` (the set that re-opens it), `field`, `object`, `bit` (`view-all` · `modify-all` · `view-all-fields`), `reopened` (`read` · `edit` · `both`) | + * | `security-cross-set-field-reopen` | `permissionSet` (the set that hides the field), `otherSet` (the set whose `viewAllFields` re-opens it), `field`, `object` | * | `security-controlled-by-parent-owner-policy-without-opt-in` | `permissionSet`, `policy`, `object`, `remedy` (`allow-owner-edit` · `key-owner-id` · `add-owner-id`) | * * Names in a sentence are the API names the rule saw (`crm_deal`, `owner_id`), @@ -47,31 +46,30 @@ import { SECURITY_CROSS_SET_FIELD_REOPEN, SECURITY_MASTER_DETAIL_UNGRANTED, SECURITY_PRIVATE_NO_READSCOPE, - SECURITY_SUPERUSER_FIELD_MASK_INERT, SECURITY_UPDATE_POLICY_NO_CHECK, } from './validate-security-posture.js'; /** - * The console's own label for Modify All, per locale. The one bypass - * `security-superuser-field-mask-inert` reports: beside View All alone the - * set's own `readable: false` binds (ADR-0066 D2 ⑧ note of 2026-11-15). + * The console's own label for `viewAllFields`, per locale: the one object-wide + * bit `security-cross-set-field-reopen` reports (View All and Modify All cast + * no field vote since the field-axis split, ruling of record 6912661484, step + * 3). Translated where the console translates its own labels, kept as the + * console's English label elsewhere. */ -const MODIFY_ALL_LABEL = { - en: 'Modify All Records', - 'zh-Hans': '修改所有记录', - 'zh-Hant': '修改所有記錄', - es: 'Modify All Records', - ar: 'Modify All Records', - fr: 'Modify All Records', - 'pt-BR': 'Modify All Records', - ru: 'Modify All Records', - de: 'Modify All Records', - ja: 'Modify All Records', - ko: 'Modify All Records', +const VIEW_ALL_FIELDS_LABEL = { + en: 'View All Fields', + 'zh-Hans': '查看所有字段', + 'zh-Hant': '查看所有欄位', + es: 'View All Fields', + ar: 'View All Fields', + fr: 'View All Fields', + 'pt-BR': 'View All Fields', + ru: 'View All Fields', + de: 'View All Fields', + ja: 'View All Fields', + ko: 'View All Fields', } as const; -const modifyAllLabel = (locale: keyof typeof MODIFY_ALL_LABEL): string => MODIFY_ALL_LABEL[locale]; - export const SECURITY_POSTURE_USER_TEXT: UserTextCatalog = Object.freeze({ [SECURITY_PRIVATE_NO_READSCOPE]: { en: (p) => @@ -237,219 +235,6 @@ export const SECURITY_POSTURE_USER_TEXT: UserTextCatalog = Object.freeze({ `않아 아무도 이 북을 열 수 없습니다. 기존 권한 세트로 제한하거나, "${p.permissionSet}"을(를) 설치된 다른 ` + `패키지가 제공한다면 이 메시지를 무시하세요.`, }, - [SECURITY_SUPERUSER_FIELD_MASK_INERT]: { - en: (p) => { - const b = modifyAllLabel('en'); - return fieldMaskSentence(p, { - read: - `In permission set "${p.permissionSet}", hiding field "${p.field}" has no effect: the set's ${b} on ` + - `"${p.object}" lets all its holders read every field of that object. Remove ${b} and grant record ` + - `access with a read or write scope, or let the set read the field if that access is meant.`, - edit: - `In permission set "${p.permissionSet}", making field "${p.field}" read-only has no effect: the set's ` + - `${b} on "${p.object}" lets all its holders edit every field of that object. Remove ${b} and grant ` + - `record access with a read or write scope, or delete the field restriction if that access is meant.`, - both: - `In permission set "${p.permissionSet}", hiding field "${p.field}" and making it read-only have no ` + - `effect: the set's ${b} on "${p.object}" lets all its holders read and edit every field of that object. ` + - `Remove ${b} and grant record access with a read or write scope, or delete the field restriction if ` + - `that access is meant.`, - }); - }, - 'zh-Hans': (p) => { - const b = modifyAllLabel('zh-Hans'); - return fieldMaskSentence(p, { - read: - `在权限集“${p.permissionSet}”中,隐藏字段“${p.field}”不起作用:该权限集对“${p.object}”拥有“${b}”,` + - `所有持有者都能读取该对象的每个字段。请移除“${b}”并改用读取或写入范围授予记录访问权限;` + - `如果本就打算让他们看到该字段,请允许该权限集读取它。`, - edit: - `在权限集“${p.permissionSet}”中,将字段“${p.field}”设为只读不起作用:该权限集对“${p.object}”拥有“${b}”,` + - `所有持有者都能编辑该对象的每个字段。请移除“${b}”并改用读取或写入范围授予记录访问权限;` + - `如果本就打算允许这种访问,请删除这条字段限制。`, - both: - `在权限集“${p.permissionSet}”中,隐藏字段“${p.field}”并将其设为只读都不起作用:该权限集对“${p.object}”` + - `拥有“${b}”,所有持有者都能读取和编辑该对象的每个字段。请移除“${b}”并改用读取或写入范围授予记录访问权限;` + - `如果本就打算允许这种访问,请删除这条字段限制。`, - }); - }, - 'zh-Hant': (p) => { - const b = modifyAllLabel('zh-Hant'); - return fieldMaskSentence(p, { - read: - `在權限集「${p.permissionSet}」中,隱藏欄位「${p.field}」不起作用:該權限集對「${p.object}」擁有「${b}」,` + - `所有持有者都能讀取該物件的每個欄位。請移除「${b}」並改用讀取或寫入範圍授予記錄存取權限;` + - `如果本就打算讓他們看到該欄位,請允許該權限集讀取它。`, - edit: - `在權限集「${p.permissionSet}」中,將欄位「${p.field}」設為只讀不起作用:該權限集對「${p.object}」擁有「${b}」,` + - `所有持有者都能編輯該物件的每個欄位。請移除「${b}」並改用讀取或寫入範圍授予記錄存取權限;` + - `如果本就打算允許這種存取,請刪除這條欄位限制。`, - both: - `在權限集「${p.permissionSet}」中,隱藏欄位「${p.field}」並將其設為只讀都不起作用:該權限集對「${p.object}」` + - `擁有「${b}」,所有持有者都能讀取和編輯該物件的每個欄位。請移除「${b}」並改用讀取或寫入範圍授予記錄存取權限;` + - `如果本就打算允許這種存取,請刪除這條欄位限制。`, - }); - }, - es: (p) => { - const b = modifyAllLabel('es'); - return fieldMaskSentence(p, { - read: - `En el conjunto de permisos "${p.permissionSet}", ocultar el campo "${p.field}" no tiene efecto: el ` + - `permiso "${b}" del conjunto sobre "${p.object}" permite a todos sus titulares leer todos los campos de ` + - `ese objeto. Quite "${b}" y conceda el acceso a los registros con un ámbito de lectura (Read scope) o de escritura (Write scope), o ` + - `permita que el conjunto lea el campo si ese acceso es intencionado.`, - edit: - `En el conjunto de permisos "${p.permissionSet}", dejar el campo "${p.field}" en solo lectura no tiene ` + - `efecto: el permiso "${b}" del conjunto sobre "${p.object}" permite a todos sus titulares editar todos ` + - `los campos de ese objeto. Quite "${b}" y conceda el acceso a los registros con un ámbito de lectura (Read scope) o ` + - `de escritura (Write scope), o elimine la restricción del campo si ese acceso es intencionado.`, - both: - `En el conjunto de permisos "${p.permissionSet}", ocultar el campo "${p.field}" y dejarlo en solo lectura ` + - `no tiene efecto: el permiso "${b}" del conjunto sobre "${p.object}" permite a todos sus titulares leer y ` + - `editar todos los campos de ese objeto. Quite "${b}" y conceda el acceso a los registros con un ámbito de ` + - `lectura (Read scope) o de escritura (Write scope), o elimine la restricción del campo si ese acceso es intencionado.`, - }); - }, - ar: (p) => { - const b = modifyAllLabel('ar'); - return fieldMaskSentence(p, { - read: - `في مجموعة الأذونات "${p.permissionSet}"، لا يكون لإخفاء الحقل "${p.field}" أي أثر: إذن "${b}" الذي ` + - `تملكه المجموعة على "${p.object}" يتيح لجميع حامليها قراءة كل حقول هذا الكائن. أزل "${b}" وامنح الوصول ` + - `إلى السجلات عبر نطاق قراءة (Read scope) أو نطاق كتابة (Write scope)، أو اسمح للمجموعة بقراءة الحقل إذا كان هذا الوصول مقصودًا.`, - edit: - `في مجموعة الأذونات "${p.permissionSet}"، لا يكون لجعل الحقل "${p.field}" للقراءة فقط أي أثر: إذن "${b}" ` + - `الذي تملكه المجموعة على "${p.object}" يتيح لجميع حامليها تعديل كل حقول هذا الكائن. أزل "${b}" وامنح ` + - `الوصول إلى السجلات عبر نطاق قراءة (Read scope) أو نطاق كتابة (Write scope)، أو احذف تقييد الحقل إذا كان هذا الوصول مقصودًا.`, - both: - `في مجموعة الأذونات "${p.permissionSet}"، لا يكون لإخفاء الحقل "${p.field}" وجعله للقراءة فقط أي أثر: ` + - `إذن "${b}" الذي تملكه المجموعة على "${p.object}" يتيح لجميع حامليها قراءة كل حقول هذا الكائن وتعديلها. ` + - `أزل "${b}" وامنح الوصول إلى السجلات عبر نطاق قراءة (Read scope) أو نطاق كتابة (Write scope)، أو احذف تقييد الحقل إذا كان هذا الوصول مقصودًا.`, - }); - }, - fr: (p) => { - const b = modifyAllLabel('fr'); - return fieldMaskSentence(p, { - read: - `Dans l’ensemble d’autorisations « ${p.permissionSet} », masquer le champ « ${p.field} » n’a aucun effet : ` + - `l’autorisation « ${b} » de l’ensemble sur « ${p.object} » permet à tous ses détenteurs de lire tous les ` + - `champs de cet objet. Retirez « ${b} » et accordez l’accès aux enregistrements avec une portée de lecture (Read scope) ` + - `ou d’écriture (Write scope), ou autorisez l’ensemble à lire le champ si cet accès est voulu.`, - edit: - `Dans l’ensemble d’autorisations « ${p.permissionSet} », mettre le champ « ${p.field} » en lecture seule ` + - `n’a aucun effet : l’autorisation « ${b} » de l’ensemble sur « ${p.object} » permet à tous ses détenteurs ` + - `de modifier tous les champs de cet objet. Retirez « ${b} » et accordez l’accès aux enregistrements avec ` + - `une portée de lecture (Read scope) ou d’écriture (Write scope), ou supprimez la restriction du champ si cet accès est voulu.`, - both: - `Dans l’ensemble d’autorisations « ${p.permissionSet} », masquer le champ « ${p.field} » et le mettre en ` + - `lecture seule n’a aucun effet : l’autorisation « ${b} » de l’ensemble sur « ${p.object} » permet à tous ` + - `ses détenteurs de lire et de modifier tous les champs de cet objet. Retirez « ${b} » et accordez l’accès ` + - `aux enregistrements avec une portée de lecture (Read scope) ou d’écriture (Write scope), ou supprimez la restriction du champ si cet ` + - `accès est voulu.`, - }); - }, - 'pt-BR': (p) => { - const b = modifyAllLabel('pt-BR'); - return fieldMaskSentence(p, { - read: - `No conjunto de permissões "${p.permissionSet}", ocultar o campo "${p.field}" não tem efeito: a permissão ` + - `"${b}" do conjunto em "${p.object}" permite que todos os seus titulares leiam todos os campos desse ` + - `objeto. Remova "${b}" e conceda o acesso aos registros com um escopo de leitura (Read scope) ou de gravação (Write scope), ou permita ` + - `que o conjunto leia o campo se esse acesso for intencional.`, - edit: - `No conjunto de permissões "${p.permissionSet}", deixar o campo "${p.field}" como somente leitura não tem ` + - `efeito: a permissão "${b}" do conjunto em "${p.object}" permite que todos os seus titulares editem todos os ` + - `campos desse objeto. Remova "${b}" e conceda o acesso aos registros com um escopo de leitura (Read scope) ou ` + - `de gravação (Write scope), ou exclua a restrição do campo se esse acesso for intencional.`, - both: - `No conjunto de permissões "${p.permissionSet}", ocultar o campo "${p.field}" e deixá-lo como somente ` + - `leitura não tem efeito: a permissão "${b}" do conjunto em "${p.object}" permite que todos os seus ` + - `titulares leiam e editem todos os campos desse objeto. Remova "${b}" e conceda o acesso aos registros ` + - `com um escopo de leitura (Read scope) ou de gravação (Write scope), ou exclua a restrição do campo se esse acesso for intencional.`, - }); - }, - ru: (p) => { - const b = modifyAllLabel('ru'); - return fieldMaskSentence(p, { - read: - `В наборе разрешений «${p.permissionSet}» скрытие поля «${p.field}» не действует: право «${b}» этого ` + - `набора для «${p.object}» позволяет всем его владельцам читать все поля этого объекта. Уберите «${b}» и ` + - `предоставьте доступ к записям через область чтения (Read scope) или записи (Write scope) либо разрешите набору читать это поле, ` + - `если такой доступ задуман.`, - edit: - `В наборе разрешений «${p.permissionSet}» режим «только чтение» для поля «${p.field}» не действует: право ` + - `«${b}» этого набора для «${p.object}» позволяет всем его владельцам изменять все поля этого объекта. ` + - `Уберите «${b}» и предоставьте доступ к записям через область чтения (Read scope) или записи (Write scope) либо удалите ограничение ` + - `поля, если такой доступ задуман.`, - both: - `В наборе разрешений «${p.permissionSet}» скрытие поля «${p.field}» и режим «только чтение» для него не ` + - `действуют: право «${b}» этого набора для «${p.object}» позволяет всем его владельцам читать и изменять ` + - `все поля этого объекта. Уберите «${b}» и предоставьте доступ к записям через область чтения (Read scope) или записи (Write scope) ` + - `либо удалите ограничение поля, если такой доступ задуман.`, - }); - }, - de: (p) => { - const b = modifyAllLabel('de'); - return fieldMaskSentence(p, { - read: - `Im Berechtigungssatz „${p.permissionSet}“ ist das Ausblenden des Felds „${p.field}“ wirkungslos: Die ` + - `Berechtigung „${b}“ des Satzes für „${p.object}“ lässt alle Inhaber jedes Feld dieses Objekts lesen. ` + - `Entfernen Sie „${b}“ und gewähren Sie den Zugriff auf Datensätze über einen Lesebereich (Read scope) oder Schreibbereich (Write scope), ` + - `oder erlauben Sie dem Satz, das Feld zu lesen, wenn dieser Zugriff beabsichtigt ist.`, - edit: - `Im Berechtigungssatz „${p.permissionSet}“ ist der Schreibschutz des Felds „${p.field}“ wirkungslos: Die ` + - `Berechtigung „${b}“ des Satzes für „${p.object}“ lässt alle Inhaber jedes Feld dieses Objekts ` + - `bearbeiten. Entfernen Sie „${b}“ und gewähren Sie den Zugriff auf Datensätze über einen Lesebereich (Read scope) oder ` + - `Schreibbereich (Write scope), oder löschen Sie die Feldeinschränkung, wenn dieser Zugriff beabsichtigt ist.`, - both: - `Im Berechtigungssatz „${p.permissionSet}“ sind das Ausblenden des Felds „${p.field}“ und sein ` + - `Schreibschutz wirkungslos: Die Berechtigung „${b}“ des Satzes für „${p.object}“ lässt alle Inhaber jedes ` + - `Feld dieses Objekts lesen und bearbeiten. Entfernen Sie „${b}“ und gewähren Sie den Zugriff auf ` + - `Datensätze über einen Lesebereich (Read scope) oder Schreibbereich (Write scope), oder löschen Sie die Feldeinschränkung, wenn dieser ` + - `Zugriff beabsichtigt ist.`, - }); - }, - ja: (p) => { - const b = modifyAllLabel('ja'); - return fieldMaskSentence(p, { - read: - `権限セット「${p.permissionSet}」では、項目「${p.field}」を非表示にする設定が効いていません。この権限セットは` + - `「${p.object}」に「${b}」を持っており、すべての保持者がこのオブジェクトのすべての項目を読み取れるためです。` + - `「${b}」を外して読み取り範囲(Read scope)または書き込み範囲(Write scope)でレコードへのアクセスを付与するか、このアクセスが意図したもので` + - `あれば、この権限セットにこの項目の読み取りを許可してください。`, - edit: - `権限セット「${p.permissionSet}」では、項目「${p.field}」を読み取り専用にする設定が効いていません。この権限` + - `セットは「${p.object}」に「${b}」を持っており、すべての保持者がこのオブジェクトのすべての項目を編集できる` + - `ためです。「${b}」を外して読み取り範囲(Read scope)または書き込み範囲(Write scope)でレコードへのアクセスを付与するか、このアクセスが` + - `意図したものであれば、この項目の制限を削除してください。`, - both: - `権限セット「${p.permissionSet}」では、項目「${p.field}」を非表示かつ読み取り専用にする設定が効いていません。` + - `この権限セットは「${p.object}」に「${b}」を持っており、すべての保持者がこのオブジェクトのすべての項目を` + - `読み取り・編集できるためです。「${b}」を外して読み取り範囲(Read scope)または書き込み範囲(Write scope)でレコードへのアクセスを付与するか、` + - `このアクセスが意図したものであれば、この項目の制限を削除してください。`, - }); - }, - ko: (p) => { - const b = modifyAllLabel('ko'); - return fieldMaskSentence(p, { - read: - `권한 세트 "${p.permissionSet}"에서 필드 "${p.field}"을(를) 숨기는 설정은 효과가 없습니다. 이 권한 세트는 ` + - `"${p.object}"에 대해 "${b}" 권한을 가지므로 모든 보유자가 이 개체의 모든 필드를 읽을 수 있습니다. ` + - `"${b}"을(를) 제거하고 읽기 범위(Read scope) 또는 쓰기 범위(Write scope)로 레코드 액세스를 부여하거나, 이 액세스가 의도된 것이라면 ` + - `권한 세트가 이 필드를 읽을 수 있도록 하세요.`, - edit: - `권한 세트 "${p.permissionSet}"에서 필드 "${p.field}"을(를) 읽기 전용으로 하는 설정은 효과가 없습니다. ` + - `이 권한 세트는 "${p.object}"에 대해 "${b}" 권한을 가지므로 모든 보유자가 이 개체의 모든 필드를 편집할 수 ` + - `있습니다. "${b}"을(를) 제거하고 읽기 범위(Read scope) 또는 쓰기 범위(Write scope)로 레코드 액세스를 부여하거나, 이 액세스가 의도된 ` + - `것이라면 이 필드 제한을 삭제하세요.`, - both: - `권한 세트 "${p.permissionSet}"에서 필드 "${p.field}"을(를) 숨기고 읽기 전용으로 하는 설정은 효과가 ` + - `없습니다. 이 권한 세트는 "${p.object}"에 대해 "${b}" 권한을 가지므로 모든 보유자가 이 개체의 모든 필드를 ` + - `읽고 편집할 수 있습니다. "${b}"을(를) 제거하고 읽기 범위(Read scope) 또는 쓰기 범위(Write scope)로 레코드 액세스를 부여하거나, 이 ` + - `액세스가 의도된 것이라면 이 필드 제한을 삭제하세요.`, - }); - }, - }, [SECURITY_CBP_MASTER_REFERENCE_HIDDEN]: { en: (p) => `Permission set "${p.permissionSet}" hides field "${p.field}", the link to the master record. That link still ` + @@ -672,122 +457,79 @@ export const SECURITY_POSTURE_USER_TEXT: UserTextCatalog = Object.freeze({ `"${p.object}"에 레코드 소유자(owner_id)를 추가하고 정책 조건으로 지정하거나, 이 정책을 삭제하세요.`, }), }, - // [Field-axis split, ruling of record 6912661484, step 2] Each sentence - // names the two sets, the field and the bit (by its console label), says - // what a holder of both can still do with the field, and gives the two - // fixes the rule's hint leads with: remove the bit, or protect the field on - // the field itself (Required permissions, ADR-0066 D3). + // [Field-axis split, ruling of record 6912661484, steps 2 and 3] Each + // sentence names the two sets, the field and the bit (by its console + // label), says that a holder of both can still read the field, and gives + // the two fixes the rule's hint leads with: remove the bit, or protect the + // field on the field itself (Required permissions, ADR-0066 D3). The bit + // votes no edit, so a read-only field is never re-opened. [SECURITY_CROSS_SET_FIELD_REOPEN]: { - en: (p) => - crossSetReopenSentence(p, 'en', (b) => { - const opens = `"${p.otherSet}" has ${b} on "${p.object}", which opens every field of that object.`; - const hidden = `Remove ${b} from "${p.otherSet}", or, if the field must stay hidden from everyone without a specific permission, set required permissions on the field itself.`; - return { - read: `Field "${p.field}" is hidden in permission set "${p.permissionSet}", but anyone who also holds permission set "${p.otherSet}" can still read it: ${opens} ${hidden}`, - edit: `Field "${p.field}" is read-only in permission set "${p.permissionSet}", but anyone who also holds permission set "${p.otherSet}" can still edit it: ${opens} Remove ${b} from "${p.otherSet}", or, if no one should edit the field without a specific permission, set required permissions on the field itself.`, - both: `Field "${p.field}" is hidden and read-only in permission set "${p.permissionSet}", but anyone who also holds permission set "${p.otherSet}" can still read and edit it: ${opens} ${hidden}`, - }; - }), - 'zh-Hans': (p) => - crossSetReopenSentence(p, 'zh-Hans', (b) => { - const opens = `“${p.otherSet}”对“${p.object}”拥有“${b}”,会开放该对象的每个字段。`; - const hidden = `请从“${p.otherSet}”移除“${b}”;如果该字段必须对所有没有特定权限的人隐藏,请直接在字段上设置所需权限。`; - return { - read: `字段“${p.field}”在权限集“${p.permissionSet}”中被隐藏,但同时持有权限集“${p.otherSet}”的人仍能读取它:${opens}${hidden}`, - edit: `字段“${p.field}”在权限集“${p.permissionSet}”中是只读的,但同时持有权限集“${p.otherSet}”的人仍能编辑它:${opens}请从“${p.otherSet}”移除“${b}”;如果没有特定权限的人都不应编辑该字段,请直接在字段上设置所需权限。`, - both: `字段“${p.field}”在权限集“${p.permissionSet}”中被隐藏且为只读,但同时持有权限集“${p.otherSet}”的人仍能读取和编辑它:${opens}${hidden}`, - }; - }), - 'zh-Hant': (p) => - crossSetReopenSentence(p, 'zh-Hant', (b) => { - const opens = `「${p.otherSet}」對「${p.object}」擁有「${b}」,會開放該物件的每個欄位。`; - const hidden = `請從「${p.otherSet}」移除「${b}」;如果該欄位必須對所有沒有特定權限的人隱藏,請直接在欄位上設定所需權限。`; - return { - read: `欄位「${p.field}」在權限集「${p.permissionSet}」中被隱藏,但同時持有權限集「${p.otherSet}」的人仍能讀取它:${opens}${hidden}`, - edit: `欄位「${p.field}」在權限集「${p.permissionSet}」中是只讀的,但同時持有權限集「${p.otherSet}」的人仍能編輯它:${opens}請從「${p.otherSet}」移除「${b}」;如果沒有特定權限的人都不應編輯該欄位,請直接在欄位上設定所需權限。`, - both: `欄位「${p.field}」在權限集「${p.permissionSet}」中被隱藏且為只讀,但同時持有權限集「${p.otherSet}」的人仍能讀取和編輯它:${opens}${hidden}`, - }; - }), - es: (p) => - crossSetReopenSentence(p, 'es', (b) => { - const opens = `"${p.otherSet}" tiene "${b}" sobre "${p.object}", que abre todos los campos de ese objeto.`; - const hidden = `Quite "${b}" de "${p.otherSet}" o, si el campo debe permanecer oculto para todos los que no tengan un permiso específico, defina los permisos requeridos en el propio campo.`; - return { - read: `El campo "${p.field}" está oculto en el conjunto de permisos "${p.permissionSet}", pero quien también tenga el conjunto de permisos "${p.otherSet}" aún puede leerlo: ${opens} ${hidden}`, - edit: `El campo "${p.field}" es de solo lectura en el conjunto de permisos "${p.permissionSet}", pero quien también tenga el conjunto de permisos "${p.otherSet}" aún puede editarlo: ${opens} Quite "${b}" de "${p.otherSet}" o, si nadie debe editar el campo sin un permiso específico, defina los permisos requeridos en el propio campo.`, - both: `El campo "${p.field}" está oculto y es de solo lectura en el conjunto de permisos "${p.permissionSet}", pero quien también tenga el conjunto de permisos "${p.otherSet}" aún puede leerlo y editarlo: ${opens} ${hidden}`, - }; - }), - ar: (p) => - crossSetReopenSentence(p, 'ar', (b) => { - const opens = `لدى "${p.otherSet}" الإذن "${b}" على "${p.object}"، وهو يفتح كل حقول هذا الكائن.`; - const hidden = `أزل "${b}" من "${p.otherSet}"، أو إذا كان يجب أن يبقى الحقل مخفيًا عن كل من لا يملك إذنًا محددًا، فحدّد الأذونات المطلوبة على الحقل نفسه.`; - return { - read: `الحقل "${p.field}" مخفي في مجموعة الأذونات "${p.permissionSet}"، لكن من يحمل أيضًا مجموعة الأذونات "${p.otherSet}" لا يزال يستطيع قراءته: ${opens} ${hidden}`, - edit: `الحقل "${p.field}" للقراءة فقط في مجموعة الأذونات "${p.permissionSet}"، لكن من يحمل أيضًا مجموعة الأذونات "${p.otherSet}" لا يزال يستطيع تعديله: ${opens} أزل "${b}" من "${p.otherSet}"، أو إذا كان لا ينبغي لأحد تعديل الحقل دون إذن محدد، فحدّد الأذونات المطلوبة على الحقل نفسه.`, - both: `الحقل "${p.field}" مخفي وللقراءة فقط في مجموعة الأذونات "${p.permissionSet}"، لكن من يحمل أيضًا مجموعة الأذونات "${p.otherSet}" لا يزال يستطيع قراءته وتعديله: ${opens} ${hidden}`, - }; - }), - fr: (p) => - crossSetReopenSentence(p, 'fr', (b) => { - const opens = `« ${p.otherSet} » dispose de « ${b} » sur « ${p.object} », ce qui ouvre tous les champs de cet objet.`; - const hidden = `Retirez « ${b} » de « ${p.otherSet} » ou, si le champ doit rester masqué pour toute personne sans autorisation spécifique, définissez les autorisations requises sur le champ lui-même.`; - return { - read: `Le champ « ${p.field} » est masqué dans l’ensemble d’autorisations « ${p.permissionSet} », mais quiconque détient aussi l’ensemble d’autorisations « ${p.otherSet} » peut encore le lire : ${opens} ${hidden}`, - edit: `Le champ « ${p.field} » est en lecture seule dans l’ensemble d’autorisations « ${p.permissionSet} », mais quiconque détient aussi l’ensemble d’autorisations « ${p.otherSet} » peut encore le modifier : ${opens} Retirez « ${b} » de « ${p.otherSet} » ou, si personne ne doit modifier le champ sans autorisation spécifique, définissez les autorisations requises sur le champ lui-même.`, - both: `Le champ « ${p.field} » est masqué et en lecture seule dans l’ensemble d’autorisations « ${p.permissionSet} », mais quiconque détient aussi l’ensemble d’autorisations « ${p.otherSet} » peut encore le lire et le modifier : ${opens} ${hidden}`, - }; - }), - 'pt-BR': (p) => - crossSetReopenSentence(p, 'pt-BR', (b) => { - const opens = `"${p.otherSet}" tem "${b}" em "${p.object}", o que abre todos os campos desse objeto.`; - const hidden = `Remova "${b}" de "${p.otherSet}" ou, se o campo precisa ficar oculto para todos que não têm uma permissão específica, defina as permissões exigidas no próprio campo.`; - return { - read: `O campo "${p.field}" está oculto no conjunto de permissões "${p.permissionSet}", mas quem também tem o conjunto de permissões "${p.otherSet}" ainda pode lê-lo: ${opens} ${hidden}`, - edit: `O campo "${p.field}" é somente leitura no conjunto de permissões "${p.permissionSet}", mas quem também tem o conjunto de permissões "${p.otherSet}" ainda pode editá-lo: ${opens} Remova "${b}" de "${p.otherSet}" ou, se ninguém deve editar o campo sem uma permissão específica, defina as permissões exigidas no próprio campo.`, - both: `O campo "${p.field}" está oculto e é somente leitura no conjunto de permissões "${p.permissionSet}", mas quem também tem o conjunto de permissões "${p.otherSet}" ainda pode lê-lo e editá-lo: ${opens} ${hidden}`, - }; - }), - ru: (p) => - crossSetReopenSentence(p, 'ru', (b) => { - const opens = `у «${p.otherSet}» есть «${b}» для «${p.object}», что открывает все поля этого объекта.`; - const hidden = `Уберите «${b}» из «${p.otherSet}» или, если поле должно оставаться скрытым от всех, у кого нет определённого разрешения, задайте требуемые разрешения в самом поле.`; - return { - read: `Поле «${p.field}» скрыто в наборе разрешений «${p.permissionSet}», но тот, у кого есть ещё и набор разрешений «${p.otherSet}», по-прежнему может его читать: ${opens} ${hidden}`, - edit: `Поле «${p.field}» доступно только для чтения в наборе разрешений «${p.permissionSet}», но тот, у кого есть ещё и набор разрешений «${p.otherSet}», по-прежнему может его изменять: ${opens} Уберите «${b}» из «${p.otherSet}» или, если никто не должен изменять поле без определённого разрешения, задайте требуемые разрешения в самом поле.`, - both: `Поле «${p.field}» скрыто и доступно только для чтения в наборе разрешений «${p.permissionSet}», но тот, у кого есть ещё и набор разрешений «${p.otherSet}», по-прежнему может его читать и изменять: ${opens} ${hidden}`, - }; - }), - de: (p) => - crossSetReopenSentence(p, 'de', (b) => { - const opens = `„${p.otherSet}“ hat „${b}“ auf „${p.object}“, was jedes Feld dieses Objekts öffnet.`; - const hidden = `Entfernen Sie „${b}“ aus „${p.otherSet}“, oder legen Sie, wenn das Feld für alle ohne eine bestimmte Berechtigung verborgen bleiben muss, die erforderlichen Berechtigungen am Feld selbst fest.`; - return { - read: `Das Feld „${p.field}“ ist im Berechtigungssatz „${p.permissionSet}“ ausgeblendet, aber wer zusätzlich den Berechtigungssatz „${p.otherSet}“ hat, kann es weiterhin lesen: ${opens} ${hidden}`, - edit: `Das Feld „${p.field}“ ist im Berechtigungssatz „${p.permissionSet}“ schreibgeschützt, aber wer zusätzlich den Berechtigungssatz „${p.otherSet}“ hat, kann es weiterhin bearbeiten: ${opens} Entfernen Sie „${b}“ aus „${p.otherSet}“, oder legen Sie, wenn niemand das Feld ohne eine bestimmte Berechtigung bearbeiten darf, die erforderlichen Berechtigungen am Feld selbst fest.`, - both: `Das Feld „${p.field}“ ist im Berechtigungssatz „${p.permissionSet}“ ausgeblendet und schreibgeschützt, aber wer zusätzlich den Berechtigungssatz „${p.otherSet}“ hat, kann es weiterhin lesen und bearbeiten: ${opens} ${hidden}`, - }; - }), - ja: (p) => - crossSetReopenSentence(p, 'ja', (b) => { - const opens = `「${p.otherSet}」は「${p.object}」に対して「${b}」を持ち、このオブジェクトのすべてのフィールドを開くためです。`; - const hidden = `「${p.otherSet}」から「${b}」を外すか、特定の権限を持たない全員からこのフィールドを隠す必要がある場合は、フィールド自体に必要な権限を設定してください。`; - return { - read: `フィールド「${p.field}」は権限セット「${p.permissionSet}」で非表示になっていますが、権限セット「${p.otherSet}」も持つユーザーは引き続き読み取れます。${opens}${hidden}`, - edit: `フィールド「${p.field}」は権限セット「${p.permissionSet}」で読み取り専用ですが、権限セット「${p.otherSet}」も持つユーザーは引き続き編集できます。${opens}「${p.otherSet}」から「${b}」を外すか、特定の権限なしに誰もこのフィールドを編集すべきでない場合は、フィールド自体に必要な権限を設定してください。`, - both: `フィールド「${p.field}」は権限セット「${p.permissionSet}」で非表示かつ読み取り専用ですが、権限セット「${p.otherSet}」も持つユーザーは引き続き読み取りと編集ができます。${opens}${hidden}`, - }; - }), - ko: (p) => - crossSetReopenSentence(p, 'ko', (b) => { - const opens = `"${p.otherSet}"이(가) "${p.object}"에 대해 "${b}"을(를) 가지고 있어 이 개체의 모든 필드를 열기 때문입니다.`; - const hidden = `"${p.otherSet}"에서 "${b}"을(를) 제거하거나, 특정 권한이 없는 모든 사람에게 이 필드를 계속 숨겨야 한다면 필드 자체에 필요한 권한을 설정하세요.`; - return { - read: `필드 "${p.field}"은(는) 권한 세트 "${p.permissionSet}"에서 숨겨져 있지만, 권한 세트 "${p.otherSet}"도 보유한 사람은 여전히 이 필드를 읽을 수 있습니다. ${opens} ${hidden}`, - edit: `필드 "${p.field}"은(는) 권한 세트 "${p.permissionSet}"에서 읽기 전용이지만, 권한 세트 "${p.otherSet}"도 보유한 사람은 여전히 이 필드를 편집할 수 있습니다. ${opens} "${p.otherSet}"에서 "${b}"을(를) 제거하거나, 특정 권한 없이는 아무도 이 필드를 편집하면 안 된다면 필드 자체에 필요한 권한을 설정하세요.`, - both: `필드 "${p.field}"은(는) 권한 세트 "${p.permissionSet}"에서 숨겨져 있고 읽기 전용이지만, 권한 세트 "${p.otherSet}"도 보유한 사람은 여전히 이 필드를 읽고 편집할 수 있습니다. ${opens} ${hidden}`, - }; - }), + en: (p) => { + const b = VIEW_ALL_FIELDS_LABEL['en']; + const opens = `"${p.otherSet}" has ${b} on "${p.object}", which opens every field of that object.`; + const hidden = `Remove ${b} from "${p.otherSet}", or, if the field must stay hidden from everyone without a specific permission, set required permissions on the field itself.`; + return `Field "${p.field}" is hidden in permission set "${p.permissionSet}", but anyone who also holds permission set "${p.otherSet}" can still read it: ${opens} ${hidden}`; + }, + 'zh-Hans': (p) => { + const b = VIEW_ALL_FIELDS_LABEL['zh-Hans']; + const opens = `“${p.otherSet}”对“${p.object}”拥有“${b}”,会开放该对象的每个字段。`; + const hidden = `请从“${p.otherSet}”移除“${b}”;如果该字段必须对所有没有特定权限的人隐藏,请直接在字段上设置所需权限。`; + return `字段“${p.field}”在权限集“${p.permissionSet}”中被隐藏,但同时持有权限集“${p.otherSet}”的人仍能读取它:${opens}${hidden}`; + }, + 'zh-Hant': (p) => { + const b = VIEW_ALL_FIELDS_LABEL['zh-Hant']; + const opens = `「${p.otherSet}」對「${p.object}」擁有「${b}」,會開放該物件的每個欄位。`; + const hidden = `請從「${p.otherSet}」移除「${b}」;如果該欄位必須對所有沒有特定權限的人隱藏,請直接在欄位上設定所需權限。`; + return `欄位「${p.field}」在權限集「${p.permissionSet}」中被隱藏,但同時持有權限集「${p.otherSet}」的人仍能讀取它:${opens}${hidden}`; + }, + es: (p) => { + const b = VIEW_ALL_FIELDS_LABEL['es']; + const opens = `"${p.otherSet}" tiene "${b}" sobre "${p.object}", que abre todos los campos de ese objeto.`; + const hidden = `Quite "${b}" de "${p.otherSet}" o, si el campo debe permanecer oculto para todos los que no tengan un permiso específico, defina los permisos requeridos en el propio campo.`; + return `El campo "${p.field}" está oculto en el conjunto de permisos "${p.permissionSet}", pero quien también tenga el conjunto de permisos "${p.otherSet}" aún puede leerlo: ${opens} ${hidden}`; + }, + ar: (p) => { + const b = VIEW_ALL_FIELDS_LABEL['ar']; + const opens = `لدى "${p.otherSet}" الإذن "${b}" على "${p.object}"، وهو يفتح كل حقول هذا الكائن.`; + const hidden = `أزل "${b}" من "${p.otherSet}"، أو إذا كان يجب أن يبقى الحقل مخفيًا عن كل من لا يملك إذنًا محددًا، فحدّد الأذونات المطلوبة على الحقل نفسه.`; + return `الحقل "${p.field}" مخفي في مجموعة الأذونات "${p.permissionSet}"، لكن من يحمل أيضًا مجموعة الأذونات "${p.otherSet}" لا يزال يستطيع قراءته: ${opens} ${hidden}`; + }, + fr: (p) => { + const b = VIEW_ALL_FIELDS_LABEL['fr']; + const opens = `« ${p.otherSet} » dispose de « ${b} » sur « ${p.object} », ce qui ouvre tous les champs de cet objet.`; + const hidden = `Retirez « ${b} » de « ${p.otherSet} » ou, si le champ doit rester masqué pour toute personne sans autorisation spécifique, définissez les autorisations requises sur le champ lui-même.`; + return `Le champ « ${p.field} » est masqué dans l’ensemble d’autorisations « ${p.permissionSet} », mais quiconque détient aussi l’ensemble d’autorisations « ${p.otherSet} » peut encore le lire : ${opens} ${hidden}`; + }, + 'pt-BR': (p) => { + const b = VIEW_ALL_FIELDS_LABEL['pt-BR']; + const opens = `"${p.otherSet}" tem "${b}" em "${p.object}", o que abre todos os campos desse objeto.`; + const hidden = `Remova "${b}" de "${p.otherSet}" ou, se o campo precisa ficar oculto para todos que não têm uma permissão específica, defina as permissões exigidas no próprio campo.`; + return `O campo "${p.field}" está oculto no conjunto de permissões "${p.permissionSet}", mas quem também tem o conjunto de permissões "${p.otherSet}" ainda pode lê-lo: ${opens} ${hidden}`; + }, + ru: (p) => { + const b = VIEW_ALL_FIELDS_LABEL['ru']; + const opens = `у «${p.otherSet}» есть «${b}» для «${p.object}», что открывает все поля этого объекта.`; + const hidden = `Уберите «${b}» из «${p.otherSet}» или, если поле должно оставаться скрытым от всех, у кого нет определённого разрешения, задайте требуемые разрешения в самом поле.`; + return `Поле «${p.field}» скрыто в наборе разрешений «${p.permissionSet}», но тот, у кого есть ещё и набор разрешений «${p.otherSet}», по-прежнему может его читать: ${opens} ${hidden}`; + }, + de: (p) => { + const b = VIEW_ALL_FIELDS_LABEL['de']; + const opens = `„${p.otherSet}“ hat „${b}“ auf „${p.object}“, was jedes Feld dieses Objekts öffnet.`; + const hidden = `Entfernen Sie „${b}“ aus „${p.otherSet}“, oder legen Sie, wenn das Feld für alle ohne eine bestimmte Berechtigung verborgen bleiben muss, die erforderlichen Berechtigungen am Feld selbst fest.`; + return `Das Feld „${p.field}“ ist im Berechtigungssatz „${p.permissionSet}“ ausgeblendet, aber wer zusätzlich den Berechtigungssatz „${p.otherSet}“ hat, kann es weiterhin lesen: ${opens} ${hidden}`; + }, + ja: (p) => { + const b = VIEW_ALL_FIELDS_LABEL['ja']; + const opens = `「${p.otherSet}」は「${p.object}」に対して「${b}」を持ち、このオブジェクトのすべてのフィールドを開くためです。`; + const hidden = `「${p.otherSet}」から「${b}」を外すか、特定の権限を持たない全員からこのフィールドを隠す必要がある場合は、フィールド自体に必要な権限を設定してください。`; + return `フィールド「${p.field}」は権限セット「${p.permissionSet}」で非表示になっていますが、権限セット「${p.otherSet}」も持つユーザーは引き続き読み取れます。${opens}${hidden}`; + }, + ko: (p) => { + const b = VIEW_ALL_FIELDS_LABEL['ko']; + const opens = `"${p.otherSet}"이(가) "${p.object}"에 대해 "${b}"을(를) 가지고 있어 이 개체의 모든 필드를 열기 때문입니다.`; + const hidden = `"${p.otherSet}"에서 "${b}"을(를) 제거하거나, 특정 권한이 없는 모든 사람에게 이 필드를 계속 숨겨야 한다면 필드 자체에 필요한 권한을 설정하세요.`; + return `필드 "${p.field}"은(는) 권한 세트 "${p.permissionSet}"에서 숨겨져 있지만, 권한 세트 "${p.otherSet}"도 보유한 사람은 여전히 이 필드를 읽을 수 있습니다. ${opens} ${hidden}`; + }, }, }); @@ -803,76 +545,3 @@ type OwnerPolicyRemedy = 'allow-owner-edit' | 'key-owner-id' | 'add-owner-id'; function ownerPolicyRemedy(p: UserTextParams, sentences: Readonly>): string { return Object.prototype.hasOwnProperty.call(sentences, p.remedy) ? sentences[p.remedy as OwnerPolicyRemedy] : ''; } - -/** - * The sentence of `security-superuser-field-mask-inert`, by the `inert` param - * its push site sets: the half of the field restriction the set's Modify All - * unbinds. A row that hides the field and leaves it editable has an inert - * read mask only (`read`), so that sentence never prescribes deleting the - * restriction; a readable row has an inert edit lock (`edit`); a row that - * hides and locks has both (`both`). An `inert` the push site did not set - * reads as `both`, which is what Modify All unbinds. - */ -type FieldMaskInert = 'read' | 'edit' | 'both'; - -function fieldMaskSentence(p: UserTextParams, sentences: Readonly>): string { - if (p.inert === 'read' || p.inert === 'edit' || p.inert === 'both') return sentences[p.inert]; - return sentences.both; -} - -/** - * The console's own label for each object-wide bit that - * `security-cross-set-field-reopen` reports, per locale; Modify All reuses - * {@link MODIFY_ALL_LABEL}. Translated where the console translates its own - * labels, kept as the console's English label elsewhere, as Modify All is. - */ -const VIEW_ALL_LABEL: Readonly> = { - en: 'View All Records', - 'zh-Hans': '查看所有记录', - 'zh-Hant': '查看所有記錄', - es: 'View All Records', - ar: 'View All Records', - fr: 'View All Records', - 'pt-BR': 'View All Records', - ru: 'View All Records', - de: 'View All Records', - ja: 'View All Records', - ko: 'View All Records', -}; - -const VIEW_ALL_FIELDS_LABEL: Readonly> = { - en: 'View All Fields', - 'zh-Hans': '查看所有字段', - 'zh-Hant': '查看所有欄位', - es: 'View All Fields', - ar: 'View All Fields', - fr: 'View All Fields', - 'pt-BR': 'View All Fields', - ru: 'View All Fields', - de: 'View All Fields', - ja: 'View All Fields', - ko: 'View All Fields', -}; - -/** - * The sentence of `security-cross-set-field-reopen`, by the two params its - * push site sets: `bit` picks the label of the second set's bit, `reopened` - * the half of the first set's restriction it re-opens (View All and View All - * Fields re-open only a hidden field; Modify All also an edit lock). A - * `reopened` the push site did not set reads as `read`, the half every one of - * the three bits re-opens; a `bit` it did not set reads as View All Records. - */ -function crossSetReopenSentence( - p: UserTextParams, - locale: keyof typeof MODIFY_ALL_LABEL, - sentences: (bitLabel: string) => Readonly>, -): string { - const label = - p.bit === 'modify-all' - ? modifyAllLabel(locale) - : p.bit === 'view-all-fields' - ? VIEW_ALL_FIELDS_LABEL[locale] - : VIEW_ALL_LABEL[locale]; - const byHalf = sentences(label); - return p.reopened === 'edit' || p.reopened === 'both' ? byHalf[p.reopened] : byHalf.read; -} diff --git a/packages/plugins/plugin-security/src/explain-engine.ts b/packages/plugins/plugin-security/src/explain-engine.ts index d5d51356624..d34a8c046f7 100644 --- a/packages/plugins/plugin-security/src/explain-engine.ts +++ b/packages/plugins/plugin-security/src/explain-engine.ts @@ -3362,36 +3362,22 @@ async function explainObjectPass(deps: ExplainEngineDeps, input: ExplainInput, a // judged per ROW by the write gate (the incoming row of an insert, the // stored row before an update); this report holds no row, so each such entry // is reported AS a row-conditioned lock — which is also how every row-blind - // reader applies it — rather than folded silently into the mask above. - // - // [#29610 / ruling of record 6573563853, letter A] …unless the principal's - // Modify All vote supersedes it: `getFieldPermissions` applies that vote after - // the per-entry votes under every `when` verdict, so such an entry's lock - // binds on no row. The evaluator names the superseding sets from the SAME - // vote (`ConditionedFieldEntry.supersededBy`); this layer only words it, in - // the "Superseded by …" form the sharing attribution already uses. Each - // principal's entries are judged against its own sets: under D10 the masks - // intersect, so a delegator's lock still binds when only the agent holds the - // vote. + // reader applies it — rather than folded silently into the mask above. No + // object-wide bit supersedes such a lock: Modify All casts no field vote and + // `viewAllFields` votes no edit (the field-axis split, ruling of record + // 6912661484). Each principal's entries are listed from its own sets: under + // D10 the masks intersect, so a delegator's lock binds the agent too. const conditioned = [ ...deps.evaluator.conditionedFieldEntries(object, sets), ...(delegatorSets ? deps.evaluator.conditionedFieldEntries(object, delegatorSets) : []), ]; const describeConditioned = (e: (typeof conditioned)[number]): string => `${e.field} (${e.editable ? 'editable' : 'locked'} when ${e.when}, set "${e.set}")`; - const binding = conditioned.filter((e) => e.supersededBy.length === 0); - const superseded = conditioned.filter((e) => e.supersededBy.length > 0); - const supersedingSets = [...new Set(superseded.flatMap((e) => e.supersededBy))]; const conditionedSentence = - (binding.length > 0 - ? ` ${binding.length} field permission(s) carry a row condition — judged per row by the write gate, ` + - `applied as the lock everywhere else: ${listFields(binding.map(describeConditioned), (f) => f)}.` - : '') + - (superseded.length > 0 - ? ` ${superseded.length} row-conditioned field permission(s) are superseded by the Modify All Data field vote ` + - `[${supersedingSets.join(', ')}], which votes every field editable on every row, so the lock binds on no row: ` + - `${listFields(superseded.map(describeConditioned), (f) => f)}.` - : ''); + conditioned.length > 0 + ? ` ${conditioned.length} field permission(s) carry a row condition — judged per row by the write gate, ` + + `applied as the lock everywhere else: ${listFields(conditioned.map(describeConditioned), (f) => f)}.` + : ''; layers.push({ layer: 'fls', verdict: maskNarrows ? 'narrows' : 'not_applicable', diff --git a/packages/plugins/plugin-security/src/objects/default-permission-sets.ts b/packages/plugins/plugin-security/src/objects/default-permission-sets.ts index 37589f271e8..56785c53ffb 100644 --- a/packages/plugins/plugin-security/src/objects/default-permission-sets.ts +++ b/packages/plugins/plugin-security/src/objects/default-permission-sets.ts @@ -400,13 +400,13 @@ const baseDefaultPermissionSets: PermissionSet[] = [ viewAllRecords: true, modifyAllRecords: true, // [Field-axis split, ruling of record 6912661484, letter A] The - // read-only "every field" vote, said explicitly. Today it duplicates - // the vote `viewAllRecords`/`modifyAllRecords` already cast on every - // field (`superuserFieldVote`, `@objectstack/core`), so nothing - // answers differently; it is what keeps an organization administrator - // reading every field once those two bits stop voting on fields. The - // explicit entries below carry no super-user bit and so no field vote - // either: an explicit entry is the set's whole answer for its object. + // read-only "every field" vote (`viewAllFieldsReadVote`, + // `@objectstack/core`). `viewAllRecords`/`modifyAllRecords` cast no + // field vote, so this bit is what keeps an organization administrator + // reading every field another set hides. It votes no edit: a field + // another set locks stays locked for a holder of both sets. The + // explicit entries below carry no `viewAllFields` and so no field vote: + // an explicit entry is the set's whole answer for its object. // `deriveWallLessOrgAdmin` drops it with the two bypass bits. viewAllFields: true, // [#3544] The super-user bits do not imply export. @@ -1801,11 +1801,11 @@ function deriveWallLessOrgAdmin(base: PermissionSet): PermissionSet { // deployment-wide data superuser is genuinely intended. // // [Field-axis split, ruling of record 6912661484] `viewAllFields` leaves - // with the two bypass bits. The variant never held the field vote those - // bits cast, so keeping the parent's `viewAllFields` would hand its holders - // every field another set hides, a behaviour change the additive step must - // not make. It is a field vote, not a record bypass: dropping it is about - // keeping today's answer, not about the tenant wall. + // with the two bypass bits. The variant never read the fields another set + // hides, so keeping the parent's `viewAllFields` would hand its holders + // every such field, a widening nobody ruled. It is a field vote, not a + // record bypass: dropping it is about keeping the variant's answer, not + // about the tenant wall. const objects: Record = { ...(base.objects ?? {}) }; const { viewAllRecords: _v, modifyAllRecords: _m, viewAllFields: _f, ...wildcardWithoutBypass } = (objects['*'] ?? {}) as Record; diff --git a/packages/plugins/plugin-security/src/permission-evaluator.ts b/packages/plugins/plugin-security/src/permission-evaluator.ts index 9e4af043ad3..4721dfafc76 100644 --- a/packages/plugins/plugin-security/src/permission-evaluator.ts +++ b/packages/plugins/plugin-security/src/permission-evaluator.ts @@ -12,7 +12,7 @@ import { RECYCLE_BIN_GRANT_KEYS } from '@objectstack/spec/data'; import { fieldPermissionVote, holdsSuperuserBypass, - superuserFieldVote, + viewAllFieldsReadVote, type FieldConditionVerdict, } from '@objectstack/core'; @@ -36,18 +36,6 @@ export interface ConditionedFieldEntry { when: string; /** The entry's edit vote on a matching row. */ editable: boolean; - /** - * [#29610 / ruling of record 6573563853, letter A] The sets whose Modify All - * vote supersedes the entry — empty when none does. Read from - * `superuserFieldVote` (`@objectstack/core`), the vote - * {@link PermissionEvaluator.getFieldPermissions} applies after the - * per-entry votes under every `when` verdict: when it votes `editable`, every - * field of the object is readable and editable on every row, so the entry's - * lock binds on no row for this principal. A View All vote supersedes - * nothing here: it votes only the read bit, which a conditioned entry already - * casts (the spec refuses `readable: false` beside a `when`). - */ - supersededBy: string[]; } /** @@ -464,11 +452,11 @@ export class PermissionEvaluator { * are the same list, so a report that names a granting set cannot coexist * with a gate that found none. * - * [ADR-0066 ⑧, ruling of record 6573563853] Each set is read by - * `holdsSuperuserBypass` (`@objectstack/core`), the same function the field - * merge's super-user vote reads ({@link getFieldPermissions}, and the - * row-blind `/auth/me/permissions` merge), so the row bypass and the field - * vote name the same sets. `opts.isPrivate` is accepted and never changes + * [ADR-0066 ⑧] Each set is read by `holdsSuperuserBypass` + * (`@objectstack/core`), the one reading of the row bypass. It reaches no + * field: since the field-axis split (ruling of record 6912661484) the field + * merges' one "all fields" vote is `viewAllFields` + * ({@link getFieldPermissions}). `opts.isPrivate` is accepted and never changes * the answer: the private posture withholds only a `'*'` wildcard that * carries neither bit (see {@link resolveObjectPermission}). */ @@ -531,28 +519,17 @@ export class PermissionEvaluator { * set had not declared the field: the merge below is unchanged for every * entry without a `when`, and only DECLARING entries vote, as before. * - * [ADR-0066 D2 ⑧ as amended — ruling of record 6573563853, letter A] A set - * that holds the super-user bypass on the object (the sets - * {@link superuserBypassSets} names) then votes on EVERY field of it: - * `viewAllRecords` votes `readable: true`, `modifyAllRecords` votes - * `readable: true` and `editable: true` (`superuserFieldVote`, - * `@objectstack/core`). Before, a set that granted the object through its - * super-user bits but named no field cast no vote, so an app set's - * `readable: false` hid the field from a platform admin who also held it. - * Union without deny is otherwise unchanged. - * - * [ADR-0066 D2 ⑧ note of 2026-11-15] The vote is asked per field: a set - * holding View All without Modify All casts no read vote on a field its OWN - * row declares `readable: false`, so that row binds the set's holders. - * Another set's View All or Modify All still reads the field, and a Modify - * All set votes on every field as before, its own rows included. - * - * [Field-axis split, ruling of record 6912661484, letter A] A set carrying - * `viewAllFields` on the object casts the same read vote, under the same - * own-row rule, and never an edit vote (ruled read-only). The vote is the - * shared `superuserFieldVote` above, so this merge and the row-blind one - * cannot disagree about it. It is a field vote only: - * {@link superuserBypassSets} does not read it. + * [Field-axis split, ruling of record 6912661484, letter A, step 3] A set + * carrying `viewAllFields` on the object then casts a read vote on EVERY + * field of it the merge names, except a field its OWN row declares + * `readable: false` (inside one set, specific beats general), and never an + * edit vote (ruled read-only). The vote is the shared `viewAllFieldsReadVote` + * (`@objectstack/core`), so this merge and the row-blind one cannot disagree + * about it. It is a field vote only: {@link superuserBypassSets} does not + * read it. View All and Modify All cast NO field vote: they widen which + * records the caller reaches and nothing else, so one set's View All or + * Modify All no longer re-opens a field another set hides (until protocol + * 19 they voted on every field, ruling of record 6573563853). */ getFieldPermissions( objectName: string, @@ -583,14 +560,10 @@ export class PermissionEvaluator { } } - // [Ruling of record 6573563853; ADR-0066 D2 ⑧ note of 2026-11-15] The - // super-user vote, per field — the same function the row-blind - // `/auth/me/permissions` merge applies. + // [Ruling of record 6912661484] The `viewAllFields` read vote, per field — + // the same function the row-blind `/auth/me/permissions` merge applies. for (const [fieldName, perm] of Object.entries(result)) { - const superVote = superuserFieldVote(permissionSets, objectName, fieldName); - if (!superVote) continue; - perm.readable = true; - if (superVote.editable) perm.editable = true; + if (viewAllFieldsReadVote(permissionSets, objectName, fieldName)) perm.readable = true; } return result; @@ -600,20 +573,17 @@ export class PermissionEvaluator { * [#25866] The row-conditioned entries the sets declare on `objectName`, * for a reader that holds no row (`os explain`): each is reported AS a * row-conditioned lock — judged per row by the write gate, applied as its - * lock everywhere else — rather than folded silently into the mask. Each - * entry names the sets whose Modify All vote supersedes it (`supersededBy`, - * #29610), so the report never calls a lock binding that the merge overrides. + * lock everywhere else — rather than folded silently into the mask. No + * object-wide bit supersedes such a lock: `viewAllFields` votes the read bit + * only, which a conditioned entry already casts (the spec refuses + * `readable: false` beside a `when`), and View All / Modify All cast no field + * vote (ruling of record 6912661484). */ conditionedFieldEntries( objectName: string, permissionSets: PermissionSet[], ): ConditionedFieldEntry[] { const out: ConditionedFieldEntry[] = []; - // [#29610] The same super-user vote `getFieldPermissions` applies — never a - // second reading of the bits. An `editable` vote overrides every entry. - const supersededBy = superuserFieldVote(permissionSets, objectName)?.editable - ? this.superuserBypassSets(objectName, permissionSets, { bit: 'modify' }) - : []; for (const ps of permissionSets) { if (!ps.fields) continue; for (const [key, perm] of Object.entries(ps.fields)) { @@ -625,7 +595,6 @@ export class PermissionEvaluator { set: ps.name, when, editable: perm.editable === true, - supersededBy: [...supersededBy], }); } } diff --git a/packages/qa/scenarios/src/score/scenario-tags.ts b/packages/qa/scenarios/src/score/scenario-tags.ts index da44acc7e2d..b9b862b4938 100644 --- a/packages/qa/scenarios/src/score/scenario-tags.ts +++ b/packages/qa/scenarios/src/score/scenario-tags.ts @@ -57,7 +57,7 @@ * Deterministic: no model call, no network (the cost ruling on cloud#3600). */ -import { buildEffectiveObjectPermissions, holdsSuperuserBypass, resolveStackCollection, superuserFieldVote } from '@objectstack/core'; +import { buildEffectiveObjectPermissions, holdsSuperuserBypass, resolveStackCollection } from '@objectstack/core'; import { standaloneActionOwnerKey } from '@objectstack/objectql'; import { effectiveSharingModel } from '@objectstack/plugin-sharing'; import { @@ -1012,8 +1012,10 @@ export function personaGrantNeeds(card: ScenarioArtifactCard): PersonaGrantNeed[ * write does not by itself mean the verb is absent. * * - `field-lock` — an entry with no row condition (`when`) on a field the - * write names, not editable (`fieldPermissionVote`'s reading), and no Modify - * All vote on the object (`superuserFieldVote`) to override it; + * write names, not editable (`fieldPermissionVote`'s reading). No + * object-wide bit overrides it: Modify All casts no field vote and + * `viewAllFields` votes no edit (the field-axis split, ruling of record + * 6912661484); * - `row-rule` — a row policy (`rowLevelSecurity`) that applies to this write * (`enabled` not false, its object or `'*'`, its operation or `all`, no * `positions`: the persona holds none), or a row-conditioned entry on a @@ -1032,8 +1034,7 @@ function writeRefusalRoute( const entry = entries[`${object}.${f}`]; return isBag(entry) && entry.editable !== true ? [{ field: f, conditioned: entry.when !== undefined }] : []; }); - const modifyAll = superuserFieldVote([set as { objects?: Record }], object)?.editable === true; - const locked = modifyAll ? [] : written.filter((w) => !w.conditioned).map((w) => w.field); + const locked = written.filter((w) => !w.conditioned).map((w) => w.field); if (locked.length > 0) return { route: 'field-lock', names: locked }; const policies = (Array.isArray(set.rowLevelSecurity) ? set.rowLevelSecurity : []).filter( (r): r is Bag => @@ -1045,7 +1046,7 @@ function writeRefusalRoute( ); const rowRules = [ ...policies.map((r) => `row policy ${String(r.name)}`), - ...(modifyAll ? [] : written.filter((w) => w.conditioned).map((w) => `row-conditioned field ${w.field}`)), + ...written.filter((w) => w.conditioned).map((w) => `row-conditioned field ${w.field}`), ]; return rowRules.length > 0 ? { route: 'row-rule', names: rowRules } : { route: 'none', names: [] }; } diff --git a/packages/spec/liveness/permission.json b/packages/spec/liveness/permission.json index 5769b1b0edc..1874167f73f 100644 --- a/packages/spec/liveness/permission.json +++ b/packages/spec/liveness/permission.json @@ -128,10 +128,10 @@ }, "viewAllFields": { "status": "live", - "verifiedAt": "2026-11-21", + "verifiedAt": "2026-11-25", "evidenceScope": "in-repo", - "evidence": "packages/core/src/security/effective-object-permissions.ts#holdsViewAllFields (the set's own entry for the object, else its '*' entry); packages/core/src/security/effective-object-permissions.ts#superuserFieldVote (the one field vote: a read vote, never an edit vote, skipped on a field the set's own row declares `readable: false`); packages/plugins/plugin-security/src/permission-evaluator.ts#getFieldPermissions and packages/core/src/security/effective-object-permissions.ts#buildEffectiveFieldPermissions (both merges apply that vote per field)", - "note": "The field-axis split, step 2 (decision card ruling of record 6912661484, letter A): the read-only object-permission bit that votes `readable: true` on every field of the object, fields added later included. Optional, no default. LIVE on landing through the shared vote both field merges apply; on a set that also holds `viewAllRecords` / `modifyAllRecords` it duplicates the vote those bits cast today, so the built-in organization administrator set carries it with no change in behaviour. Also read by the agent ceiling (cleared), the organization boundary (condition (a)), the anchor high-privilege predicate and the access-matrix snapshot." + "evidence": "packages/core/src/security/effective-object-permissions.ts#holdsViewAllFields (the set's own entry for the object, else its '*' entry); packages/core/src/security/effective-object-permissions.ts#viewAllFieldsReadVote (the one \"all fields\" vote: a read vote, never an edit vote, skipped on a field the set's own row declares `readable: false`); packages/plugins/plugin-security/src/permission-evaluator.ts#getFieldPermissions and packages/core/src/security/effective-object-permissions.ts#buildEffectiveFieldPermissions (both merges apply that vote per field)", + "note": "The field-axis split, step 2 (decision card ruling of record 6912661484, letter A): the read-only object-permission bit that votes `readable: true` on every field of the object, fields added later included. Optional, no default. LIVE on landing through the shared vote both field merges apply. Step 3 (protocol 19): `viewAllRecords` / `modifyAllRecords` cast no field vote, so this bit is the only object-wide channel that reads every field; the built-in administrator sets carry it on '*', and the ADR-0087 conversion `permission-view-all-fields-beside-record-bypass` writes it beside the two bits in a source migrated from 18 (`os migrate meta --from 18`). Also read by the agent ceiling (cleared), the organization boundary (condition (a)), the anchor high-privilege predicate and the access-matrix snapshot." }, "readScope": { "status": "live", From 400da548ed938390287d60012d84c5fef06b5b46 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 25 Nov 2026 23:29:16 +0000 Subject: [PATCH 02/11] WIP(security)!: docs, spec describes, showcase viewAllFields for #36055 Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_011y7As8b4YLdvodeGAQWNTQ --- content/docs/permissions/authorization.mdx | 28 ++++------ .../docs/permissions/field-level-security.mdx | 31 +++++------ .../docs/permissions/permissions-matrix.mdx | 2 +- .../src/docs/showcase_tour_security.md | 3 +- .../src/security/permission-sets.ts | 15 +++-- .../src/validate-rollup-source-visibility.ts | 2 +- .../src/agent-ceiling-clamp.ts | 8 +-- packages/spec/src/security/permission.zod.ts | 55 +++++++++++-------- 8 files changed, 73 insertions(+), 71 deletions(-) diff --git a/content/docs/permissions/authorization.mdx b/content/docs/permissions/authorization.mdx index 63f6de390e2..f200b63214e 100644 --- a/content/docs/permissions/authorization.mdx +++ b/content/docs/permissions/authorization.mdx @@ -153,27 +153,23 @@ implementation detail: **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. diff --git a/content/docs/permissions/field-level-security.mdx b/content/docs/permissions/field-level-security.mdx index be86458f622..2d8eea51216 100644 --- a/content/docs/permissions/field-level-security.mdx +++ b/content/docs/permissions/field-level-security.mdx @@ -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. | -**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. ## Choosing by sensitivity @@ -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 @@ -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 diff --git a/content/docs/permissions/permissions-matrix.mdx b/content/docs/permissions/permissions-matrix.mdx index eb59d5ca2a8..53d045935d9 100644 --- a/content/docs/permissions/permissions-matrix.mdx +++ b/content/docs/permissions/permissions-matrix.mdx @@ -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 diff --git a/examples/app-showcase/src/docs/showcase_tour_security.md b/examples/app-showcase/src/docs/showcase_tour_security.md index b37ba702407..91a4854e141 100644 --- a/examples/app-showcase/src/docs/showcase_tour_security.md +++ b/examples/app-showcase/src/docs/showcase_tour_security.md @@ -38,7 +38,8 @@ The other sets each demonstrate one axis: - `showcase_executive` — org-wide read via `readScope: 'org'` (depth, not a bypass). - `showcase_auditor` — **View-All** (`viewAllRecords`): reads every private - record, holds no write bit. High-privilege: suggested for the `everyone` + record, holds no write bit. **View All Fields** (`viewAllFields`) beside it + reads every field of those objects: View All widens records only. High-privilege: suggested for the `everyone` anchor (`isDefault: true`) it would fail the publish linter, and no door binds a set to `everyone` or `guest` by hand. - `showcase_ops` — **system permissions** (`setup.access` opens the Setup diff --git a/examples/app-showcase/src/security/permission-sets.ts b/examples/app-showcase/src/security/permission-sets.ts index 7a8ba07adec..a3566ae5864 100644 --- a/examples/app-showcase/src/security/permission-sets.ts +++ b/examples/app-showcase/src/security/permission-sets.ts @@ -183,7 +183,10 @@ export const ExecutivePermissionSet = definePermissionSet({ /** * Compliance read-only: `viewAllRecords` bypasses OWD/sharing/depth on the * named objects — the auditor sees every private note, inquiry, and invoice, - * but holds no write bit anywhere. High-privilege by definition: suggested + * but holds no write bit anywhere. `viewAllFields` is the field half: View + * All widens records only, so without it a field another set hides stays + * hidden from the auditor too (the protocol 19 field-axis split; written by + * `os migrate meta --from 18`, which keeps the reads this set had). High-privilege by definition: suggested * for the `everyone` anchor (`isDefault: true`) it would fail the publish * lint's anchor rule, and no door binds a set to `everyone` or `guest` by hand. */ @@ -191,10 +194,10 @@ export const AuditorPermissionSet = definePermissionSet({ name: 'showcase_auditor', label: 'Showcase Auditor', objects: { - showcase_private_note: { allowRead: true, viewAllRecords: true }, - showcase_inquiry: { allowRead: true, viewAllRecords: true }, - showcase_invoice: { allowRead: true, viewAllRecords: true }, - showcase_invoice_line: { allowRead: true, viewAllRecords: true }, + showcase_private_note: { allowRead: true, viewAllRecords: true, viewAllFields: true }, + showcase_inquiry: { allowRead: true, viewAllRecords: true, viewAllFields: true }, + showcase_invoice: { allowRead: true, viewAllRecords: true, viewAllFields: true }, + showcase_invoice_line: { allowRead: true, viewAllRecords: true, viewAllFields: true }, }, }); @@ -221,7 +224,7 @@ export const OpsPermissionSet = definePermissionSet({ name: 'showcase_ops', label: 'Showcase Operations', objects: { - showcase_announcement: { allowRead: true, allowCreate: true, allowEdit: true, modifyAllRecords: true }, + showcase_announcement: { allowRead: true, allowCreate: true, allowEdit: true, modifyAllRecords: true, viewAllFields: true }, showcase_inquiry: { allowRead: true, allowEdit: true, readScope: 'org', writeScope: 'org' }, showcase_invoice: { allowRead: true }, // Shared reference data — the org geometry and the tagging tree every diff --git a/packages/lint/src/validate-rollup-source-visibility.ts b/packages/lint/src/validate-rollup-source-visibility.ts index 0b98735dfce..a67ca0858e5 100644 --- a/packages/lint/src/validate-rollup-source-visibility.ts +++ b/packages/lint/src/validate-rollup-source-visibility.ts @@ -67,7 +67,7 @@ * the field (`foldFieldRequiredPermissions`), unless the set's * `systemPermissions` hold EVERY listed capability. View All / Modify All * lifts neither: the object gate runs whatever the grants, and the field fold - * runs after the super-user vote ({@link missingCapabilities}). + * runs after the `viewAllFields` vote ({@link missingCapabilities}). * * ## What is judged, per (permission set × summary field) * diff --git a/packages/plugins/plugin-security/src/agent-ceiling-clamp.ts b/packages/plugins/plugin-security/src/agent-ceiling-clamp.ts index c41cf80c72c..8f792e54b82 100644 --- a/packages/plugins/plugin-security/src/agent-ceiling-clamp.ts +++ b/packages/plugins/plugin-security/src/agent-ceiling-clamp.ts @@ -26,10 +26,10 @@ * ({@link DESTRUCTIVE_CLASS_KEYS}, `permission-evaluator.ts`). With the two * bypass bits gone a `'*'` entry is no longer a superuser wildcard: the * evaluator applies it to a private object only when it carries them - * (ADR-0066 D2). The field merge's vote reads those two bits and - * `viewAllFields` (the field-axis split, ruling of record 6912661484): left - * standing, `viewAllFields` would keep the field half of View All under the - * ceiling, re-opening every field another of the agent's sets hides. On the set: `systemPermissions` (emptied) and `adminScope` (removed), + * (ADR-0066 D2). The field merge's one object-wide vote is `viewAllFields` + * (the field-axis split, ruling of record 6912661484): left standing, it + * would keep a read of every field under the ceiling, re-opening every field + * another of the agent's sets hides. On the set: `systemPermissions` (emptied) and `adminScope` (removed), * in both the definition and the row spellings the delegated-administration * gate reads. * diff --git a/packages/spec/src/security/permission.zod.ts b/packages/spec/src/security/permission.zod.ts index 084001d4f9b..bab3f5f581c 100644 --- a/packages/spec/src/security/permission.zod.ts +++ b/packages/spec/src/security/permission.zod.ts @@ -694,8 +694,15 @@ const ObjectPermissionBaseSchema = lazySchema(() => strictObject( * View All Records: Super-user read access. * Bypasses Sharing Rules and Ownership checks. * Equivalent to Microsoft Dataverse "Organization" level read access. + * + * [The field-axis split, ruling of record 6912661484, step 3] It widens + * which RECORDS the caller reads and nothing else: it casts no field vote, + * so a field another set hides with `readable: false` stays hidden from its + * holders. Reading every field is `viewAllFields`. Until protocol 19 it + * voted `readable: true` on every field of the object; `os migrate meta + * --from 18` writes `viewAllFields: true` beside it in an older source. */ - viewAllRecords: z.boolean().default(false).describe('View All Data (Bypass Sharing)'), + viewAllRecords: z.boolean().default(false).describe('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.'), /** * Modify All Records: Super-user write access. @@ -723,8 +730,14 @@ const ObjectPermissionBaseSchema = lazySchema(() => strictObject( * an explicit `allowDelete: false` beside it is refused, because the * evaluator never reads it. "Edit every record, delete none" is a `criteria` * sharing rule with `accessLevel: 'edit'`, not this bit. + * + * [The field-axis split, ruling of record 6912661484, step 3] Like View All + * it casts no field vote: a field another set hides or locks stays hidden + * or locked, and so does a field this set's own row hides or locks. Until + * protocol 19 it voted `readable: true` and `editable: true` on every field + * of the object, its own rows included. */ - modifyAllRecords: z.boolean().default(false).describe('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.'), + modifyAllRecords: z.boolean().default(false).describe('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.'), /** * View All Fields: a READ vote on every field of the object, fields added @@ -743,11 +756,11 @@ const ObjectPermissionBaseSchema = lazySchema(() => strictObject( * - Allowed on the `'*'` wildcard entry, where it votes on every object the * set does not name explicitly (the same lookup the super-user bits take). * - * Today `viewAllRecords` / `modifyAllRecords` still vote on every field - * too, so on an object entry that carries either bit (the set's own entry - * for the object, else its `'*'` entry) this key changes nothing; the - * built-in admin sets carry it so they keep their field visibility when - * those two bits stop voting on fields. + * It is the ONLY object-wide bit that votes on fields: since protocol 19 + * `viewAllRecords` / `modifyAllRecords` cast no field vote (step 3 of the + * split). The built-in admin sets carry it on `'*'`, and `os migrate meta + * --from 18` writes it beside either bit in an older source, so a migrated + * set keeps every read those bits voted. * * Deliberately OPTIONAL (no Zod default), like `allowExport`: a default * would materialize the key into every parsed entry, and a runtime built @@ -1084,18 +1097,13 @@ const FIELD_PERMISSION_ROLLUP_REASON_ON_HIDDEN = * condition matches, the entry votes as declared; on any other row the entry * is absent, so the most-permissive merge * (`PermissionEvaluator.getFieldPermissions`) is unchanged. Beside the - * declaring sets, a set holding the super-user bypass on the object, or - * carrying `viewAllFields` on it, votes on every field of it, on every row - * (ADR-0066 ⑧ note of 2026-11-02, ruling of record 6573563853; the field-axis - * split, ruling of record 6912661484): `viewAllRecords` votes - * `readable: true`, and so does `viewAllFields` (under the same exception as - * View All, below), `modifyAllRecords` votes `readable: true` and - * `editable: true`; View All and View All Fields - * never grant an edit. One exception (ADR-0066 ⑧ note of 2026-11-15): a set - * holding View All without Modify All casts no read vote on a field its OWN - * entry declares `readable: false`, so that row binds the set's own holders; - * another set's vote, and the Modify All vote, are as before. Otherwise union - * without deny is unchanged. The write gate + * declaring sets, a set carrying `viewAllFields` on the object votes + * `readable: true` on every field of it, on every row, and never an edit + * (the field-axis split, ruling of record 6912661484), except a field its OWN + * entry declares `readable: false`: that row binds the set's own holders. + * `viewAllRecords` and `modifyAllRecords` cast no field vote since protocol + * 19 (until then they voted on every field, ruling of record 6573563853). + * Otherwise union without deny is unchanged. The write gate * judges it on the stored row before an update and on the incoming row of an * insert. It reaches the EDIT vote only: reads are row-blind (per-row masking * waits for a measured need), so `readable: false` beside a `when` is refused @@ -1159,11 +1167,10 @@ export const FieldPermissionSchema = lazySchema(() => strictObject( + 'votes on every row. Present, the entry votes as declared on the rows the condition matches and is ABSENT on ' + 'every other row, so the most-permissive merge across the caller\'s sets is unchanged: a set that locks a ' + 'field only from a stage onward does not lock the rows before it, and a co-held set that says nothing about ' - + 'the field still lifts nothing, unless it holds the super-user bypass on the object (its own entry for the ' - + 'object, otherwise its `\'*\'` wildcard). Such a set votes on every field of the object, on every row, ' - + 'whatever `when` says: `viewAllRecords` votes `readable: true`, and `modifyAllRecords` votes `readable: true` ' - + 'and `editable: true`, so a row-conditioned lock never binds a Modify All holder. View All never grants an ' - + 'edit. Otherwise union without deny is unchanged. The write gate judges the condition ' + + 'the field still lifts nothing. A set carrying `viewAllFields` on the object (its own entry for the object, ' + + 'otherwise its `\'*\'` wildcard) votes `readable: true` on every field, on every row, and never an edit, so a ' + + 'row-conditioned lock binds its holders; `viewAllRecords` and `modifyAllRecords` cast no field vote. ' + + 'Otherwise union without deny is unchanged. The write gate judges the condition ' + 'on the stored row BEFORE an update (so a lock on `status in [...]` holds on an approved row even when the ' + 'write changes `status`) and on the incoming row of an insert, as the caller sent it. It reaches the EDIT vote ' + 'only — reads are judged row-blind — so `readable: false` beside a `when` is refused at parse time: keep ' From 9455531f45867edab4419e8995a8a80d6c6c467b Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 25 Nov 2026 23:54:40 +0000 Subject: [PATCH 03/11] WIP(security)!: tests, changeset for #36055 (View All / Modify All cast no field vote) Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_011y7As8b4YLdvodeGAQWNTQ --- .../36055-view-all-stops-voting-on-fields.md | 37 ++++ content/docs/references/api/auth.mdx | 8 +- content/docs/references/api/protocol.mdx | 10 +- .../docs/references/security/permission.mdx | 16 +- .../superuser-bypass-mirror-parity.test.ts | 15 +- .../effective-object-permissions.test.ts | 28 +-- .../superuser-field-vote-33828.test.ts | 140 +++++--------- packages/lint/src/finding-user-text.test.ts | 130 ++----------- ...ce-visibility-own-field-mask-33828.test.ts | 15 +- .../validate-rollup-source-visibility.test.ts | 44 ++--- ...sture-cross-set-field-reopen-36052.test.ts | 83 ++++---- ...urity-posture-own-field-mask-33828.test.ts | 106 +++------- .../src/validate-security-posture.test.ts | 180 +++-------------- .../src/explain-engine.test.ts | 70 +++---- .../src/fls-own-field-mask-33828.test.ts | 181 +++++++----------- .../src/fls-superuser-vote.test.ts | 125 ++++++------ ...formula-reads-hidden-field-masking.test.ts | 25 ++- .../src/security-plugin.test.ts | 4 +- .../fls-own-field-mask-33828.dogfood.test.ts | 61 ++++-- .../test/fls-superuser-vote.dogfood.test.ts | 18 +- .../test/score/scenario-tags.test.ts | 4 +- ...esume-decider-identity.integration.test.ts | 7 +- 22 files changed, 497 insertions(+), 810 deletions(-) create mode 100644 .changeset/36055-view-all-stops-voting-on-fields.md diff --git a/.changeset/36055-view-all-stops-voting-on-fields.md b/.changeset/36055-view-all-stops-voting-on-fields.md new file mode 100644 index 00000000000..14a4d2702da --- /dev/null +++ b/.changeset/36055-view-all-stops-voting-on-fields.md @@ -0,0 +1,37 @@ +--- +'@objectstack/core': major +'@objectstack/plugin-security': major +'@objectstack/lint': major +'@objectstack/spec': major +'@objectstack/scenarios': 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 + + + +FROM → TO: + +- `objects.: { 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.: { 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` (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. + +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/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. diff --git a/content/docs/references/api/auth.mdx b/content/docs/references/api/auth.mdx index 9cc2c5addee..29026aab2ab 100644 --- a/content/docs/references/api/auth.mdx +++ b/content/docs/references/api/auth.mdx @@ -113,8 +113,8 @@ const result = AuthProvider.parse(data); | **allowPurge** | `never` | optional | [REMOVED] `objects..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 | @@ -178,8 +178,8 @@ This schema accepts one of the following structures: | **allowPurge** | `never` | optional | [REMOVED] `objects..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 | diff --git a/content/docs/references/api/protocol.mdx b/content/docs/references/api/protocol.mdx index fe21995a428..5b17860e018 100644 --- a/content/docs/references/api/protocol.mdx +++ b/content/docs/references/api/protocol.mdx @@ -1320,8 +1320,8 @@ This schema accepts one of the following structures: | **allowPurge** | `never` | optional | [REMOVED] `objects..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 | @@ -1794,8 +1794,8 @@ One changed key path of the pending draft, and the last write that changed it. | **allowPurge** | `never` | optional | [REMOVED] `objects..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 | @@ -1806,7 +1806,7 @@ One changed key path of the pending draft, and the last write that changed it. | :--- | :--- | :--- | :--- | | **readable** | `boolean` | optional (default: `true`) | Field read access | | **editable** | `boolean` | optional (default: `false`) | Field edit access | -| **when** | `string` | optional | Row condition narrowing where this entry votes, authored in canonical CEL like `rowLevelSecurity[].using` (a field of this object compared with a literal or a `current_user.*` value using `==`, `!=`, `<`, `<=`, `>`, `>=` or `in`, combined with `&&` / `\|\|`; e.g. status in ["approved", "signing", "active"]). Absent, the entry votes on every row. Present, the entry votes as declared on the rows the condition matches and is ABSENT on every other row, so the most-permissive merge across the caller's sets is unchanged: a set that locks a field only from a stage onward does not lock the rows before it, and a co-held set that says nothing about the field still lifts nothing, unless it holds the super-user bypass on the object (its own entry for the object, otherwise its `'*'` wildcard). Such a set votes on every field of the object, on every row, whatever `when` says: `viewAllRecords` votes `readable: true`, and `modifyAllRecords` votes `readable: true` and `editable: true`, so a row-conditioned lock never binds a Modify All holder. View All never grants an edit. Otherwise union without deny is unchanged. The write gate judges the condition on the stored row BEFORE an update (so a lock on `status in [...]` holds on an approved row even when the write changes `status`) and on the incoming row of an insert, as the caller sent it. It reaches the EDIT vote only — reads are judged row-blind — so `readable: false` beside a `when` is refused at parse time: keep `readable: true` (the default) on a row-conditioned entry. Where no row can be judged (a predicate update with no row address, a stored row the caller cannot read, a condition that does not resolve for the request) the entry is judged as its lock: it contributes no edit grant on that write. Validated like an RLS predicate at authoring and publish time: the fields it names must exist on the entry's object and it may not reach across a relation; a condition that cannot be lowered is refused there, never dropped at runtime. Readers that hold no row (`/auth/me/permissions`, the object-wide field projections, the write preview on an update) report a row-conditioned entry as its lock, so a client never advertises an edit the gate refuses. The record-scoped field projection (`GET /data/{object}/{id}/field-access`, the answer a record's edit form reads) holds the row: it judges the condition on the stored row exactly as the write gate does on an update of that row, so a lock that applies only from a stage onward disables the field only on the rows it names. | +| **when** | `string` | optional | Row condition narrowing where this entry votes, authored in canonical CEL like `rowLevelSecurity[].using` (a field of this object compared with a literal or a `current_user.*` value using `==`, `!=`, `<`, `<=`, `>`, `>=` or `in`, combined with `&&` / `\|\|`; e.g. status in ["approved", "signing", "active"]). Absent, the entry votes on every row. Present, the entry votes as declared on the rows the condition matches and is ABSENT on every other row, so the most-permissive merge across the caller's sets is unchanged: a set that locks a field only from a stage onward does not lock the rows before it, and a co-held set that says nothing about the field still lifts nothing. A set carrying `viewAllFields` on the object (its own entry for the object, otherwise its `'*'` wildcard) votes `readable: true` on every field, on every row, and never an edit, so a row-conditioned lock binds its holders; `viewAllRecords` and `modifyAllRecords` cast no field vote. Otherwise union without deny is unchanged. The write gate judges the condition on the stored row BEFORE an update (so a lock on `status in [...]` holds on an approved row even when the write changes `status`) and on the incoming row of an insert, as the caller sent it. It reaches the EDIT vote only — reads are judged row-blind — so `readable: false` beside a `when` is refused at parse time: keep `readable: true` (the default) on a row-conditioned entry. Where no row can be judged (a predicate update with no row address, a stored row the caller cannot read, a condition that does not resolve for the request) the entry is judged as its lock: it contributes no edit grant on that write. Validated like an RLS predicate at authoring and publish time: the fields it names must exist on the entry's object and it may not reach across a relation; a condition that cannot be lowered is refused there, never dropped at runtime. Readers that hold no row (`/auth/me/permissions`, the object-wide field projections, the write preview on an update) report a row-conditioned entry as its lock, so a client never advertises an edit the gate refuses. The record-scoped field projection (`GET /data/{object}/{id}/field-access`, the answer a record's edit form reads) holds the row: it judges the condition on the stored row exactly as the write gate does on an update of that row, so a lock that applies only from a stage onward disables the field only on the rows it names. | | **rollupSourceUnreadableReason** | `string` | optional | Authoring-time acknowledgement, read only by `os lint` (the runtime does not read it): why holders of this set are meant to read this roll-up `summary` column although the set cannot read the child object, the aggregated child field or a child field the roll-up's `filter` tests (e.g. 'Service staff read account totals but not invoice rows'). Declared on the set's entry for the summary column, it turns that set's `security-rollup-source-unreadable` warning for the column into an `info` note quoting the reason, so `os lint --strict` passes; every other finding is unchanged. The runtime does not read the key, but the entry that carries it is an ordinary declaring entry: it votes `readable: true` in the field merge (only declaring sets vote, and the most permissive vote wins), so on a set that had no entry for the column, adding one to carry the reason restores the column for holders whose other sets mask it. A blank reason is refused, and so is a reason beside `readable: false`, an entry that declares no read to acknowledge. | diff --git a/content/docs/references/security/permission.mdx b/content/docs/references/security/permission.mdx index 9fafc51a6ac..8d952f70267 100644 --- a/content/docs/references/security/permission.mdx +++ b/content/docs/references/security/permission.mdx @@ -54,8 +54,8 @@ const result = AdminScopeSchema.parse(data); | **allowPurge** | `never` | optional | [REMOVED] `objects..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 | @@ -72,7 +72,7 @@ const result = AdminScopeSchema.parse(data); | :--- | :--- | :--- | :--- | | **readable** | `boolean` | optional (default: `true`) | Field read access | | **editable** | `boolean` | optional (default: `false`) | Field edit access | -| **when** | `string` | optional | Row condition narrowing where this entry votes, authored in canonical CEL like `rowLevelSecurity[].using` (a field of this object compared with a literal or a `current_user.*` value using `==`, `!=`, `<`, `<=`, `>`, `>=` or `in`, combined with `&&` / `\|\|`; e.g. status in ["approved", "signing", "active"]). Absent, the entry votes on every row. Present, the entry votes as declared on the rows the condition matches and is ABSENT on every other row, so the most-permissive merge across the caller's sets is unchanged: a set that locks a field only from a stage onward does not lock the rows before it, and a co-held set that says nothing about the field still lifts nothing, unless it holds the super-user bypass on the object (its own entry for the object, otherwise its `'*'` wildcard). Such a set votes on every field of the object, on every row, whatever `when` says: `viewAllRecords` votes `readable: true`, and `modifyAllRecords` votes `readable: true` and `editable: true`, so a row-conditioned lock never binds a Modify All holder. View All never grants an edit. Otherwise union without deny is unchanged. The write gate judges the condition on the stored row BEFORE an update (so a lock on `status in [...]` holds on an approved row even when the write changes `status`) and on the incoming row of an insert, as the caller sent it. It reaches the EDIT vote only — reads are judged row-blind — so `readable: false` beside a `when` is refused at parse time: keep `readable: true` (the default) on a row-conditioned entry. Where no row can be judged (a predicate update with no row address, a stored row the caller cannot read, a condition that does not resolve for the request) the entry is judged as its lock: it contributes no edit grant on that write. Validated like an RLS predicate at authoring and publish time: the fields it names must exist on the entry's object and it may not reach across a relation; a condition that cannot be lowered is refused there, never dropped at runtime. Readers that hold no row (`/auth/me/permissions`, the object-wide field projections, the write preview on an update) report a row-conditioned entry as its lock, so a client never advertises an edit the gate refuses. The record-scoped field projection (`GET /data/{object}/{id}/field-access`, the answer a record's edit form reads) holds the row: it judges the condition on the stored row exactly as the write gate does on an update of that row, so a lock that applies only from a stage onward disables the field only on the rows it names. | +| **when** | `string` | optional | Row condition narrowing where this entry votes, authored in canonical CEL like `rowLevelSecurity[].using` (a field of this object compared with a literal or a `current_user.*` value using `==`, `!=`, `<`, `<=`, `>`, `>=` or `in`, combined with `&&` / `\|\|`; e.g. status in ["approved", "signing", "active"]). Absent, the entry votes on every row. Present, the entry votes as declared on the rows the condition matches and is ABSENT on every other row, so the most-permissive merge across the caller's sets is unchanged: a set that locks a field only from a stage onward does not lock the rows before it, and a co-held set that says nothing about the field still lifts nothing. A set carrying `viewAllFields` on the object (its own entry for the object, otherwise its `'*'` wildcard) votes `readable: true` on every field, on every row, and never an edit, so a row-conditioned lock binds its holders; `viewAllRecords` and `modifyAllRecords` cast no field vote. Otherwise union without deny is unchanged. The write gate judges the condition on the stored row BEFORE an update (so a lock on `status in [...]` holds on an approved row even when the write changes `status`) and on the incoming row of an insert, as the caller sent it. It reaches the EDIT vote only — reads are judged row-blind — so `readable: false` beside a `when` is refused at parse time: keep `readable: true` (the default) on a row-conditioned entry. Where no row can be judged (a predicate update with no row address, a stored row the caller cannot read, a condition that does not resolve for the request) the entry is judged as its lock: it contributes no edit grant on that write. Validated like an RLS predicate at authoring and publish time: the fields it names must exist on the entry's object and it may not reach across a relation; a condition that cannot be lowered is refused there, never dropped at runtime. Readers that hold no row (`/auth/me/permissions`, the object-wide field projections, the write preview on an update) report a row-conditioned entry as its lock, so a client never advertises an edit the gate refuses. The record-scoped field projection (`GET /data/{object}/{id}/field-access`, the answer a record's edit form reads) holds the row: it judges the condition on the stored row exactly as the write gate does on an update of that row, so a lock that applies only from a stage onward disables the field only on the rows it names. | | **rollupSourceUnreadableReason** | `string` | optional | Authoring-time acknowledgement, read only by `os lint` (the runtime does not read it): why holders of this set are meant to read this roll-up `summary` column although the set cannot read the child object, the aggregated child field or a child field the roll-up's `filter` tests (e.g. 'Service staff read account totals but not invoice rows'). Declared on the set's entry for the summary column, it turns that set's `security-rollup-source-unreadable` warning for the column into an `info` note quoting the reason, so `os lint --strict` passes; every other finding is unchanged. The runtime does not read the key, but the entry that carries it is an ordinary declaring entry: it votes `readable: true` in the field merge (only declaring sets vote, and the most permissive vote wins), so on a set that had no entry for the column, adding one to carry the reason restores the column for holders whose other sets mask it. A blank reason is refused, and so is a reason beside `readable: false`, an entry that declares no read to acknowledge. | @@ -107,8 +107,8 @@ const result = AdminScopeSchema.parse(data); | **allowPurge** | `never` | optional | [REMOVED] `objects..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 | @@ -157,8 +157,8 @@ const result = AdminScopeSchema.parse(data); | **allowPurge** | `never` | optional | [REMOVED] `objects..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 | @@ -169,7 +169,7 @@ const result = AdminScopeSchema.parse(data); | :--- | :--- | :--- | :--- | | **readable** | `boolean` | optional (default: `true`) | Field read access | | **editable** | `boolean` | optional (default: `false`) | Field edit access | -| **when** | `string` | optional | Row condition narrowing where this entry votes, authored in canonical CEL like `rowLevelSecurity[].using` (a field of this object compared with a literal or a `current_user.*` value using `==`, `!=`, `<`, `<=`, `>`, `>=` or `in`, combined with `&&` / `\|\|`; e.g. status in ["approved", "signing", "active"]). Absent, the entry votes on every row. Present, the entry votes as declared on the rows the condition matches and is ABSENT on every other row, so the most-permissive merge across the caller's sets is unchanged: a set that locks a field only from a stage onward does not lock the rows before it, and a co-held set that says nothing about the field still lifts nothing, unless it holds the super-user bypass on the object (its own entry for the object, otherwise its `'*'` wildcard). Such a set votes on every field of the object, on every row, whatever `when` says: `viewAllRecords` votes `readable: true`, and `modifyAllRecords` votes `readable: true` and `editable: true`, so a row-conditioned lock never binds a Modify All holder. View All never grants an edit. Otherwise union without deny is unchanged. The write gate judges the condition on the stored row BEFORE an update (so a lock on `status in [...]` holds on an approved row even when the write changes `status`) and on the incoming row of an insert, as the caller sent it. It reaches the EDIT vote only — reads are judged row-blind — so `readable: false` beside a `when` is refused at parse time: keep `readable: true` (the default) on a row-conditioned entry. Where no row can be judged (a predicate update with no row address, a stored row the caller cannot read, a condition that does not resolve for the request) the entry is judged as its lock: it contributes no edit grant on that write. Validated like an RLS predicate at authoring and publish time: the fields it names must exist on the entry's object and it may not reach across a relation; a condition that cannot be lowered is refused there, never dropped at runtime. Readers that hold no row (`/auth/me/permissions`, the object-wide field projections, the write preview on an update) report a row-conditioned entry as its lock, so a client never advertises an edit the gate refuses. The record-scoped field projection (`GET /data/{object}/{id}/field-access`, the answer a record's edit form reads) holds the row: it judges the condition on the stored row exactly as the write gate does on an update of that row, so a lock that applies only from a stage onward disables the field only on the rows it names. | +| **when** | `string` | optional | Row condition narrowing where this entry votes, authored in canonical CEL like `rowLevelSecurity[].using` (a field of this object compared with a literal or a `current_user.*` value using `==`, `!=`, `<`, `<=`, `>`, `>=` or `in`, combined with `&&` / `\|\|`; e.g. status in ["approved", "signing", "active"]). Absent, the entry votes on every row. Present, the entry votes as declared on the rows the condition matches and is ABSENT on every other row, so the most-permissive merge across the caller's sets is unchanged: a set that locks a field only from a stage onward does not lock the rows before it, and a co-held set that says nothing about the field still lifts nothing. A set carrying `viewAllFields` on the object (its own entry for the object, otherwise its `'*'` wildcard) votes `readable: true` on every field, on every row, and never an edit, so a row-conditioned lock binds its holders; `viewAllRecords` and `modifyAllRecords` cast no field vote. Otherwise union without deny is unchanged. The write gate judges the condition on the stored row BEFORE an update (so a lock on `status in [...]` holds on an approved row even when the write changes `status`) and on the incoming row of an insert, as the caller sent it. It reaches the EDIT vote only — reads are judged row-blind — so `readable: false` beside a `when` is refused at parse time: keep `readable: true` (the default) on a row-conditioned entry. Where no row can be judged (a predicate update with no row address, a stored row the caller cannot read, a condition that does not resolve for the request) the entry is judged as its lock: it contributes no edit grant on that write. Validated like an RLS predicate at authoring and publish time: the fields it names must exist on the entry's object and it may not reach across a relation; a condition that cannot be lowered is refused there, never dropped at runtime. Readers that hold no row (`/auth/me/permissions`, the object-wide field projections, the write preview on an update) report a row-conditioned entry as its lock, so a client never advertises an edit the gate refuses. The record-scoped field projection (`GET /data/{object}/{id}/field-access`, the answer a record's edit form reads) holds the row: it judges the condition on the stored row exactly as the write gate does on an update of that row, so a lock that applies only from a stage onward disables the field only on the rows it names. | | **rollupSourceUnreadableReason** | `string` | optional | Authoring-time acknowledgement, read only by `os lint` (the runtime does not read it): why holders of this set are meant to read this roll-up `summary` column although the set cannot read the child object, the aggregated child field or a child field the roll-up's `filter` tests (e.g. 'Service staff read account totals but not invoice rows'). Declared on the set's entry for the summary column, it turns that set's `security-rollup-source-unreadable` warning for the column into an `info` note quoting the reason, so `os lint --strict` passes; every other finding is unchanged. The runtime does not read the key, but the entry that carries it is an ordinary declaring entry: it votes `readable: true` in the field merge (only declaring sets vote, and the most permissive vote wins), so on a set that had no entry for the column, adding one to carry the reason restores the column for holders whose other sets mask it. A blank reason is refused, and so is a reason beside `readable: false`, an entry that declares no read to acknowledge. | ### Nested Shape: `PermissionSet.rowLevelSecurity[number]` diff --git a/packages/cli/test/superuser-bypass-mirror-parity.test.ts b/packages/cli/test/superuser-bypass-mirror-parity.test.ts index 539fc1ef955..0051ebefba5 100644 --- a/packages/cli/test/superuser-bypass-mirror-parity.test.ts +++ b/packages/cli/test/superuser-bypass-mirror-parity.test.ts @@ -6,13 +6,14 @@ * * `holdsSuperuserBypass` (`@objectstack/core`, `security/effective-object-permissions.ts`) * is the ONE reading of "does this set hold View All / Modify All on this - * object": the row bypass and both field merges ask it (ADR-0066 D2, ruling - * of record 6573563853 letter A). `@objectstack/lint` depends on - * `@objectstack/spec` alone, so its `security-superuser-field-mask-inert` - * rule reads the bypass through a verbatim COPY exported under the same name. - * A copy is a second reading the day the two drift, and a drifted lint either - * warns about a mask the runtime enforces or stays silent about one it - * ignores. This package depends on both, so the parity is pinned here: a + * object": the row bypass asks it (ADR-0066 D2, ruling of record 6573563853 + * letter A; since v19, #36055, the field merges no longer do: View All and + * Modify All cast no field vote). `@objectstack/lint` depends on + * `@objectstack/spec` alone, so its roll-up source-visibility rule reads the + * record bypass through a verbatim COPY exported under the same name. A copy + * is a second reading the day the two drift, and a drifted lint either warns + * about a child row the runtime lets the caller reach or stays silent about + * one it hides. This package depends on both, so the parity is pinned here: a * change to either function reds this file until the other follows. * * The matrix is the cartesian product of what the lookup reads: the set's own diff --git a/packages/core/src/security/effective-object-permissions.test.ts b/packages/core/src/security/effective-object-permissions.test.ts index 4d79b28a5cf..3e830e59be6 100644 --- a/packages/core/src/security/effective-object-permissions.test.ts +++ b/packages/core/src/security/effective-object-permissions.test.ts @@ -885,24 +885,30 @@ describe('buildEffectiveFieldPermissions (#25866)', () => { expect(widened).toEqual({ 'deal.amount': { readable: true, editable: true } }); }); - // [ADR-0066 ⑧, ruling of record 6573563853] A set holding the super-user - // bypass on an object votes on every field of it: `viewAllRecords` reads, - // `modifyAllRecords` reads and edits — the same sets `superuserBypassSets` - // (`@objectstack/plugin-security`) names, through `holdsSuperuserBypass`. - it('a super-user set votes on every declared field of its object; a plain set does not', () => { + // [ADR-0066 ⑧, v19, #36055] `viewAllFields` is the only "every field" + // vote: it reads every declared field of its object, never edits. View All + // and Modify All widen records only and cast no field vote. + it('a viewAllFields set votes read on every declared field of its object; a super-user or plain set does not', () => { const mask = { fields: { 'deal.amount': { readable: false, editable: false }, 'lead.score': { readable: false, editable: false } } }; - expect(buildEffectiveFieldPermissions([{ objects: { '*': { modifyAllRecords: true } } }, mask])).toEqual({ - 'deal.amount': { readable: true, editable: true }, - 'lead.score': { readable: true, editable: true }, + expect(buildEffectiveFieldPermissions([{ objects: { '*': { viewAllFields: true } } }, mask])).toEqual({ + 'deal.amount': { readable: true, editable: false }, + 'lead.score': { readable: true, editable: false }, }); - expect(buildEffectiveFieldPermissions([{ objects: { deal: { viewAllRecords: true } } }, mask])).toEqual({ + expect(buildEffectiveFieldPermissions([{ objects: { deal: { viewAllFields: true } } }, mask])).toEqual({ 'deal.amount': { readable: true, editable: false }, 'lead.score': { readable: false, editable: false }, }); // An explicit entry shadows the same set's wildcard, as at row level. - expect(buildEffectiveFieldPermissions([{ objects: { '*': { viewAllRecords: true }, deal: { allowRead: true } } }, mask])) + expect(buildEffectiveFieldPermissions([{ objects: { '*': { viewAllFields: true }, deal: { allowRead: true } } }, mask])) .toEqual({ 'deal.amount': { readable: false, editable: false }, 'lead.score': { readable: true, editable: false } }); - // Control: no bypass bit, no vote — union without deny is unchanged. + // View All and Modify All cast no field vote, by name or by the wildcard. + for (const objects of [{ '*': { modifyAllRecords: true } }, { deal: { viewAllRecords: true, modifyAllRecords: true } }]) { + expect(buildEffectiveFieldPermissions([{ objects }, mask])).toEqual({ + 'deal.amount': { readable: false, editable: false }, + 'lead.score': { readable: false, editable: false }, + }); + } + // Control: no bit, no vote — union without deny is unchanged. expect(buildEffectiveFieldPermissions([{ objects: { deal: { allowRead: true, allowEdit: true } } }, mask])).toEqual({ 'deal.amount': { readable: false, editable: false }, 'lead.score': { readable: false, editable: false }, diff --git a/packages/core/src/security/superuser-field-vote-33828.test.ts b/packages/core/src/security/superuser-field-vote-33828.test.ts index c05f3e41072..bfe8448fcf3 100644 --- a/packages/core/src/security/superuser-field-vote-33828.test.ts +++ b/packages/core/src/security/superuser-field-vote-33828.test.ts @@ -1,15 +1,14 @@ // Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. /** - * [ADR-0066 D2 ⑧ note of 2026-11-15] A set's own explicit `readable: false` - * row is that set's vote on the field: its own View All casts no read vote - * there. Another set's bypass still votes (the admin case of ruling of record - * 6573563853), and a Modify All set still votes on every field, its own rows - * included. + * [ADR-0066 D2 ⑧, v19, #36055] View All and Modify All widen records only and + * cast no field vote. `viewAllFields` is the one "every field" channel: a read + * vote, never an edit vote, and a set's own explicit `readable: false` row + * beats its own bit (the own-row rule of the 2026-11-15 note, #33828). * * Pinned on the row-blind merge (`buildEffectiveFieldPermissions`, the `fields` * slot of `/auth/me/permissions`) and on the one function both field merges - * ask, `superuserFieldVote`. The evaluator's merge is pinned beside it in + * ask, `viewAllFieldsReadVote`. The evaluator's merge is pinned beside it in * plugin-security's `fls-own-field-mask-33828.test.ts`. */ @@ -17,121 +16,86 @@ import { describe, it, expect } from 'vitest'; import { buildEffectiveFieldPermissions, buildEffectiveObjectPermissions, - superuserFieldVote, + viewAllFieldsReadVote, } from './effective-object-permissions.js'; -describe('a set\'s own readable: false row and that set\'s own super-user vote', () => { - const viewAll = ( - fields: Record, - objects: Record = { deal: { allowRead: true, viewAllRecords: true } }, - ) => ({ objects, fields }); - const mask = { 'deal.amount': { readable: false, editable: false } }; - - it('View All beside the set\'s own readable: false row: the row binds, by the object entry and by the wildcard', () => { - expect(buildEffectiveFieldPermissions([viewAll(mask)])).toEqual({ 'deal.amount': { readable: false, editable: false } }); - expect(buildEffectiveFieldPermissions([viewAll(mask, { '*': { viewAllRecords: true } })])).toEqual({ - 'deal.amount': { readable: false, editable: false }, - }); - // Two holders of the pair, each masking the field itself: nobody votes it readable. - expect(buildEffectiveFieldPermissions([viewAll(mask), viewAll(mask)])).toEqual({ - 'deal.amount': { readable: false, editable: false }, - }); - }); +describe('[v19, #36055] View All and Modify All cast no field vote', () => { + const hider = { objects: { deal: { allowRead: true } }, fields: { 'deal.amount': { readable: false, editable: false } } }; + const lock = { objects: { deal: { allowRead: true, allowEdit: true } }, fields: { 'deal.amount': { readable: true, editable: false } } }; - it('the same set\'s View All still votes on the fields it does not mask itself', () => { - // `deal.stage` is masked by ANOTHER set; this set's View All reads it as before. - expect(buildEffectiveFieldPermissions([ - viewAll(mask), - { objects: { deal: { allowRead: true } }, fields: { 'deal.stage': { readable: false, editable: false } } }, - ])).toEqual({ - 'deal.amount': { readable: false, editable: false }, - 'deal.stage': { readable: true, editable: false }, - }); + it('an unconverted set with View All alone no longer reads a field another set hides', () => { + for (const objects of [{ deal: { allowRead: true, viewAllRecords: true } }, { '*': { allowRead: true, viewAllRecords: true } }]) { + expect(buildEffectiveFieldPermissions([{ objects }, hider])).toEqual({ 'deal.amount': { readable: false, editable: false } }); + expect(viewAllFieldsReadVote([{ objects }], 'deal', 'amount')).toBe(false); + } }); - it('reverse pin: another set\'s View All or Modify All on the object still reads the masked field', () => { - expect(buildEffectiveFieldPermissions([viewAll(mask), { objects: { deal: { viewAllRecords: true } } }])).toEqual({ - 'deal.amount': { readable: true, editable: false }, - }); - expect(buildEffectiveFieldPermissions([viewAll(mask), { objects: { '*': { viewAllRecords: true } } }])).toEqual({ - 'deal.amount': { readable: true, editable: false }, - }); - expect(buildEffectiveFieldPermissions([viewAll(mask), { objects: { deal: { modifyAllRecords: true } } }])).toEqual({ - 'deal.amount': { readable: true, editable: true }, - }); - // Another set's declared `readable: true` still out-votes the mask: union without deny. - expect(buildEffectiveFieldPermissions([viewAll(mask), { fields: { 'deal.amount': { readable: true, editable: false } } }])) - .toEqual({ 'deal.amount': { readable: true, editable: false } }); + it('Modify All opens neither the read nor the edit of a field another set hides or locks', () => { + const modifyAll = { objects: { deal: { allowRead: true, allowEdit: true, modifyAllRecords: true } } }; + expect(buildEffectiveFieldPermissions([modifyAll, hider])).toEqual({ 'deal.amount': { readable: false, editable: false } }); + expect(buildEffectiveFieldPermissions([modifyAll, lock])).toEqual({ 'deal.amount': { readable: true, editable: false } }); + expect(viewAllFieldsReadVote([modifyAll], 'deal', 'amount')).toBe(false); }); - it('Modify All is unchanged: it votes on every field, the set\'s own rows included', () => { - const modifyAll = { deal: { allowRead: true, allowEdit: true, modifyAllRecords: true } }; - expect(buildEffectiveFieldPermissions([{ objects: modifyAll, fields: mask }])).toEqual({ - 'deal.amount': { readable: true, editable: true }, - }); - expect(buildEffectiveFieldPermissions([{ objects: modifyAll, fields: { 'deal.amount': { readable: true, editable: false } } }])) - .toEqual({ 'deal.amount': { readable: true, editable: true } }); - // Both bits on one entry: the Modify All vote is the one that counts. - expect(buildEffectiveFieldPermissions([ - { objects: { deal: { viewAllRecords: true, modifyAllRecords: true } }, fields: mask }, - ])).toEqual({ 'deal.amount': { readable: true, editable: true } }); + it('a set\'s own rows bind beside its own View All or Modify All', () => { + for (const bits of [{ viewAllRecords: true }, { modifyAllRecords: true }]) { + const own = { objects: { deal: { allowRead: true, allowEdit: true, ...bits } }, fields: hider.fields }; + expect(buildEffectiveFieldPermissions([own])).toEqual({ 'deal.amount': { readable: false, editable: false } }); + const ownLock = { objects: { deal: { allowRead: true, allowEdit: true, ...bits } }, fields: lock.fields }; + expect(buildEffectiveFieldPermissions([ownLock])).toEqual({ 'deal.amount': { readable: true, editable: false } }); + } }); - it('an edit lock beside View All binds as it always did, and only an explicit false is a mask', () => { - expect(buildEffectiveFieldPermissions([viewAll({ 'deal.amount': { readable: true, editable: false } })])).toEqual({ - 'deal.amount': { readable: true, editable: false }, - }); - // An unparsed row that omits `readable` is not an explicit mask: the vote stands. - expect(buildEffectiveFieldPermissions([viewAll({ 'deal.amount': { editable: false } })])).toEqual({ - 'deal.amount': { readable: true, editable: false }, - }); + it('the conversion target: viewAllFields beside the bit restores the read, never the edit', () => { + for (const bits of [{ viewAllRecords: true }, { modifyAllRecords: true }]) { + const converted = { objects: { deal: { allowRead: true, allowEdit: true, ...bits, viewAllFields: true } } }; + expect(buildEffectiveFieldPermissions([converted, hider])).toEqual({ 'deal.amount': { readable: true, editable: false } }); + expect(buildEffectiveFieldPermissions([converted, lock])).toEqual({ 'deal.amount': { readable: true, editable: false } }); + } }); - it('superuserFieldVote: per field with a field name, object-wide without one', () => { - const sets = [viewAll(mask)]; - expect(superuserFieldVote(sets, 'deal', 'amount')).toBeNull(); - expect(superuserFieldVote(sets, 'deal', 'stage')).toEqual({ readable: true, editable: false }); - expect(superuserFieldVote(sets, 'deal')).toEqual({ readable: true, editable: false }); - expect(superuserFieldVote([{ objects: { deal: { modifyAllRecords: true } }, fields: mask }], 'deal', 'amount')) - .toEqual({ readable: true, editable: true }); - // The mask is read on the set that declares it, never on a sibling. - expect(superuserFieldVote([{ objects: { deal: { viewAllRecords: true } } }, { fields: mask }], 'deal', 'amount')) - .toEqual({ readable: true, editable: false }); + it('a field no set names follows the object grant, so the bits change nothing there', () => { + expect(buildEffectiveFieldPermissions([{ objects: { deal: { allowRead: true, modifyAllRecords: true } } }])).toEqual({}); }); }); -describe('[field-axis split, ruling 6912661484] viewAllFields: a read vote through the same shared vote, never an edit vote', () => { +describe('[field-axis split, ruling 6912661484] viewAllFields: a read vote, never an edit vote', () => { const hider = { objects: { deal: { allowRead: true } }, fields: { 'deal.amount': { readable: false, editable: false } } }; const reader = (objects: Record, fields?: Record) => ({ objects, fields }); it('alone it reads every field another set hides, read-only, by the object entry and by the wildcard', () => { for (const objects of [{ deal: { allowRead: true, viewAllFields: true } }, { '*': { allowRead: true, viewAllFields: true } }]) { expect(buildEffectiveFieldPermissions([reader(objects), hider])).toEqual({ 'deal.amount': { readable: true, editable: false } }); - expect(superuserFieldVote([reader(objects)], 'deal', 'amount')).toEqual({ readable: true, editable: false }); + expect(viewAllFieldsReadVote([reader(objects)], 'deal', 'amount')).toBe(true); } }); it('the set\'s own readable: false row beats its own viewAllFields; another set\'s bit still reads the field', () => { const own = reader({ deal: { allowRead: true, viewAllFields: true } }, { 'deal.amount': { readable: false, editable: false } }); expect(buildEffectiveFieldPermissions([own])).toEqual({ 'deal.amount': { readable: false, editable: false } }); - expect(superuserFieldVote([own], 'deal', 'amount')).toBeNull(); + expect(viewAllFieldsReadVote([own], 'deal', 'amount')).toBe(false); + expect(viewAllFieldsReadVote([own], 'deal', 'stage')).toBe(true); expect(buildEffectiveFieldPermissions([own, reader({ deal: { viewAllFields: true } })])) .toEqual({ 'deal.amount': { readable: true, editable: false } }); + // The mask is read on the set that declares it, never on a sibling. + expect(viewAllFieldsReadVote([reader({ deal: { viewAllFields: true } }), { fields: own.fields }], 'deal', 'amount')).toBe(true); + }); + + it('an edit lock beside it binds, and only an explicit false is a mask', () => { + const bit = { deal: { allowRead: true, allowEdit: true, viewAllFields: true } }; + expect(buildEffectiveFieldPermissions([reader(bit, { 'deal.amount': { readable: true, editable: false } })])).toEqual({ + 'deal.amount': { readable: true, editable: false }, + }); + // An unparsed row that omits `readable` is not an explicit mask: the vote stands. + expect(buildEffectiveFieldPermissions([reader(bit, { 'deal.amount': { editable: false } })])).toEqual({ + 'deal.amount': { readable: true, editable: false }, + }); }); it('an explicit entry is the set\'s whole answer: a wildcard bit does not reach an object the set names', () => { const named = reader({ '*': { viewAllFields: true }, deal: { allowRead: true } }); expect(buildEffectiveFieldPermissions([named, hider])).toEqual({ 'deal.amount': { readable: false, editable: false } }); }); - - it('beside View All or Modify All it changes nothing: those bits already cast the vote', () => { - for (const bits of [{ viewAllRecords: true }, { modifyAllRecords: true }]) { - const without = reader({ '*': { allowRead: true, ...bits } }); - const withBit = reader({ '*': { allowRead: true, ...bits, viewAllFields: true } }); - expect(buildEffectiveFieldPermissions([withBit, hider])).toEqual(buildEffectiveFieldPermissions([without, hider])); - expect(superuserFieldVote([withBit], 'deal', 'amount')).toEqual(superuserFieldVote([without], 'deal', 'amount')); - } - }); }); describe('[field-axis split, ruling 6912661484] a wildcard viewAllFields is posture-blind: it votes on a private object\'s fields and grants no object', () => { @@ -150,7 +114,7 @@ describe('[field-axis split, ruling 6912661484] a wildcard viewAllFields is post }); it('the field axis: the same wildcard still casts its read vote on the private object\'s field', () => { - expect(superuserFieldVote([wildcard], 'vault', 'pin')).toEqual({ readable: true, editable: false }); + expect(viewAllFieldsReadVote([wildcard], 'vault', 'pin')).toBe(true); // Control: without the bit the field stays hidden, so the vote below is the bit's. expect(buildEffectiveFieldPermissions([{ objects: { '*': { allowRead: true } } }, hider])).toEqual({ 'vault.pin': { readable: false, editable: false }, diff --git a/packages/lint/src/finding-user-text.test.ts b/packages/lint/src/finding-user-text.test.ts index fe21d7327d0..743f6373844 100644 --- a/packages/lint/src/finding-user-text.test.ts +++ b/packages/lint/src/finding-user-text.test.ts @@ -28,7 +28,6 @@ import { SECURITY_CROSS_SET_FIELD_REOPEN, SECURITY_MASTER_DETAIL_UNGRANTED, SECURITY_PRIVATE_NO_READSCOPE, - SECURITY_SUPERUSER_FIELD_MASK_INERT, SECURITY_UPDATE_POLICY_NO_CHECK, validateSecurityPosture, type SecurityFinding, @@ -146,7 +145,6 @@ const ADVISORY_RULES = [ SECURITY_PRIVATE_NO_READSCOPE, SECURITY_MASTER_DETAIL_UNGRANTED, SECURITY_BOOK_AUDIENCE_UNKNOWN_SET, - SECURITY_SUPERUSER_FIELD_MASK_INERT, SECURITY_CBP_MASTER_REFERENCE_HIDDEN, SECURITY_UPDATE_POLICY_NO_CHECK, SECURITY_CBP_OWNER_POLICY_WITHOUT_OPT_IN, @@ -162,7 +160,7 @@ const OMD_DETAIL_FIELDS = { const omdDetail = (extra: Record = {}) => ({ name: 'omd_obligation', label: 'Obligation', sharingModel: 'controlled_by_parent', fields: OMD_DETAIL_FIELDS, ...extra, }); -/** A field one set hides or locks, and a second set whose object-wide bit re-opens it. */ +/** A field one set hides, and a second set whose `viewAllFields` re-opens it. */ const reopenStack = (hidingRow: Record, otherDeal: Record) => ({ objects: [{ name: 'deal', label: 'Deal', sharingModel: 'private', fields: { margin: { type: 'number', label: 'Margin' } } }], permissions: [ @@ -170,8 +168,8 @@ const reopenStack = (hidingRow: Record, otherDeal: Record ({ - permissionSet: 'consultant', otherSet: 'deal_lead', field: 'deal.margin', object: 'deal', bit, reopened, +const reopenParams = () => ({ + permissionSet: 'consultant', otherSet: 'deal_lead', field: 'deal.margin', object: 'deal', }); const omdStack = (detail: Record, using: string) => ({ @@ -184,7 +182,7 @@ const omdStack = (detail: Record, using: string) => ({ /** * One stack per advisory push site, with the params each finding must carry - * (the names its sentence interpolates). Every push site of the eight rule ids + * (the names its sentence interpolates). Every push site of the seven rule ids * is reached: the two owner-policy functions, and the second one in both of * its remedy states. */ @@ -222,42 +220,6 @@ const CASES: ReadonlyArray<{ label: string; rule: string; stack: Record