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

    1. Route logging through one helper that does nothing in release builds (`if (__DEV__)` in React Native, `kDebugMode` in Flutter).
    2. Strip remaining console calls from the release bundle (babel-plugin-transform-remove-console, or R8 rules for android.util.Log).
    3. 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 app

    References

    Related checks (M8)