|
61 | 61 | * a warning. It fails closed (the recipient under-sees rather than over-sees), |
62 | 62 | * which is why it was survivable, not why it is acceptable. |
63 | 63 | * |
| 64 | + * [#25549] One arm is no longer an `error`: on a `public` anchor the runtime |
| 65 | + * admits the grant for a recipient who is an `external` member of the record's |
| 66 | + * organization (the external floor consults a share row there) and refuses the |
| 67 | + * rest, so that rule IS live for its external half. Whether a rule's audience |
| 68 | + * is external is runtime data, not metadata, so the arm reports a `warning` |
| 69 | + * saying what the rule does — "effective for external recipients only". |
| 70 | + * |
64 | 71 | * Measured before shipping: every sharing-rule condition and RLS predicate |
65 | 72 | * declared anywhere in this repo (examples, platform permission sets) lowers |
66 | 73 | * cleanly, so the gate turns nothing red that works today. |
@@ -439,10 +446,13 @@ function masterOf(obj: AnyRec): string | undefined { |
439 | 446 | * `buildReadFilter`, all three postures), the arms differ in the direction |
440 | 447 | * that decides the wording: |
441 | 448 | * |
442 | | - * - **`public` OWD** → grant refused, `buildReadFilter` returns `null`, zero |
443 | | - * share rows. Nothing is filtered, so the intended audience already reads |
444 | | - * every row — and so does everyone else. Nobody UNDER-sees; the harm is |
445 | | - * that the declaration advertises a restriction that does not exist. |
| 449 | + * - **`public` OWD** → grant refused for an internal recipient, |
| 450 | + * `buildReadFilter` returns `null` for an internal reader, zero share rows |
| 451 | + * for staff. Nothing is filtered for them, so the intended staff audience |
| 452 | + * already reads every row — and so does everyone else. Nobody UNDER-sees; |
| 453 | + * the harm is that the declaration advertises a restriction that does not |
| 454 | + * exist. An `external` recipient is admitted and its row is consulted |
| 455 | + * (#25549), which is why this arm is a `warning`. |
446 | 456 | * - **`controlled_by_parent`** → grant refused with a DIFFERENT reason |
447 | 457 | * ("share the master record instead"), and the detail's visibility comes |
448 | 458 | * from its master's path (ADR-0055), not from this rule. Here the author |
@@ -524,21 +534,26 @@ function anchorFindings( |
524 | 534 | ? `declares sharingModel 'public_read_write'` |
525 | 535 | : 'declares no sharingModel and is a system object, which resolves to public'; |
526 | 536 |
|
| 537 | + // [#25549] Advice, not a refusal: the runtime admits this rule's grants for |
| 538 | + // the recipients who are `external` members of the record's organization |
| 539 | + // (their owner_only floor consults a share row on a public object) and skips |
| 540 | + // the rest. Whether the rule's audience is external is runtime data |
| 541 | + // (`sys_member.role`), not metadata, so this door can say what the rule does |
| 542 | + // and cannot say it is wrong. |
527 | 543 | return [{ |
528 | | - severity: 'error', |
| 544 | + severity: 'warning', |
529 | 545 | rule: SHARING_RULE_OBJECT_NOT_SHAREABLE, |
530 | 546 | where, |
531 | 547 | path, |
532 | 548 | // [#22161] One verdict sentence; why a public baseline has nothing to |
533 | | - // widen, and the measured read filter, is the `os explain` entry's. |
| 549 | + // widen for staff, and the measured read filter, is the `os explain` entry's. |
534 | 550 | message: |
535 | | - `anchor object "${object}" ${declared}, so the grant is refused (SHARING_NOT_ENABLED) and the rule ` + |
536 | | - 'restricts nothing', |
537 | | - // [#22161] One remedy line naming both honest fixes; how to tell which |
| 551 | + `anchor object "${object}" ${declared}, so the rule is effective for external recipients only`, |
| 552 | + // [#22161] One remedy line naming the honest choices; how to tell which |
538 | 553 | // half is wrong, and why re-homing the rule fixes nothing, are the |
539 | 554 | // `os explain` entry's. |
540 | 555 | hint: |
541 | | - `If everyone should reach these records, delete it; if only its audience should, set "${object}"'s ` + |
| 556 | + `Keep it if its audience is external; if staff should be narrowed too, set "${object}"'s ` + |
542 | 557 | `sharingModel: 'private' or 'public_read'`, |
543 | 558 | }]; |
544 | 559 | } |
|
0 commit comments