Commit 3ee9e6b
Authorize deferred bindings on otherwise-clean models
Follow-up to review feedback on the previous commit. Skipping the save for a
clean model and calling commitDeferred() directly bypassed the model's save
pipeline, so an actor without backend.manage_users could commit a deferred
`groups` binding on another user - group membership carries permissions, so
that was an escalation path that did not exist before.
A model with pending deferred bindings is now never skipped: committing those
bindings changes the model's relations, so it goes through the normal save and
is authorized like any other write. Only models that are genuinely inert -
existing, clean, and with nothing deferred - are passed over, which is still
the #1464 case.
Adds the negative-authorization test that was missing (it fails against the
previous commit), and uses firstOrFail() in the hydration helper for a clearer
failure mode.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent bb35547 commit 3ee9e6b
2 files changed
Lines changed: 52 additions & 7 deletions
File tree
- modules/backend
- behaviors
- tests/behaviors
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1682 | 1682 | | |
1683 | 1683 | | |
1684 | 1684 | | |
1685 | | - | |
| 1685 | + | |
1686 | 1686 | | |
1687 | 1687 | | |
1688 | | - | |
1689 | | - | |
| 1688 | + | |
| 1689 | + | |
| 1690 | + | |
| 1691 | + | |
| 1692 | + | |
1690 | 1693 | | |
1691 | 1694 | | |
1692 | 1695 | | |
1693 | 1696 | | |
1694 | 1697 | | |
1695 | 1698 | | |
1696 | | - | |
1697 | | - | |
| 1699 | + | |
| 1700 | + | |
| 1701 | + | |
| 1702 | + | |
| 1703 | + | |
1698 | 1704 | | |
1699 | 1705 | | |
1700 | 1706 | | |
1701 | 1707 | | |
1702 | 1708 | | |
1703 | 1709 | | |
1704 | 1710 | | |
| 1711 | + | |
| 1712 | + | |
| 1713 | + | |
| 1714 | + | |
| 1715 | + | |
| 1716 | + | |
| 1717 | + | |
| 1718 | + | |
| 1719 | + | |
| 1720 | + | |
| 1721 | + | |
| 1722 | + | |
| 1723 | + | |
| 1724 | + | |
| 1725 | + | |
1705 | 1726 | | |
1706 | 1727 | | |
1707 | 1728 | | |
| |||
Lines changed: 26 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
| 87 | + | |
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| |||
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
205 | | - | |
| 205 | + | |
206 | 206 | | |
207 | 207 | | |
208 | 208 | | |
| |||
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
226 | 250 | | |
0 commit comments