Commit 128684d
fix(runtime): gate the /automation definition writes on manage_metadata (#10242)
* fix(runtime): gate the /automation definition writes on manage_metadata (#10145)
POST /automation, PUT /automation/:name and DELETE /automation/:name
registered without any capability check, so any authenticated caller could
author, modify and deregister flow definitions. Flow metadata is registered at
environment scope, not organization scope, so on a walled multi-organization
deployment the write crossed the tenant wall: a plain tenant org owner holding
organization_admin (and answered 403 by /meta, /ai/tools and /packages) deleted
a shipped flow that then read 404 for the actor, for an unrelated tenant and for
the platform admin.
The three definition writes now demand `manage_metadata` — ADR-0066 D1's
authoring capability, the same key `PUT /meta/:type/:name` and every
state-changing `/packages` route already carry. One predicate
(`isFlowAuthoringWrite`), placed with the domain's anonymous floor and run-state
read gate and ahead of both the service probe and body validation, so a refused
caller writes nothing and cannot fingerprint whether automation is mounted.
Execution routes are deliberately out of the write set: trigger (both shapes)
and resume run flows rather than author them — resume is already fail-closed on
resumeAuthority — and toggle mutates engine enablement, filed separately rather
than folded into a security fix.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019bmVFqoQPq63zhKrxdYG1r
* test(runtime): the handlerReady stub-slot row drives POST /automation as an author (#10145)
The `POST /` row of the #4058 stub-slot pin is a definition write, so the
manage_metadata gate — which sits ahead of the service probe on purpose —
answers it 403 before the 501 that row exists to pin. The caller is per row now:
the write row authors, the execution rows keep the ordinary caller. Every
assertion is unchanged.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019bmVFqoQPq63zhKrxdYG1r
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 279188a commit 128684d
7 files changed
Lines changed: 568 additions & 8 deletions
| 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 | + | |
| 20 | + | |
Lines changed: 16 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
46 | 61 | | |
47 | 62 | | |
48 | 63 | | |
| |||
Lines changed: 16 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
110 | | - | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
111 | 126 | | |
112 | 127 | | |
113 | 128 | | |
| |||
Lines changed: 16 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
142 | | - | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
143 | 158 | | |
144 | 159 | | |
145 | 160 | | |
| |||
0 commit comments