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 viaadb 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 anHttpOnly; SameSite=Strictcookie that/api/v1/_authsets. 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 theLustroTokentag. 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
DebugRequesta tab receives carries noAuthorizationorCookieheader, 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'; ...) plusX-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 inlinestyle=attributes and<style>blocks. Every API request, whatever its method, passes an Origin /Sec-Fetch-Sitecheck: the server's own origin is always allowed, and any other cross-origin caller must be listed inDebugConfig.allowedOrigins(other localhost ports are not trusted by default). A request with neither anOriginnor aSec-Fetch-Siteheader passes the check, because the CLI and older clients send neither. A browser can still send a cross-originGETwith neither header, so a tab must not change state onGETorHEAD. - Capture-time redaction, best-effort. A
Redactormasks 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 ownRedactorwhen 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_debugSharedPreferences file. App code reads them withlustro.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
-waland-shmfiles of aSqliteDb.filedatabase in WAL mode after the SQLite tab reads it. See the SQLite limits.
- The token, and the host and port that the server listens on, are in the app's private
- 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.