DAST finds the API routes and client-rendered pages of a single-page app #997

Open
opened 2026-11-14 09:47:24 +00:00 by sharang · 1 comment
Owner

Part of the DAST/pentest dogfooding work.

Problem: the crawler (compliance-dast/src/crawler) follows links in the HTML the server sends (scraper). On our own services:

  • Agent API: 1 endpoint found (the base URL). It never sees the API routes, so the injection, XSS, SSRF and fuzzing agents have nothing to test.
  • Dashboard (Dioxus): only the links in the server-rendered shell; no parameters, no forms, nothing the client renders.
  • False positives:
    • auth-bypass compares status codes only; a single-page app answers 200 on every route;
    • robots.txt with Disallow: / is reported as a Medium "sensitive resource".

Change:

  1. API endpoints from a spec: seed them from an OpenAPI document when the target has one (URL in the target settings, or well-known paths); openapi_parser already exists in the pentest tools.
  2. Browser crawl: crawl through the browser for web apps (render, then collect links, forms and the XHR/fetch requests the page makes) on top of the HTML crawl.
  3. Auth bypass: compare the unauthenticated response with the authenticated one (body/redirect/JSON shape), not just status 200.
  4. robots.txt: info at most, and only when it names paths that are reachable and sensitive.

Acceptance: against a local agent with its API described, the crawl finds the API routes. Against the dashboard it finds the client-rendered pages and forms. Neither produces an auth-bypass or robots.txt finding.

Part of the DAST/pentest dogfooding work. **Problem:** the crawler (`compliance-dast/src/crawler`) follows links in the HTML the server sends (`scraper`). On our own services: - **Agent API:** 1 endpoint found (the base URL). It never sees the API routes, so the injection, XSS, SSRF and fuzzing agents have nothing to test. - **Dashboard (Dioxus):** only the links in the server-rendered shell; no parameters, no forms, nothing the client renders. - **False positives:** - auth-bypass compares status codes only; a single-page app answers 200 on every route; - `robots.txt` with `Disallow: /` is reported as a Medium "sensitive resource". **Change:** 1. **API endpoints from a spec:** seed them from an OpenAPI document when the target has one (URL in the target settings, or well-known paths); `openapi_parser` already exists in the pentest tools. 2. **Browser crawl:** crawl through the browser for web apps (render, then collect links, forms and the XHR/fetch requests the page makes) on top of the HTML crawl. 3. **Auth bypass:** compare the unauthenticated response with the authenticated one (body/redirect/JSON shape), not just status 200. 4. **robots.txt:** info at most, and only when it names paths that are reachable and sensitive. **Acceptance:** against a local agent with its API described, the crawl finds the API routes. Against the dashboard it finds the client-rendered pages and forms. Neither produces an auth-bypass or robots.txt finding.
Author
Owner

Status: point 4 (robots.txt) is done in #1005, on stage. Points 1–3 are open for someone to pick up.

Point 1 (API endpoints from a spec): suggested design, not started

  • DastTarget gets an optional openapi_url, set through POST /api/v1/dast/targets (and the target's web settings, if the pipeline should provision it). The URL is checked with NetGuard::check_url like the base URL.
  • No URL: try the well-known paths on the target's origin. The list is in compliance-dast/src/tools/openapi_parser.rs (common_spec_paths).
  • Reuse OpenApiParserTool::parse_spec (make it pub(crate)) instead of a second parser. JSON only; YAML needs a dependency.
  • Each operation becomes a DiscoveredEndpoint on the target's origin:
    • servers[0].url / basePath are joined onto the base URL, and anything that ends up on another origin is dropped;
    • path parameters get a placeholder value;
    • requires_auth comes from the operation's security.
  • PUT/PATCH/DELETE operations only when the target allows destructive tests.
  • The scan adds them to the crawl's endpoints, without duplicates, so endpoints_discovered counts both.
  • Test: a fake site serving a small spec. Its routes show up as endpoints, and an operation on another server does not.

Acceptance needs a spec of our own: our agent does not publish an OpenAPI description, so "against a local agent with its API described" cannot be run yet. Follow-up: #1006.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9

**Status:** point 4 (robots.txt) is done in #1005, on stage. Points 1–3 are open for someone to pick up. **Point 1 (API endpoints from a spec): suggested design, not started** - `DastTarget` gets an optional `openapi_url`, set through `POST /api/v1/dast/targets` (and the target's web settings, if the pipeline should provision it). The URL is checked with `NetGuard::check_url` like the base URL. - No URL: try the well-known paths on the target's origin. The list is in `compliance-dast/src/tools/openapi_parser.rs` (`common_spec_paths`). - Reuse `OpenApiParserTool::parse_spec` (make it `pub(crate)`) instead of a second parser. JSON only; YAML needs a dependency. - Each operation becomes a `DiscoveredEndpoint` on the target's origin: - `servers[0].url` / `basePath` are joined onto the base URL, and anything that ends up on another origin is dropped; - path parameters get a placeholder value; - `requires_auth` comes from the operation's `security`. - `PUT`/`PATCH`/`DELETE` operations only when the target allows destructive tests. - The scan adds them to the crawl's endpoints, without duplicates, so `endpoints_discovered` counts both. - Test: a fake site serving a small spec. Its routes show up as endpoints, and an operation on another server does not. **Acceptance needs a spec of our own:** our agent does not publish an OpenAPI description, so "against a local agent with its API described" cannot be run yet. Follow-up: #1006. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: platform/pruefwerk#997