Features
Login Sessions
Authenticated checks need a logged-in identity. Instead of copying JWTs and cookies by hand, DeployReady can save a browser session and turn it into request headers.
Record a session by hand: auth record#
deployready auth record alice --url http://localhost:3000/loginA visible Chromium window opens. Log in (SSO, MFA and CAPTCHA are fine here), return to the terminal, and press Enter. The session is saved under the name you gave. This needs a desktop display, so run it on your own machine, not on a headless server or in CI. It needs Playwright, an optional peer dependency:
npm i playwright && npx playwright install chromium| Option | Description |
|---|---|
--url <loginUrl> | Login page URL (loopback, or a host you own). |
--i-own-this-target <host> | Confirm you own a non-loopback host. Repeatable and comma-separated. |
--root <dir> | Project root that holds .deployready/ (default: the current directory). |
Scripted login for test accounts: auth login#
export ALICE_USER=test@example.com ALICE_PASS=...
deployready auth login alice --url http://localhost:3000/login \
--username-env ALICE_USER --password-env ALICE_PASS \
--username-selector 'css' --password-selector 'css' --submit-selector 'css'Credentials come only from environment variables, never from flags. Without selectors, DeployReady looks for a text or email field, a password field, and a submit button, submits, and waits for navigation. If it meets a CAPTCHA or an MFA prompt it stops and tells you to use auth record instead.
| Option | Description |
|---|---|
--url <loginUrl> | Login page URL (loopback, or a host you own). |
--username-env <VAR> | Environment variable holding the username. |
--password-env <VAR> | Environment variable holding the password. |
--username-selector <css> | CSS selector of the username field. |
--password-selector <css> | CSS selector of the password field. |
--submit-selector <css> | CSS selector of the submit button. |
--i-own-this-target <host> | Confirm you own a non-loopback host. Repeatable and comma-separated. |
--root <dir> | Project root that holds .deployready/ (default: the current directory). |
Use a session in an identity#
Point an identity at the saved name with session in .deployready.json. The authorization matrixthen sends that user's cookies and bearer token to the scan target, and only there.
{
"active": {
"identities": [
{ "name": "alice", "role": "user", "tenant": "acme", "session": "alice",
"objects": { "invoices": { "id": "inv_a" } } },
{ "name": "bob", "role": "user", "tenant": "acme", "session": "bob" }
]
}
}What is sent#
Cookie: unexpired cookies that apply to the target. Secure cookies are sent only over https or loopback.Authorization: Bearer <jwt>when a JWT is found in localStorage or sessionStorage of that origin: Supabasesb-*-auth-tokenJSON (access_token), or keys such astoken,accessToken, orjwt. NextAuth session cookies stay cookies.- Expiry is detected: an expired JWT
exp, or cookies that have all expired, raisesession expired - re-run auth record/login. The identity then shows as untested in the matrix with that reason.
Safety#
- Login URLs and the scan target must be loopback, or a host you own, confirmed with --i-own-this-target <host>. The rule is the same as for the active suite: exact hosts, no wildcards.
- Credentials are produced for the declared target origin only. A session recorded for another origin is refused.
- Passwords for auth login come from environment variables only, so they do not end up in shell history.
- A saved session is not read by --dry-run. The plan is printed without loading it.
- Playwright is not installed for you. It is an optional peer dependency, needed only for auth record and auth login.
Notes#
Sessions expire. Re-run auth record or auth login when a scan reports expiry. To delete a session, remove its file from .deployready/sessions/. Other session providers can be plugged in through the source (registerSessionProvider); the built-in one uses Playwright.