low · M8 · MASVS-PLATFORM-3 · PTKD-GL-CONSOLE-LOG
Debug logging in production code (text search)
Excessive console.log/print statements may indicate the app is not production-ready.
How it is exploited
Not an attack: the release bundle still logs every API response with console.log, including user data and tokens. Anyone with a USB cable (or another app on a rooted phone) can read the device log, and a reviewer watching Console.app sees a build that looks unfinished.
Why it matters
Personal data and tokens can leak through device logs, and debugging leftovers make an App Review 2.1 'not final' rejection more likely.
How to fix it
- Route logging through one helper that does nothing in release builds (`if (__DEV__)` in React Native, `kDebugMode` in Flutter).
- Strip remaining console calls from the release bundle (babel-plugin-transform-remove-console, or R8 rules for android.util.Log).
- Never log tokens, passwords, full request bodies or personal data, even in debug.
babel.config.js
module.exports = {
presets: ["babel-preset-expo"],
env: { production: { plugins: ["transform-remove-console"] } },
};Does your app have this?
PTKD checks your build or your source project for PTKD-GL-CONSOLE-LOG and every other check in this knowledge base.
Scan your appReferences
Related checks (M8)
- JavaScript obfuscation in the build
- Export compliance (ITSAppUsesNonExemptEncryption) not declared
- HealthKit app that also ships an ads SDK
- Hardcoded unlock or promo code
- Purchases SDK configured with an empty or test key
- Purchase screen falls back to made-up prices or 'coming soon' text
- False-urgency copy on a purchase screen
- Hardcoded price on a purchase screen