Skip to content

Security model

Lustro deliberately surfaces app internals, so its defaults are conservative. See SECURITY.md for the full threat model.

  • Loopback by default. The server binds to 127.0.0.1; it is reachable only from the device itself (and your desktop via adb forward). With LAN exposure, each request carries the token as plain HTTP, so the token does not stop a person who can record the network's traffic.
  • Token auth, always on. A 256-bit token is generated on first run and stored in private debug preferences. Programmatic clients send Authorization: Bearer <token>; browsers use an HttpOnly; SameSite=Strict cookie that /api/v1/_auth sets. Before a client sends the token, the server sends only the console's frame: no tab content and no captured data. The server logs the token at the LustroToken tag. With LAN exposure, it makes a new token with each process of the app.
  • Tabs never see the credentials. The server authenticates a request before dispatching it, and the DebugRequest a tab receives carries no Authorization or Cookie header, so a tab that logs or echoes its request can't leak the token.
  • Content Security Policy. Chrome and tab views ship a CSP (default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; ...) plus X-Content-Type-Options: nosniff. Scripts must come from the server itself, and inline scripts do not run, so a tab's JS loads as an external file from the same origin, and there are no inline handlers. Styles allow 'unsafe-inline', so tabs can use inline style= attributes and <style> blocks. Every API request, whatever its method, passes an Origin / Sec-Fetch-Site check: the server's own origin is always allowed, and any other cross-origin caller must be listed in DebugConfig.allowedOrigins (other localhost ports are not trusted by default). A request with neither an Origin nor a Sec-Fetch-Site header passes the check, because the CLI and older clients send neither. A browser can still send a cross-origin GET with neither header, so a tab must not change state on GET or HEAD.
  • Capture-time redaction, best-effort. A Redactor masks sensitive headers, URL/query params, and JSON/form body fields before anything is stored, so what it masks never reaches the API, the console, or an export. It matches on names, so it cannot find a secret that isn't keyed by a name it recognizes: see SECURITY.md for the known gaps, and pass your own Redactor when your traffic needs more, or a capture filter to keep a request out of capture entirely. A JSON body with no sensitive field in it is stored exactly as it arrived, so what you inspect and copy is what was on the wire. The text of a WebSocket message is redacted as a body is; a binary message is stored as it arrived (see WebSocket messages).
  • Log lines are not redacted. The Logs plugin serves the app's logcat as it is.
  • Captured data stays in memory. Captured traffic and log lines live only in bounded in-memory ring buffers and are lost when the process dies. The browser keeps no copy of them. Lustro writes to disk only in these cases:
    • The token, and the host and port that the server listens on, are in the app's private lustro_debug SharedPreferences file. App code reads them with lustro.endpoint(), not from the file.
    • Mock rules are saved when you give the Network tab a MockRuleStorage (see Mock rules).
    • The Preferences tab changes a file that is not read-only, and the SQLite tab changes a database that is writable, when a client asks for an edit. The WorkManager tab changes WorkManager's database when a client cancels or prunes work.
    • SQLite itself can leave the empty -wal and -shm files of a SqliteDb.file database in WAL mode after the SQLite tab reads it. See the SQLite limits.
  • Release builds are inert. Release variants depend on the no-op halves, so no server ships in a release build, and the runtime refuses to start in a build that is not debuggable. See Release safety.