Commit 52200b4
`sys_api_key` declared two row actions — `revoke_api_key` / `restore_api_key`
— as `PATCH /api/v1/data/sys_api_key/{id}` with `bodyExtra: {revoked}`, while
the same object set `enable.apiMethods = ['get','list']`. The declared PATCH
died at the ADR-0049 method gate with 405 before any authorization ran, so no
product route revoked an API key: the Setup UI's Revoke button errored, the row
kept `revoked = false`, and the key kept authenticating.
The write path had two gates, not one:
- the method gate — `enable.apiMethods` now carries `update` (`create` /
`delete` stay off: minting is `POST /api/v1/keys`, and keys are retired by
revoking rather than deleting);
- ADR-0103's `reconcileManagedApiMethods`, which strips any write verb a
`managedBy` object's affordances do not grant and only warns. `apiMethods`
alone would still have served 405 while the source read correctly, so
`userActions: { edit: true }` declares the affordance — the ADR-0092 D4
pattern `sys_user` already uses.
Opening the method does not open the columns. The object stays
`managedBy: 'better-auth'`, so ADR-0092 D2's identity write guard still
fail-closed rejects user-context writes and its per-object update whitelist
stays the only opening; `revoked` is registered there and nothing else is. The
guard itself is untouched — no general weakening, and every other identity
table keeps its default-deny. Per D4's form-rendering constraint the columns
outside the whitelist are now `readonly`, so the edit form this affordance
turns on cannot offer a write the server refuses.
Nothing pinned any of this: the existing tests exercise key resolution against
a pre-revoked row and never call the route the actions declare. The new
dogfood suite drives the real PATCH, asserts 200, then asserts the consequence
— the key stops authenticating — and pins the refusals with code AND status.
Claude-Session: https://claude.ai/code/session_01SqARTSYRvgutYHaLXbx6f7
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 2701e95 commit 52200b4
5 files changed
Lines changed: 356 additions & 5 deletions
File tree
- .changeset
- packages
- platform-objects/src/identity
- plugins/plugin-auth/src
- qa/dogfood/test
- scripts/adr-anchors
| 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 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
Lines changed: 48 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
23 | 39 | | |
24 | 40 | | |
25 | 41 | | |
| |||
36 | 52 | | |
37 | 53 | | |
38 | 54 | | |
39 | | - | |
40 | | - | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
41 | 58 | | |
42 | 59 | | |
43 | 60 | | |
| |||
117 | 134 | | |
118 | 135 | | |
119 | 136 | | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
120 | 143 | | |
121 | 144 | | |
122 | 145 | | |
| 146 | + | |
123 | 147 | | |
124 | 148 | | |
125 | 149 | | |
| |||
129 | 153 | | |
130 | 154 | | |
131 | 155 | | |
| 156 | + | |
132 | 157 | | |
133 | 158 | | |
134 | 159 | | |
| |||
137 | 162 | | |
138 | 163 | | |
139 | 164 | | |
| 165 | + | |
140 | 166 | | |
141 | 167 | | |
142 | 168 | | |
| |||
145 | 171 | | |
146 | 172 | | |
147 | 173 | | |
| 174 | + | |
148 | 175 | | |
149 | 176 | | |
150 | 177 | | |
| |||
153 | 180 | | |
154 | 181 | | |
155 | 182 | | |
| 183 | + | |
156 | 184 | | |
157 | 185 | | |
158 | 186 | | |
| |||
214 | 242 | | |
215 | 243 | | |
216 | 244 | | |
217 | | - | |
218 | | - | |
219 | | - | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
220 | 263 | | |
221 | 264 | | |
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
61 | 70 | | |
62 | 71 | | |
63 | 72 | | |
| |||
86 | 95 | | |
87 | 96 | | |
88 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
89 | 109 | | |
90 | 110 | | |
91 | 111 | | |
| |||
0 commit comments