- Notifications
You must be signed in to change notification settings - Fork1k
Commited90ecf
authored
feat: add allow_list to resource-scoped API tokens (#19964)
# Add API key allow_list for resource-scoped tokensThis PR adds support for API key allow lists, enabling tokens to be scoped to specific resources. The implementation:1. Adds a new `allow_list` field to the `CreateTokenRequest` struct, allowing clients to specify resource-specific scopes when creating API tokens2. Implements `APIAllowListTarget` type to represent resource targets in the format `<type>:<id>` with support for wildcards3. Adds validation and normalization logic for allow lists to handle wildcards and deduplication4. Integrates with RBAC by creating an `APIKeyEffectiveScope` that merges API key scopes with allow list restrictions5. Updates API documentation and TypeScript types to reflect the new functionalityThis feature enables creating tokens that are limited to specific resources (like workspaces or templates) by ID, making it possible to create more granular API tokens with limited access.1 parentf31e6e0 commited90ecf
File tree
25 files changed
+930
-94
lines changed- coderd
- apidoc
- apikey
- coderdtest
- database
- dbauthz
- dbgen
- httpmw
- rbac
- codersdk
- docs/reference/api
- scripts/apitypings
- site/src/api
25 files changed
+930
-94
lines changedSome generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
116 | 116 |
| |
117 | 117 |
| |
118 | 118 |
| |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
119 | 150 |
| |
120 | 151 |
| |
121 | 152 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| 15 | + | |
15 | 16 |
| |
16 | 17 |
| |
17 | 18 |
| |
| |||
34 | 35 |
| |
35 | 36 |
| |
36 | 37 |
| |
| 38 | + | |
| 39 | + | |
| 40 | + | |
37 | 41 |
| |
38 | 42 |
| |
39 | 43 |
| |
| |||
61 | 65 |
| |
62 | 66 |
| |
63 | 67 |
| |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
64 | 72 |
| |
65 | 73 |
| |
66 | 74 |
| |
| |||
115 | 123 |
| |
116 | 124 |
| |
117 | 125 |
| |
118 |
| - | |
| 126 | + | |
119 | 127 |
| |
120 | 128 |
| |
121 | 129 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
68 | 68 |
| |
69 | 69 |
| |
70 | 70 |
| |
71 |
| - | |
| 71 | + | |
72 | 72 |
| |
73 | 73 |
| |
74 | 74 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
225 | 225 |
| |
226 | 226 |
| |
227 | 227 |
| |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
228 | 232 |
| |
229 | 233 |
| |
230 | 234 |
| |
231 | 235 |
| |
232 | 236 |
| |
233 | 237 |
| |
234 | 238 |
| |
235 |
| - | |
236 |
| - | |
237 |
| - | |
238 |
| - | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
239 | 242 |
| |
240 | 243 |
| |
241 | 244 |
| |
| |||
247 | 250 |
| |
248 | 251 |
| |
249 | 252 |
| |
250 |
| - | |
| 253 | + | |
| 254 | + | |
251 | 255 |
| |
252 | 256 |
| |
253 | 257 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
27 | 27 |
| |
28 | 28 |
| |
29 | 29 |
| |
| 30 | + | |
30 | 31 |
| |
31 | 32 |
| |
32 | 33 |
| |
| |||
186 | 187 |
| |
187 | 188 |
| |
188 | 189 |
| |
189 |
| - | |
| 190 | + | |
190 | 191 |
| |
191 | 192 |
| |
192 | 193 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
145 | 145 |
| |
146 | 146 |
| |
147 | 147 |
| |
148 |
| - | |
149 |
| - | |
150 |
| - | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
151 | 151 |
| |
152 | 152 |
| |
153 |
| - | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
154 | 158 |
| |
155 | 159 |
| |
156 | 160 |
| |
157 | 161 |
| |
158 | 162 |
| |
159 | 163 |
| |
160 |
| - | |
161 |
| - | |
162 |
| - | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
163 | 169 |
| |
164 | 170 |
| |
165 |
| - | |
| 171 | + | |
166 | 172 |
| |
167 | 173 |
| |
168 | 174 |
| |
| |||
174 | 180 |
| |
175 | 181 |
| |
176 | 182 |
| |
177 |
| - | |
178 |
| - | |
179 |
| - | |
| 183 | + | |
| 184 | + | |
180 | 185 |
| |
181 | 186 |
| |
182 | 187 |
| |
| |||
191 | 196 |
| |
192 | 197 |
| |
193 | 198 |
| |
194 |
| - | |
195 |
| - | |
196 |
| - | |
197 |
| - | |
198 |
| - | |
199 |
| - | |
200 |
| - | |
201 |
| - | |
202 |
| - | |
203 |
| - | |
| 199 | + | |
204 | 200 |
| |
205 | 201 |
| |
206 | 202 |
| |
| |||
210 | 206 |
| |
211 | 207 |
| |
212 | 208 |
| |
213 |
| - | |
214 |
| - | |
215 |
| - | |
216 |
| - | |
217 |
| - | |
218 |
| - | |
219 |
| - | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
220 | 212 |
| |
| 213 | + | |
221 | 214 |
| |
222 | 215 |
| |
223 | 216 |
| |
| |||
235 | 228 |
| |
236 | 229 |
| |
237 | 230 |
| |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
238 | 262 |
| |
239 | 263 |
| |
240 | 264 |
| |
|
0 commit comments
Comments
(0)