Skip to content

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.

Every request under the dashboard path passes these checks in order. The first one that fails ends it.

  1. Production mode. In development the loopback guard applies instead, unchanged.
  2. Open state. If an admin disabled the dashboard, or it is locked after too many failed sign-ins, it answers 404.
  3. HTTPS. With requireHttps (the default), a request that did not arrive over HTTPS answers 404.
  4. Allowed IPs. When allowedIps is set, other clients get 404.
  5. Route access. Each route is public, for signed-in users, or for admins. An unknown route is treated as admin-only.
  6. 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 403 with role.forbidden, because they are signed in and hiding the route gains nothing.
  7. Unsafe methods (POST, PUT, PATCH, DELETE): the origin check, a JSON body, and the CSRF header.
  8. The handler. An unexpected error answers 500 with a short reference id and no stack. The stack goes to the server log with the same reference.

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.

ThreatControl
Scanners find the dashboardA secret path, the uniform 404, noindex, no full path in logs, exclusion from core’s request log, Referrer-Policy: no-referrer.
Password guessingLimits 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 existOne message and the same response time for an unknown email, a wrong password and a locked account.
Sign-in used to burn CPUAt most 4 password checks at once per process; beyond that the answer is a retry message. Blocked IPs are remembered in memory.
Stolen sessionThe 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 fixationA 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.
Clickjackingframe-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 siteEvery CORS header is removed and preflights are never approved.
A forged client IP or protocolForwarded headers are read only from trustedProxies, which is empty by default.
A viewer acting as an adminUnknown 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 linkThe 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 linkThe environment password must be changed at first sign-in and is never applied again. The setup token needs 32 characters.
A stolen databasePasswords 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 codeA code from the same or an earlier time step is refused.
A lost second factorTen recovery codes, a reset by another admin, and warlock devtools:reset-admin for shell access.
Personal data in captured requestsValues are removed before storage (see the table in the production page). Samples are kept 24 hours by default.
EXPLAIN running a statementPlain EXPLAIN only. Executing plans are opt-in, read statements only, admin only and audited.
Script injection from captured textThe 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 dashboardAdmins can disable it at any time. Re-enabling needs the CLI or a new path.
Someone triggering the global lockAccepted: the dashboard closes, which is the safe side. warlock devtools:enable opens it again.
The monitor slowing the appSampling, bounded memory, a write budget for samples, a size cap on reports, and limits on live streams (3 per session, 50 per instance).
Audit tamperingNo route removes audit entries. Only the retention clean-up does.
A share link leaks or is guessedThe 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 muchThe 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 oneA wrong, expired or revoked token, a bad cookie and a disabled share route all answer the uniform 404.
Path tricks on image routesA 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 configurationThe app refuses to boot (codes DT001 to DT010).

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.

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.

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.

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.

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.

Admins read it from Admin, Audit. These events are written:

GroupEvents
First adminadmin.seeded, admin.reset, setup.completed
Sign-inlogin.succeeded, login.failed, login.blocked, mfa.succeeded, mfa.failed, logout, session.revoked
Second factormfa.enrolled, mfa.removed, recovery-code.used, recovery-codes.regenerated, passkey.added, passkey.removed
Accountpassword.changed, account.role-changed, account.removed, account.mfa-reset, account.signed-out
Invitesinvite.created, invite.revoked, invite.accepted
Dashboard statedashboard.disabled, dashboard.enabled, dashboard.locked
Actionsexplain.run, requests.cleared, panel.action
Share linksshare.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.

DataWhereKept
Accounts and hashed secretsYour databaseUntil removed
SessionsYour databaseUntil they expire
InvitesYour databaseUntil used, revoked or expired
Share linksYour databaseUntil 30 days after they expire or are revoked
Audit entriesYour databaseauditRetentionDays (90)
Request samplesYour databaserequestRetentionHours (24)
Instance reportsYour databaseReplaced every 10 seconds; dropped when not seen for 5 minutes
Sampled requests, query examplesProcess memoryUntil restart; bounded

A clean-up runs every 10 minutes in each process.

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.

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: true or you set panels[<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.

  • 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.