Commit graph

1 commit

Author SHA1 Message Date
Jason Monk
8b906a4341
Fix #379: Scrub sensitive data from production logs + add regression gate (#380)
Auditted every production log site in Kotlin and Rust against the
sensitivity list in #379. Two real leaks found and fixed; a logging
policy is documented and a CI grep gate catches known-bad patterns in
future PRs.

Scrubbed:

- `OnboardingViewModel`: was logging 20-char prefixes of the Firebase
  ID token and the FCM token. Both are bearer credentials and `logcat`
  is reachable via adb / `READ_LOGS` on older Android, so even prefixes
  are sensitive. Replaced with length-only summaries.

- `relay/src/main.rs` connection handler: the "Routing decision" log
  used `?decision` (Debug format) on `RouteDecision`, which includes
  the `integration_secret` string on `DevicePassthrough`. That secret
  is the bearer credential an AI client presents in the SNI label to
  route to a specific integration -- logging it defeats the point.
  Added a `route_decision_log` helper that renders the variant plus the
  subdomain (public routing identity) without the secret.

Everything else on the priority list (McpRouting, RoomTokenStore,
CertRenewalScheduler/Worker, AcmeClient, TunnelClientImpl, MuxDemux,
FcmReceiver, relay main/tls/ws) was already scrub-clean: they log
state transitions, counts, durations, error types, and the relay's
operational subdomain -- never tokens, bodies, tool-call arguments,
cert material, or secrets.

Regression protection:

- CI grep gate in `.github/workflows/ci.yml` fails the build if known
  bad patterns (`Log.<level>(... "$token"` etc., `args: $...`) appear
  in Kotlin production sources.

- `docs/internal/logging.md` documents what we log, what we don't,
  and how to add new log lines safely.

Co-authored-by: Claude Opus 4 (1M context) <noreply@anthropic.com>
2026-04-23 12:07:54 -04:00