Part 1 of #1006: the mechanism and the CI gate, with the DAST routes described.
Problem: the agent's API has no machine-readable description, so DAST cannot seed a scan of our own agent from a spec (#997), and integrators have nothing to generate a client from.
Change:
Generated, not hand-written: utoipa 6 + utoipa-axum 0.3 (axum ^0.8.4; the lock has 0.8.8). build_router registers described routes through routes!. Each route's path, method, parameters and body come from the handler's #[utoipa::path], so route and description cannot drift.
Served at GET /api/v1/openapi.json as OpenAPI 3.1.
It sits under the API prefix, so the customer authentication covers it (bypasses_customer_auth is false, and a test checks that).
It is one of the paths the DAST spec parser tries (common_spec_paths), and not one the API fuzzer's discovery_paths reports as an exposed resource. /api/openapi.json would be: the spec's field names (password, token) match the fuzzer's secret patterns and would make it a Critical finding on a logged-in scan of our own agent.
Auth: a bearer security scheme, put on every operation except the public ones. The DAST spec parser reads only operation-level security.
Described so far: the six DAST routes.
{id} path parameters and the page/limit query parameters (PaginationParams derives IntoParams, with its bounds).
The add-target request body (AddTargetRequest derives ToSchema). Its core types (DastTargetType, DastAuthConfig) are given as string / object, so compliance-core, which the dashboard's web build also compiles, needs no utoipa derive yet.
Response bodies are not described yet; the issue's acceptance asks for routes, parameters and auth.
CI gate (every_route_is_described_or_listed_as_not_yet): a plain route call in routes.rs that is not in api/undescribed_routes.txt fails the test, and so does a line there that names no such route. The list holds the other 101 paths and only shrinks: describing a route deletes its line.
Out of scope: the admin, Werkbank-runner and platform routers (server.rs). They have their own static-token auth and are not the customer API.
Docs: a note in the API-keys guide.
Tests:
unit: the gate. The DAST operations carry bearer security, {id} path and page/limit query parameters, and a JSON body. The document is OpenAPI 3.1, and the spec path is not a public one.
integration (e2e): the running agent serves the document as JSON.
Locally: all agent test binaries against Mongo 7 (37 pass), clippy with CI's flags, fmt, and cargo audit (exit 0, the same 12 allowed warnings as main).
Open:
API keys: no scope covers the new route, so an API key gets 403 scope_missing for the document. A signed-in person can read it.
Acceptance: the "#997 point 1 seeding picks it up" half of #1006's acceptance cannot be run yet: that seeding is not built (handed over, design in #997).
Next PRs: describe the remaining routes group by group, shrinking the list until it is gone.
Part 1 of #1006: the mechanism and the CI gate, with the DAST routes described.
**Problem:** the agent's API has no machine-readable description, so DAST cannot seed a scan of our own agent from a spec (#997), and integrators have nothing to generate a client from.
**Change:**
- **Generated, not hand-written:** utoipa 6 + utoipa-axum 0.3 (axum ^0.8.4; the lock has 0.8.8). `build_router` registers described routes through `routes!`. Each route's path, method, parameters and body come from the handler's `#[utoipa::path]`, so route and description cannot drift.
- **Served at `GET /api/v1/openapi.json`** as OpenAPI 3.1.
- It sits under the API prefix, so the customer authentication covers it (`bypasses_customer_auth` is false, and a test checks that).
- It is one of the paths the DAST spec parser tries (`common_spec_paths`), and not one the API fuzzer's `discovery_paths` reports as an exposed resource. `/api/openapi.json` would be: the spec's field names (`password`, `token`) match the fuzzer's secret patterns and would make it a Critical finding on a logged-in scan of our own agent.
- **Auth:** a `bearer` security scheme, put on every operation except the public ones. The DAST spec parser reads only operation-level `security`.
- **Described so far:** the six DAST routes.
- `{id}` path parameters and the `page`/`limit` query parameters (`PaginationParams` derives `IntoParams`, with its bounds).
- The add-target request body (`AddTargetRequest` derives `ToSchema`). Its core types (`DastTargetType`, `DastAuthConfig`) are given as string / object, so `compliance-core`, which the dashboard's web build also compiles, needs no utoipa derive yet.
- Response bodies are not described yet; the issue's acceptance asks for routes, parameters and auth.
- **CI gate** (`every_route_is_described_or_listed_as_not_yet`): a plain route call in `routes.rs` that is not in `api/undescribed_routes.txt` fails the test, and so does a line there that names no such route. The list holds the other 101 paths and only shrinks: describing a route deletes its line.
- **Out of scope:** the admin, Werkbank-runner and platform routers (`server.rs`). They have their own static-token auth and are not the customer API.
- **Docs:** a note in the API-keys guide.
**Tests:**
- unit: the gate. The DAST operations carry bearer security, `{id}` path and `page`/`limit` query parameters, and a JSON body. The document is OpenAPI 3.1, and the spec path is not a public one.
- integration (`e2e`): the running agent serves the document as JSON.
- Locally: all agent test binaries against Mongo 7 (37 pass), clippy with CI's flags, fmt, and `cargo audit` (exit 0, the same 12 allowed warnings as main).
**Open:**
- **API keys:** no scope covers the new route, so an API key gets `403 scope_missing` for the document. A signed-in person can read it.
- **Acceptance:** the "#997 point 1 seeding picks it up" half of #1006's acceptance cannot be run yet: that seeding is not built (handed over, design in #997).
- **Next PRs:** describe the remaining routes group by group, shrinking the list until it is gone.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9
The agent's API had no machine-readable description, so DAST could not
seed a scan of it from a spec (#997) and integrators had nothing to
generate a client from.
- utoipa 6 + utoipa-axum 0.3: `build_router` registers described routes
with `routes!`, which takes each route's path, method, parameters and
body from the handler's `#[utoipa::path]`, so the two cannot drift.
- `GET /api/v1/openapi.json` serves the document (OpenAPI 3.1). It sits
under the API prefix, so the customer authentication covers it, and it
is one of the paths the DAST spec parser tries and not one the API
fuzzer flags as exposed.
- A bearer scheme, set on every operation except the public ones: the
DAST spec parser reads operation-level `security` only.
- Described so far: the six DAST routes, with path and pagination
parameters and the add-target body (core types stay opaque, so core
needs no schema derive yet). Response bodies are not described yet.
- CI gate: a test fails when a plain route call in `routes.rs` is not in
`undescribed_routes.txt`, or the file names a route that is gone. The
list (101 paths) only shrinks; describing a route deletes its line.
- Docs: the description in the API-keys guide.
Tests:
- unit: the gate; the DAST operations carry bearer security, `{id}` path
and `page`/`limit` query parameters and a JSON body; OpenAPI 3.1; the
spec path is not a public one;
- integration: the running agent serves the document as JSON.
Part 1 of #1006. API keys cannot read the document yet: no key scope
covers it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9
sharang
merged commit 32332f65bb into main2026-11-16 13:10:27 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Part 1 of #1006: the mechanism and the CI gate, with the DAST routes described.
Problem: the agent's API has no machine-readable description, so DAST cannot seed a scan of our own agent from a spec (#997), and integrators have nothing to generate a client from.
Change:
build_routerregisters described routes throughroutes!. Each route's path, method, parameters and body come from the handler's#[utoipa::path], so route and description cannot drift.GET /api/v1/openapi.jsonas OpenAPI 3.1.bypasses_customer_authis false, and a test checks that).common_spec_paths), and not one the API fuzzer'sdiscovery_pathsreports as an exposed resource./api/openapi.jsonwould be: the spec's field names (password,token) match the fuzzer's secret patterns and would make it a Critical finding on a logged-in scan of our own agent.bearersecurity scheme, put on every operation except the public ones. The DAST spec parser reads only operation-levelsecurity.{id}path parameters and thepage/limitquery parameters (PaginationParamsderivesIntoParams, with its bounds).AddTargetRequestderivesToSchema). Its core types (DastTargetType,DastAuthConfig) are given as string / object, socompliance-core, which the dashboard's web build also compiles, needs no utoipa derive yet.every_route_is_described_or_listed_as_not_yet): a plain route call inroutes.rsthat is not inapi/undescribed_routes.txtfails the test, and so does a line there that names no such route. The list holds the other 101 paths and only shrinks: describing a route deletes its line.server.rs). They have their own static-token auth and are not the customer API.Tests:
{id}path andpage/limitquery parameters, and a JSON body. The document is OpenAPI 3.1, and the spec path is not a public one.e2e): the running agent serves the document as JSON.cargo audit(exit 0, the same 12 allowed warnings as main).Open:
403 scope_missingfor the document. A signed-in person can read it.🤖 Generated with Claude Code
https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9