Commit cae5f94
authored
fix(authz): grant legacy agent register principal (#325)
## Summary
- Restore legacy `/agents/register` compatibility by accepting
`principal_context` in the register request body.
- Use the request-state principal when present, otherwise fall back to
the body principal for create-check and ownership grant.
- Keep the #292 behavior where register skips authz when no resolvable
principal is provided, avoiding the unauthenticated self-register
crashloop.
- Regenerate the Agentex OpenAPI spec.
## Validation
- `uv run pytest agentex/tests/unit/api/test_agents_authz.py -q`
- `uv run ruff check agentex/src/api/routes/agents.py
agentex/src/api/schemas/agents.py
agentex/tests/unit/api/test_agents_authz.py`
- `uv run ruff format --check agentex/src/api/routes/agents.py
agentex/src/api/schemas/agents.py
agentex/tests/unit/api/test_agents_authz.py`
- `make gen-openapi`1 parent a51ed7a commit cae5f94
4 files changed
Lines changed: 32 additions & 2 deletions
File tree
- agentex
- src/api
- routes
- schemas
- tests/unit/api
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5221 | 5221 | | |
5222 | 5222 | | |
5223 | 5223 | | |
| 5224 | + | |
| 5225 | + | |
| 5226 | + | |
| 5227 | + | |
| 5228 | + | |
| 5229 | + | |
5224 | 5230 | | |
5225 | 5231 | | |
5226 | 5232 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
198 | | - | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
199 | 202 | | |
200 | 203 | | |
201 | 204 | | |
202 | 205 | | |
| 206 | + | |
203 | 207 | | |
204 | 208 | | |
205 | 209 | | |
| |||
220 | 224 | | |
221 | 225 | | |
222 | 226 | | |
| 227 | + | |
223 | 228 | | |
224 | 229 | | |
225 | 230 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
91 | 94 | | |
92 | 95 | | |
93 | 96 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
392 | 392 | | |
393 | 393 | | |
394 | 394 | | |
395 | | - | |
| 395 | + | |
396 | 396 | | |
397 | 397 | | |
398 | 398 | | |
399 | 399 | | |
400 | 400 | | |
| 401 | + | |
401 | 402 | | |
402 | 403 | | |
403 | 404 | | |
| |||
413 | 414 | | |
414 | 415 | | |
415 | 416 | | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
416 | 432 | | |
417 | 433 | | |
418 | 434 | | |
| |||
0 commit comments