Devtools security
The production monitor shows real data from a running app, so every layer assumes the one before it can fail. This page explains the layers. To set it up, see Devtools in production.
What a request goes through
Section titled “What a request goes through”Every request under the dashboard path passes these checks in order. The first one that fails ends it.
- Production mode. In development the loopback guard applies instead, unchanged.
- Open state. If an admin disabled the dashboard, or it is locked after too many failed sign-ins, it answers 404.
- HTTPS. With
requireHttps(the default), a request that did not arrive over HTTPS answers 404. - Allowed IPs. When
allowedIpsis set, other clients get 404. - Route access. Each route is public, for signed-in users, or for admins. An unknown route is treated as admin-only.
- Session. Anything but the public routes needs a valid session at the final sign-in stage. Without one, the answer is 404. A
viewer calling an admin route gets a
403withrole.forbidden, because they are signed in and hiding the route gains nothing. - Unsafe methods (POST, PUT, PATCH, DELETE): the origin check, a JSON body, and the CSRF header.
- The handler. An unexpected error answers
500with a short reference id and no stack. The stack goes to the server log with the same reference.
The uniform 404
Section titled “The uniform 404”When the dashboard is closed to a request, it answers the way your app answers an unknown URL, with none of the
dashboard’s headers. For a GET or HEAD request it hands the request to the app route that would match the URL if the
dashboard were not there (a @warlock.js/web site answers unknown URLs from its catch-all route), with that route’s rate
limit, hooks and handler: a JSON client and a browser get the same body and headers, the same x-ratelimit-* headers
from the same bucket, the same 429 once it is empty, and the app’s own error answer when that route fails. Other
methods go to the catch-all route only, and without one the app’s not-found handler answers. A scanner sending GET
requests cannot tell the dashboard exists. The login page is the one public exception, and only while the gate above is
open.
A request with a body (POST, PUT, PATCH, DELETE) that the dashboard refuses is answered after Fastify has read the
body, the way it is for an unknown URL. A malformed or oversized body to a closed dashboard URL gets the same 400 or
413 as the same body sent to an unknown URL, and a body that parses gets the 404 or catch-all answer above. The
dashboard never answers before the body is read, so the status, the body, the headers and the cost of the request do not
tell a closed dashboard path from an unknown one.
Threats and controls
Section titled “Threats and controls”| Threat | Control |
|---|---|
| Scanners find the dashboard | A secret path, the uniform 404, noindex, no full path in logs, exclusion from core’s request log, Referrer-Policy: no-referrer. |
| Password guessing | Limits per account (5), per IP (20) and in total (100, which closes the whole path for 15 minutes), a common-password list, and two-factor for admins (twoFactor: "off" removes that requirement and logs a boot warning). |
| Telling which accounts exist | One message and the same response time for an unknown email, a wrong password and a locked account. |
| Sign-in used to burn CPU | At most 4 password checks at once per process; beyond that the answer is a retry message. Blocked IPs are remembered in memory. |
| Stolen session | The session cookie is HttpOnly, Secure, SameSite=Strict, limited to the dashboard path, and ends after 30 idle minutes or 8 hours. It is stored hashed. Changing a second factor needs the password again. |
| Session fixation | A new token is issued at sign-in and again when sign-in is complete. |
| Cross-site requests (CSRF) | An origin check on every unsafe request, a per-session token in the X-Devtools-Csrf header, and JSON-only bodies. GET routes never change anything. |
| Clickjacking | frame-ancestors 'none' and X-Frame-Options: DENY. The API docs pages and the mail preview allow framing by the dashboard itself only. |
| Reading the API from another site | Every CORS header is removed and preflights are never approved. |
| A forged client IP or protocol | Forwarded headers are read only from trustedProxies, which is empty by default. |
| A viewer acting as an admin | Unknown routes need an admin, the role is checked again inside every admin action, and the last admin cannot be removed or demoted. |
| A leaked invite link | The token is in the URL fragment, stored hashed, valid 24 hours, usable once, tied to the email, and revocable. |
| A leaked first password or setup link | The environment password must be changed at first sign-in and is never applied again. The setup token needs 32 characters. |
| A stolen database | Passwords are hashed, tokens and recovery codes are stored as SHA-256 hashes, and two-factor secrets are encrypted with the app key. |
| A replayed one-time code | A code from the same or an earlier time step is refused. |
| A lost second factor | Ten recovery codes, a reset by another admin, and warlock devtools:reset-admin for shell access. |
| Personal data in captured requests | Values are removed before storage (see the table in the production page). Samples are kept 24 hours by default. |
| EXPLAIN running a statement | Plain EXPLAIN only. Executing plans are opt-in, read statements only, admin only and audited. |
| Script injection from captured text | The dashboard escapes captured text. Mail HTML shows only in a sandboxed frame. The page policy allows scripts only from the dashboard itself. |
| A forgotten open dashboard | Admins can disable it at any time. Re-enabling needs the CLI or a new path. |
| Someone triggering the global lock | Accepted: the dashboard closes, which is the safe side. warlock devtools:enable opens it again. |
| The monitor slowing the app | Sampling, bounded memory, a write budget for samples, a size cap on reports, and limits on live streams (3 per session, 50 per instance). |
| Audit tampering | No route removes audit entries. Only the retention clean-up does. |
| A share link leaks or is guessed | The token is 32 random bytes in the URL fragment (never in a log or Referer), stored as a SHA-256 hash, valid for at most share.maxDays, and revocable (every instance within 5 seconds). Failed tokens count toward the IP limit. |
| A share link reaching too much | The link grants a signed cookie for one panel. It reaches only that panel’s share.routes, share.assets and images, never another panel, the signed-in routes, the admin pages or a write. A tampered or expired cookie answers the uniform 404. |
| Telling a bad link from a closed one | A wrong, expired or revoked token, a bad cookie and a disabled share route all answer the uniform 404. |
| Path tricks on image routes | A panel’s image folder serves listed image extensions only (never .svg, .html, .htm, .js), rejects .., backslashes, NUL bytes and absolute paths, and the real path must stay inside the folder. |
| Weak configuration | The app refuses to boot (codes DT001 to DT010). |
Cookies
Section titled “Cookies”The cookie is named __Secure-warlock-devtools (warlock-devtools when requireHttps is false). It holds 32 random
bytes, has no Domain, and has no expiry, so it ends with the browser session. The server also ends sessions after 30
idle minutes (session.idleMinutes) and 8 hours (session.maxHours). Sign-in steps expire after 10 minutes.
Share cookie
Section titled “Share cookie”A share link sets __Secure-warlock-devtools-share (warlock-devtools-share when requireHttps is false). Its value
is <link id>.<expiry>.<HMAC>: the signature uses the app key (encryption.key), so the server needs no session
table, and the link’s record is read again (cached for 5 seconds) on every request, so a revoke takes effect. It has no
Domain, is HttpOnly, Secure, SameSite=Strict, is limited to the dashboard path, and ends with the link or after
12 hours, whichever is first. It is a different cookie from the session cookie: neither opens the other’s routes.
A share link contains the dashboard path, so everyone who receives one learns where the dashboard is. Sign-in, two-factor and the rate limits still guard every other route. If that matters to you, revoke the links and move the dashboard to a new path.
Response headers
Section titled “Response headers”Every dashboard response that is not a 404 carries Cache-Control: no-store, X-Robots-Tag: noindex, nofollow, noarchive, Referrer-Policy: no-referrer, X-Content-Type-Options: nosniff, X-Frame-Options: DENY,
Cross-Origin-Opener-Policy: same-origin, Cross-Origin-Resource-Policy: same-origin and a restrictive
Permissions-Policy. The HTML page also carries a Content-Security-Policy that allows scripts only from the dashboard’s
own origin; it replaces any policy the app sets for its own pages. The API docs pages also load scripts from the
dashboard only, allow inline styles, and can be framed by the dashboard (frame-ancestors 'self'), which shows them in
the API tab.
Rate limits
Section titled “Rate limits”Failed sign-ins and failed second-factor checks are counted in the audit log over a sliding window (15 minutes):
- 5 per account: that account is refused until the window clears,
- 20 per IP (failed share-link tokens count here too): an IPv4 address counts alone, an IPv6 address counts with its whole /64 network (one host usually holds a whole /64), and an IPv4-mapped IPv6 address counts as its IPv4 address,
- 100 in total: the whole path answers 404 for 15 minutes.
A correct password does not reset an account’s count, so signing in again does not buy more second-factor guesses;
only a completed sign-in does. A caller over the IP limit gets the same answer without any password check, so it costs
the app no CPU, and refused tries are written to the audit log at most once a minute per address and account. warlock devtools:enable resets the counts. The limits are options under rateLimits.
A wrong current password, typed to change the password or a second factor, counts as a failed sign-in.
Changing second factors
Section titled “Changing second factors”A signed-in session proves it is the owner again before it changes how the account signs in:
- removing the authenticator app or a passkey, adding an authenticator app or a passkey from the account page: the current password (removing also accepts a passkey check done in the last five minutes),
- making new recovery codes: a current code from the authenticator app, or a passkey check done in the last five minutes.
A passkey check is used once: two requests racing on it get one success. The first factor added at sign-in follows the password, so it does not ask for it again. A stolen session cookie alone cannot add the thief’s factor or remove yours.
Audit log
Section titled “Audit log”Admins read it from Admin, Audit. These events are written:
| Group | Events |
|---|---|
| First admin | admin.seeded, admin.reset, setup.completed |
| Sign-in | login.succeeded, login.failed, login.blocked, mfa.succeeded, mfa.failed, logout, session.revoked |
| Second factor | mfa.enrolled, mfa.removed, recovery-code.used, recovery-codes.regenerated, passkey.added, passkey.removed |
| Account | password.changed, account.role-changed, account.removed, account.mfa-reset, account.signed-out |
| Invites | invite.created, invite.revoked, invite.accepted |
| Dashboard state | dashboard.disabled, dashboard.enabled, dashboard.locked |
| Actions | explain.run, requests.cleared, panel.action |
| Share links | share.created, share.revoked, share.failed (the reason and link id, never the token) |
Entries hold the time, the event, the account, the client IP and short details. They never hold passwords, tokens, codes or query values.
What is kept, and for how long
Section titled “What is kept, and for how long”| Data | Where | Kept |
|---|---|---|
| Accounts and hashed secrets | Your database | Until removed |
| Sessions | Your database | Until they expire |
| Invites | Your database | Until used, revoked or expired |
| Share links | Your database | Until 30 days after they expire or are revoked |
| Audit entries | Your database | auditRetentionDays (90) |
| Request samples | Your database | requestRetentionHours (24) |
| Instance reports | Your database | Replaced every 10 seconds; dropped when not seen for 5 minutes |
| Sampled requests, query examples | Process memory | Until restart; bounded |
A clean-up runs every 10 minutes in each process.
What admins can and cannot do
Section titled “What admins can and cannot do”Admins can invite, remove and demote other users, reset another user’s second factors, sign users out, read the audit log, run EXPLAIN, clear stored requests, use the write actions of package panels, and disable the dashboard.
Admins cannot read anyone’s password or second-factor secret, remove or demote themselves, remove or demote the last admin, delete audit entries, or re-enable a disabled dashboard from the browser.
Package panels
Section titled “Package panels”A package panel is code your project chose to install. Its view runs in the dashboard with the signed-in user’s session and can call the dashboard’s API. Install panels only from packages you trust. In production:
- a panel appears only when it declares
production: trueor you setpanels[<id>]: true, - its GET routes need a signed-in user,
- every other method needs an admin and the CSRF header, and is written to the audit log as
panel.action.
A panel that declares share can be opened through a read-only link without an account when an admin turns on
share.enabled. Its shared routes receive shared: true and must leave developer detail out of their answer. See
Share links.
See Registering a panel.
Known limits
Section titled “Known limits”- The live stream is per instance. Shared tabs read the database and refresh by polling.
- EXPLAIN works only on the instance that holds the query example.
- Failed share-link tokens count with failed sign-ins, so enough of them from many addresses close the dashboard in the same way.
- Anyone who can send many failed sign-ins can close the dashboard. That is the safe failure; an admin reopens it with the CLI.
- The per-IP limit counts an IPv4 address or an IPv6 /64. A client with many networks (a botnet, a larger IPv6 range) is held back by the per-account and global limits instead.
- Request paths are kept as served (without the query string). Keep tokens out of URL paths.
- The cookie is scoped to the dashboard path, not to one host name only: a site on a sibling subdomain that you do not control could set a cookie for the same path. Do not serve the dashboard on a domain that shares a parent with untrusted sites.
- The mail preview, when turned on, loads the remote images of an email.