Skip to content

0032. No personal data or secrets in server logs, enforced by one redacting logger

  • Status: Accepted
  • Date: 2026-11-11

ADR 0007 keeps secrets out of logs, but says nothing about personal data. Error messages can quote customer emails and IP addresses as well as credentials, and server logs sit outside the project store: they are not covered by customer deletion (ADR 0023) or by retention, so personal data in them is hard to find and erase under the GDPR. Before this ADR, the HTTP and MCP surfaces redacted credentials, but the Worker’s wake and delivery logs and the ProjectDO’s alarm log printed raw error objects, and the secret prefixes were listed in two places.

The maintainer decided on 2026-11-11 that logs must not contain personal data, and that email addresses are masked like secrets.

  • Server logs contain no secrets and no personal data. This extends invariant 6 of ADR 0007 from secrets to personal data, for logs.
  • Every server-side log line goes through logError in core/src/log.ts. It logs a message and, at most, the error’s name and message, both passed through redactForLog. Raw error objects, payloads, and records are never logged.
  • redactForLog masks:
    • credentials: every prefix in CREDENTIAL_PREFIXES (core/src/auth, the one list of cl_sk_, cl_rk_, cl_pk_, cl_whsec_, and, amended for ADR 0033, the approval link secret cl_apsec_, and, amended for ADR 0036, the unsubscribe token cl_unsub_) and Bearer values;
    • email addresses, including non-ASCII ones, as [email];
    • IPv4 addresses, and IPv6 addresses in full form or compressed with at least two groups before ::, as [ip].
  • Log messages identify things by the IDs we generate (prj_, msg_) and by kinds (wake item message failed), never by customer external IDs, which are often email addresses, or by customer attributes.
  • Credentials in logs show only their prefix (cl_sk_[redacted]), stricter than the prefix and last four characters that ADR 0026 allows.
  • This covers the log lines our code writes. What the platform records itself (uncaught exceptions, request metadata in Workers Logs or Logpush) is set by deployment configuration and is tracked in docs/architecture.md open items.
  • The ESLint rules no-console and no-restricted-properties (globalThis.console) fail on any console use outside core/src/log.ts and tests; core/test/lint-bans.test.ts checks them. Lint sees direct use only: an alias (const c = console) or a local declare const console gets past it, so review still applies.
  • Masking is by pattern, so it is a safety net, not a guarantee: names, free-text attributes, and other personal data that has no fixed shape are not caught. Messages must not include them in the first place.
  • Stacks and causes are not logged; a failure is investigated from its IDs and error name. This costs some debuggability.
  • The patterns can over-mask text shaped like an address (a four-part version number such as 1.2.3.4); logs lose that detail.
  • core/src/log.ts declares console itself, since core has no platform types (ADR 0018); console exists in every runtime we target.
  • A structured logger or a log sink port, if needed later, replaces logError’s body; call sites and the lint rule stay.
  • The check-tenant-safety skill checks log lines against this ADR.