feat(dast): scans log in with the target's credentials (#1000)
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Agent integration (pull_request) Successful in 4m37s
CI / Check (pull_request) Successful in 20m29s
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Agent integration (pull_request) Successful in 4m37s
CI / Check (pull_request) Successful in 20m29s
Part 1 of #1000: the header logins. A target's DastAuthConfig was stored but never read, so every DAST request went out unauthenticated and a scan of anything behind a login tested only the login page. - compliance-dast::auth turns basic, bearer and cookie logins plus extra headers into sensitive default headers of a per-scan client; recon, crawler and the agents use it, the auth-bypass agent asks as a stranger. A login that cannot be sent (form login, a missing secret, an unknown method) fails the scan with the reason. - POST /api/v1/dast/targets takes an `auth` block, refuses a login the scan could not send, stores it sealed (header values too, via the new Credentials::credential_maps_mut) and returns the target with its id. Scans open the stored secrets in memory only. - The wizard's basic login lands in the password, not the token. - The crawler keeps forms to the target's origin (scheme, host, port), so payloads and the login never go to another site. - The auth-bypass agent sends PUT/PATCH/DELETE only with destructive tests allowed (it sent them always and reported its own success). - CI lints the compliance-dast library and runs its tests. Form and Keycloak login follow in part 2. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9
This commit is contained in:
1 parent
fad023e734
commit
6cc4ab67bb
16 files changed
+684
-38
No files matched your search
+14
-8
@@ -39,15 +39,21 @@ Each target supports these settings:
|
||||
|
||||
### Authentication
|
||||
|
||||
DAST supports authenticated scanning so it can test pages behind login:
|
||||
A scan can log in, so it reaches the pages and API routes behind a login. Every request of the crawl and of the tests carries the login. The exception is the authentication-bypass checks, which ask as a stranger on purpose.
|
||||
|
||||
| Method | Description |
|
||||
|--------|------------|
|
||||
| **None** | No authentication |
|
||||
| **Basic** | HTTP Basic Auth with username and password |
|
||||
| **Bearer** | Bearer token in the Authorization header |
|
||||
| **Cookie** | Session cookie value |
|
||||
| **Form** | Login form with URL, field names, and credentials |
|
||||
| Method | What is sent | Fields |
|
||||
|--------|--------------|--------|
|
||||
| **None** | nothing | – |
|
||||
| **Basic** | `Authorization: Basic …` | `username`, `password` |
|
||||
| **Bearer** | `Authorization: Bearer …` | `token` |
|
||||
| **Cookie** | `Cookie: …` | `token` (e.g. `session=abc123`) |
|
||||
| **Form** | not available yet: logging in through a login page (incl. Keycloak) is the next step | – |
|
||||
|
||||
Every method can add extra headers (`headers`, e.g. an API key). The password, the token and the header values are stored encrypted and never returned by the API.
|
||||
|
||||
A login that cannot be sent fails the scan with the reason ("Login: …"); the scan never runs without the login instead. Through the API, the login goes in the `auth` block of `POST /api/v1/dast/targets`, and the answer returns the new target with its id.
|
||||
|
||||
The scan stays on the target's origin (scheme, host and port): links and forms that lead elsewhere are not followed. Write requests (`PUT`, `PATCH`, `DELETE`) are sent only when **Destructive Tests** is on.
|
||||
|
||||
::: warning
|
||||
Authenticated scans access more of the application surface. Only test applications you own or have explicit authorization to test.
|
||||
|
||||
Reference in new issue
Block a user