Skip to content

av dast targets auth

Give a DAST scan the credentials it needs to reach pages behind a login, so the scanner tests your authenticated surface instead of stopping at the sign-in wall. There are two ways to supply them, covered below.

The binary ships as alertavuln; av is the common alias - they are interchangeable in every example.

Approach Use when Where the secret lives
ALERTAVULN_DAST_AUTH_* environment variables You run av dast scan yourself (local or CI) In your shell/CI only - never uploaded
Stored profile (av dast targets auth set) You want AlertaVuln’s hosted worker to scan on a schedule Encrypted at rest on the server, per target

Both describe the same five credential kinds - header, bearer, cookie, form, and oauth - with the caveats noted below.

For a scan you run yourself, set ALERTAVULN_DAST_AUTH_* in the environment before av dast scan. Nothing is stored server-side and no round trip is needed. If ALERTAVULN_DAST_AUTH_KIND is unset the scan runs unauthenticated, exactly as before.

Kind Required variables Optional
header ALERTAVULN_DAST_AUTH_KIND=header, ALERTAVULN_DAST_AUTH_HEADER_NAME, ALERTAVULN_DAST_AUTH_HEADER_VALUE -
bearer ALERTAVULN_DAST_AUTH_KIND=bearer, ALERTAVULN_DAST_AUTH_BEARER_TOKEN -
cookie ALERTAVULN_DAST_AUTH_KIND=cookie, ALERTAVULN_DAST_AUTH_COOKIE_NAME, ALERTAVULN_DAST_AUTH_COOKIE_VALUE -
form ALERTAVULN_DAST_AUTH_KIND=form, ALERTAVULN_DAST_AUTH_FORM_LOGIN_URL, ALERTAVULN_DAST_AUTH_FORM_USERNAME_FIELD, ALERTAVULN_DAST_AUTH_FORM_PASSWORD_FIELD, ALERTAVULN_DAST_AUTH_FORM_USERNAME, ALERTAVULN_DAST_AUTH_FORM_PASSWORD, ALERTAVULN_DAST_AUTH_FORM_LOGGED_IN_INDICATOR ALERTAVULN_DAST_AUTH_FORM_LOGGED_OUT_INDICATOR
oauth ALERTAVULN_DAST_AUTH_KIND=oauth, ALERTAVULN_DAST_AUTH_OAUTH_TOKEN_URL, ALERTAVULN_DAST_AUTH_OAUTH_CLIENT_ID, ALERTAVULN_DAST_AUTH_OAUTH_CLIENT_SECRET ALERTAVULN_DAST_AUTH_OAUTH_SCOPE

A static header the template-scanner cannot send intact is refused before the scan starts: a value containing a # or a line break, or a header longer than 65535 bytes. The error names the header, never its value.

Scan with a static header (for example an API gateway key):

Terminal window
export ALERTAVULN_DAST_AUTH_KIND=header
export ALERTAVULN_DAST_AUTH_HEADER_NAME="X-API-Key"
export ALERTAVULN_DAST_AUTH_HEADER_VALUE="<key>"
av dast scan --target https://staging.example.com

Scan with a bearer token:

Terminal window
export ALERTAVULN_DAST_AUTH_KIND=bearer
export ALERTAVULN_DAST_AUTH_BEARER_TOKEN="<token>"
av dast scan --target https://staging.example.com

Scan with an OAuth client-credentials grant (the CLI fetches a token from the token endpoint before scanning):

Terminal window
export ALERTAVULN_DAST_AUTH_KIND=oauth
export ALERTAVULN_DAST_AUTH_OAUTH_TOKEN_URL="https://id.example.com/oauth/token"
export ALERTAVULN_DAST_AUTH_OAUTH_CLIENT_ID="<client-id>"
export ALERTAVULN_DAST_AUTH_OAUTH_CLIENT_SECRET="<client-secret>"
av dast scan --target https://staging.example.com

Scan behind a login form (the web-scanner signs in before crawling):

Terminal window
export ALERTAVULN_DAST_AUTH_KIND=form
export ALERTAVULN_DAST_AUTH_FORM_LOGIN_URL="https://staging.example.com/login"
export ALERTAVULN_DAST_AUTH_FORM_USERNAME_FIELD=email
export ALERTAVULN_DAST_AUTH_FORM_PASSWORD_FIELD=password
export ALERTAVULN_DAST_AUTH_FORM_USERNAME="[email protected]"
export ALERTAVULN_DAST_AUTH_FORM_PASSWORD="<password>"
export ALERTAVULN_DAST_AUTH_FORM_LOGGED_IN_INDICATOR="Sign out"
av dast scan --target https://staging.example.com

Store an encrypted auth profile against a registered target so AlertaVuln’s hosted worker can scan it for you. The secret is encrypted at rest on the server; only the hosted worker decrypts it at scan time.

Terminal window
av dast targets auth set --project <projectId> --target <targetId> --kind <kind> --secret <value> [kind flags]
av dast targets auth clear --project <projectId> --target <targetId>

--target here is the target ID (from av dast targets), not a URL. You must be logged in (av login).

Flag Kind Description
--project all Project ID (required)
--target all Target ID (required)
--kind all header, bearer, cookie, form, or oauth (required)
--secret all The secret value: header value / bearer token / cookie value / password / client secret (required)
--header-name header Header name
--cookie-name cookie Cookie name
--login-url form Login form URL
--username-field form Username field name
--password-field form Password field name
--username form Username value
--logged-in-indicator form Text present only when logged in
--logged-out-indicator form Text present only when logged out (optional)
--token-url oauth Token endpoint
--client-id oauth Client ID
--scope oauth Scope (optional)

Store a bearer token for a target:

Terminal window
av dast targets auth set --project <projectId> --target <targetId> \
--kind bearer --secret "<token>"

Store a form-login profile (hosted worker signs in before scanning):

Terminal window
av dast targets auth set --project <projectId> --target <targetId> \
--kind form --secret "<password>" \
--login-url https://app.example.com/login \
--username-field email --password-field password \
--username [email protected] \
--logged-in-indicator "Sign out"

Remove a stored profile:

Terminal window
av dast targets auth clear --project <projectId> --target <targetId>

Credentials supplied through ALERTAVULN_DAST_AUTH_* stay in your environment - they are never uploaded with a scan’s findings. Stored profiles are encrypted at rest and only decrypted by the hosted worker at scan time, and the hosted worker hands their values to the scanner as environment variables, never on a command line. On the hosted path an oauth client secret is used once per scan, server-side, to obtain a token and is never handed to the scanner. When that exchange fails, the scan error names at most the HTTP status the token endpoint returned - the endpoint’s response is never echoed back into it. Either way, any credential the scanner sees reflected back in a response is scrubbed from finding evidence before it is uploaded or displayed, the same as every other DAST finding.