Commit dd41df3
fix(plugin-audit): ask enable.files/enable.feeds on the update verb too (#10332)
* fix(plugin-audit): ask enable.files/enable.feeds on the update verb too
Both capability gates registered on beforeInsert only, so a re-point via
UPDATE landed rows on a parent object whose declaration refuses them: a
caller who could not create a sys_attachment on a files:false object could
move an existing one onto it, and a sys_comment could be re-threaded into a
feeds-disabled object's thread. The access kits authorize the re-point
(comment-access-hooks since #4630, attachment-access-hooks since #10091) —
those are access checks; the capability half was never asked.
enable.files/enable.feeds are properties of the TARGET object, so the verb
that made a row target it does not change the answer. Register the same two
enforcement functions on beforeUpdate. Both already read only input.data, so
an absent parent_object / thread_id means "not a re-point" and returns on
the first line — a rename or body edit on a grandfathered row is untouched.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PnJHU45vPJj5UQrxe946Bx
* test(plugin-audit): pin the update-verb capability gates; re-point the #6656 no-global-pre-image assertion
The #6656 case asserted "no beforeUpdate/beforeDelete registration" by
filtering on EVENT NAME. Its own comment recorded that as a proxy: the
property it pins is the retirement of captureBefore, an UNSCOPED pre-image
reader that made hasHooksFor true system-wide and bought a prior-row read on
every update in the stack. It carved the capability gates out by noting they
are "on a single named object each" and "read no prior row" — true of the new
beforeUpdate registrations too, which the event-name filter could not express.
Filter on GLOBAL registrations instead, and add the affirmative half: each
gate is declared on beforeInsert AND beforeUpdate, scoped to one object. The
demand gate costs nothing new on these two objects — comment-access-hooks
(#4630) and attachment-access-hooks (#10091) already declare beforeUpdate
scoped to sys_comment / sys_attachment.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PnJHU45vPJj5UQrxe946Bx
* test(plugin-audit): type the engine query/update options instead of erasing them
check:query-options-erasure counts erased option bags in test code against a
shrink-only ceiling; the new file pushed the test surface 240 -> 246. These
inputs are all ON-contract (`where`, `multi`), so the gate's own remedy is to
type them, not to cast — the `as unknown as` escape names a contract being
bypassed deliberately, which is not what these do. Back to 240, at the
ceiling, none new.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PnJHU45vPJj5UQrxe946Bx
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 13f533a commit dd41df3
4 files changed
Lines changed: 535 additions & 12 deletions
File tree
- .changeset
- packages/plugins/plugin-audit/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
Lines changed: 55 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
437 | 437 | | |
438 | 438 | | |
439 | 439 | | |
440 | | - | |
| 440 | + | |
441 | 441 | | |
442 | 442 | | |
443 | 443 | | |
444 | 444 | | |
445 | 445 | | |
446 | 446 | | |
447 | 447 | | |
448 | | - | |
449 | | - | |
450 | | - | |
451 | | - | |
452 | | - | |
453 | | - | |
454 | | - | |
455 | | - | |
456 | | - | |
457 | | - | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
458 | 502 | | |
459 | 503 | | |
460 | 504 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1567 | 1567 | | |
1568 | 1568 | | |
1569 | 1569 | | |
| 1570 | + | |
| 1571 | + | |
| 1572 | + | |
| 1573 | + | |
| 1574 | + | |
| 1575 | + | |
| 1576 | + | |
| 1577 | + | |
| 1578 | + | |
| 1579 | + | |
| 1580 | + | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
1570 | 1585 | | |
1571 | 1586 | | |
1572 | 1587 | | |
| |||
1585 | 1600 | | |
1586 | 1601 | | |
1587 | 1602 | | |
| 1603 | + | |
1588 | 1604 | | |
1589 | 1605 | | |
1590 | 1606 | | |
| |||
1600 | 1616 | | |
1601 | 1617 | | |
1602 | 1618 | | |
| 1619 | + | |
| 1620 | + | |
| 1621 | + | |
| 1622 | + | |
| 1623 | + | |
| 1624 | + | |
| 1625 | + | |
| 1626 | + | |
| 1627 | + | |
1603 | 1628 | | |
1604 | 1629 | | |
1605 | 1630 | | |
1606 | 1631 | | |
1607 | | - | |
| 1632 | + | |
| 1633 | + | |
| 1634 | + | |
| 1635 | + | |
| 1636 | + | |
| 1637 | + | |
| 1638 | + | |
1608 | 1639 | | |
1609 | 1640 | | |
1610 | 1641 | | |
| |||
1615 | 1646 | | |
1616 | 1647 | | |
1617 | 1648 | | |
| 1649 | + | |
| 1650 | + | |
| 1651 | + | |
| 1652 | + | |
| 1653 | + | |
| 1654 | + | |
| 1655 | + | |
| 1656 | + | |
| 1657 | + | |
| 1658 | + | |
| 1659 | + | |
| 1660 | + | |
| 1661 | + | |
| 1662 | + | |
| 1663 | + | |
| 1664 | + | |
| 1665 | + | |
| 1666 | + | |
| 1667 | + | |
| 1668 | + | |
| 1669 | + | |
| 1670 | + | |
| 1671 | + | |
1618 | 1672 | | |
1619 | 1673 | | |
1620 | 1674 | | |
| |||
0 commit comments