DAST scans log in with the target's credentials (Basic, Bearer, Cookie, Keycloak form) #1000

Open
opened 2026-11-14 09:47:31 +00:00 by sharang · 0 comments
Owner

Part of the DAST/pentest dogfooding work. Everything we run (dashboard, agent API, MCP) is behind Keycloak or a token, so without this DAST tests only the login page.

Problem:

  • DastTarget.auth_config is stored, but nothing in compliance-dast reads it; every request goes out unauthenticated.
  • ensure_dast_target (orchestrator) copies the wizard's login without the password.
  • POST /api/v1/dast/targets has no auth field, and its response does not return the new target's id.
  • The DAST docs claim Basic/Bearer/Cookie/Form logins work.

Change:

  1. Build one authenticated reqwest::Client per scan from the target's login and hand it to the crawler and every agent (Basic, Bearer, Cookie, custom headers).
  2. Form/OIDC login (Keycloak authorization-code flow incl. redirects and required actions) through the browser. Carry the resulting session cookie into the HTTP client and re-login on 401.
  3. The secret comes from the sealed target credential, never a plaintext copy in dast_targets.
  4. The add-target API takes an auth block (write-only, never returned) and returns the created target with its id.
  5. Docs: describe what actually works.

Acceptance:

  • Against a local agent+dashboard with Keycloak, an authenticated scan reaches pages and API routes that an unauthenticated one gets 401/302 on.
  • No secret appears in logs, scan runs or API responses.
Part of the DAST/pentest dogfooding work. Everything we run (dashboard, agent API, MCP) is behind Keycloak or a token, so without this DAST tests only the login page. **Problem:** - `DastTarget.auth_config` is stored, but nothing in `compliance-dast` reads it; every request goes out unauthenticated. - `ensure_dast_target` (orchestrator) copies the wizard's login without the password. - `POST /api/v1/dast/targets` has no auth field, and its response does not return the new target's id. - The DAST docs claim Basic/Bearer/Cookie/Form logins work. **Change:** 1. Build one authenticated `reqwest::Client` per scan from the target's login and hand it to the crawler and every agent (Basic, Bearer, Cookie, custom headers). 2. Form/OIDC login (Keycloak authorization-code flow incl. redirects and required actions) through the browser. Carry the resulting session cookie into the HTTP client and re-login on 401. 3. The secret comes from the sealed target credential, never a plaintext copy in `dast_targets`. 4. The add-target API takes an auth block (write-only, never returned) and returns the created target with its id. 5. Docs: describe what actually works. **Acceptance:** - Against a local agent+dashboard with Keycloak, an authenticated scan reaches pages and API routes that an unauthenticated one gets 401/302 on. - No secret appears in logs, scan runs or API responses.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: platform/pruefwerk#1000