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>