fix: route all logging through kDebugMode-gated logger (L1) - #579
Conversation
Raw print() and ungated debugPrint() calls are not stripped in release builds and land in Android logcat, leaking the Taskmaster JWT (via the verify response body in taskmaster_service.dart), session IDs, balances, and addresses. Route every log statement in quantus_sdk/lib and mobile-app/lib through a kDebugMode-gated quantusDebugPrint. Mobile-app already had the helper in lib/shared/utils/print.dart; the SDK gets an identical one at lib/src/utils/print.dart. Purely mechanical: log content unchanged. Addresses finding L1 of the 2026-07-22 mobile wallet security audit.
🔍 Review — L1 (kDebugMode-gated logging)Verdict: 🟡 Approve with non-blocking comments A clean, genuinely mechanical conversion. The gating is correct, completeness is thorough (no functional What it does
Strengths
Findings
VerificationAdequate and, I'd argue, thorough. I fetched the PR head ref read-only (no checkout) and ran the completeness greps against |
|
Not sure we want debugprint - not really - we want print() but gated by debug flag |
- Resolve conflicts with main (sendError simplification, push payload resolution, multisig call_raw decoding), keeping gated logging - Rename quantusDebugPrint -> quantusPrint; helper now calls print() under kDebugMode (debugPrint throttles/drops output unreliably) - Gate new debugPrint sites that arrived from main
🔍 Re-review — L1 (print() gated by kDebugMode)Verdict: ✅ Approve The delta since the previous review does exactly what was asked — What changed since the last review
Verified on the new head
Notes (non-blocking, unchanged from last review)
|
Summary
Release-build
print()/ ungateddebugPrint()logs are not stripped in release and land in Android logcat, leaking sensitive data. Most critically,taskmaster_service.dartloggedprint('verify response: ${r.body}')— the response body contains the 24h Taskmaster access token (JWT). Session IDs, balances, and addresses were also logged across the SDK and app.This PR routes every log statement in
quantus_sdk/libandmobile-app/libthrough akDebugMode-gatedquantusDebugPrint:mobile-appalready had the gated helper atlib/shared/utils/print.dart; all rawprint()and ungateddebugPrint()call sites now use it.quantus_sdkgets an identical helper atlib/src/utils/print.dart; all rawprint()and ungateddebugPrint()call sites (including the_logwrappers in the wormhole/encrypted-account services) now use it.// ignore: avoid_printcomments and newly-unusedflutter/foundation/flutter/materialimports.No mnemonic/seed material was found in any log statement (per the audit).
Sites changed: 91 in quantus_sdk (17 files), 41 in mobile-app (19 files).
Verification:
dart analyzeclean in both packages;flutter test test/unit(mobile-app, 222 tests) and SDK parser/history tests pass.Addresses finding L1 of the 2026-07-22 mobile wallet security audit.