Review #1 (HIGH). M1's `authz_tree` skips the group content-write capability check (`require_group_node_writes`) for a group node absent at API-request time — a to-create group whose authorization is the service create-gate. But that gate only fires when the group is STILL absent at reconcile, and the content writer performs no authz. So a group created by a racer in the window between the API check and the in-tx reconcile could have its scripts/vars written by a principal with zero rights on it (the bound-plan token doesn't save a hand-rolled request that omits `expected_token`). Close it with an in-tx content-write re-check in `apply_tree` for every group NOT structurally created/reparented by this apply: a group WE created is covered by create-RBAC (`GroupAdmin(parent)` cascades) and its uncommitted row is invisible to the pool-based authz cascade anyway, so it must not be re-checked; a pre-existing (incl. racer-created) group is committed, so its ancestry resolves and a missing cap denies. `require_group_node_writes` moves from `apply_api` onto `ApplyService` (up the existing dependency edge) so the API pre-check and the in-tx re-check share one implementation. Pinned by `tests/group_create.rs::tree_apply_denies_group_content_write_without_the_cap`. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
9.1 KiB
9.1 KiB