Skip to content

Secret scanner false positives block mobile release (Codemagic) #8742

Description

@beastoin

Problem

scripts/scan-public-artifact-secrets.py blocks iOS and Android Codemagic builds with false positives, preventing mobile releases.

iOS: framework binary false positives

The scanner runs a regex \b[A-Z][A-Z0-9_]{2,}\b on all files in the IPA, including compiled third-party framework binaries. BoringSSL constants in TwilioVoice.framework and Flutter.framework — CLIENT_EARLY_TRAFFIC_SECRET, PRIVATE_KEY_ENCODE_ERROR — match denied name patterns (^|_)SECRET($|_) and (^|_)PRIVATE_KEY($|_).

Failed builds:

  • ios-internal-auto (build 6a44e4419595ef11dcb013f0)
  • ios-prod-testflight (build 6a44e4579595ef11dcb01685)

Android: argument error on empty glob

shopt -s nullglob before the scanner call causes the glob build/**/outputs/**/*.aab to expand to zero arguments when no AAB exists. argparse crashes with "the following arguments are required: artifacts".

Failed build:

  • android-internal-auto (build 6a44e4419595ef11dcb01401)

Impact

Blocks mobile release v1.0.542+969. Version bump PR #8738 merged, tag v1.0.542+969-mobile-cm pushed. Builds cannot pass the scanner step.

Patch

PR #8741 fixes both issues.

@Git-on-my-level — please revalidate scan-public-artifact-secrets.py against current iOS frameworks and Android build outputs.

Activity

  1. beastoin commented on Jul 2, 2026

    @beastoin
    CollaboratorAuthor

    Scanner v1 fix was insufficient — full findings from Codemagic build testing

    Hey @Git-on-my-level! We ran your scanner against real Codemagic iOS builds and hit false positives beyond what the v1 fix (PR #8741) covered. Here's what we found — hoping this helps you fix it properly since you know the scanner best.

    False positive sources discovered

    The in_framework check from v1 only covers .framework/ dirs, but compiled binaries and config files outside .framework/ also false-positive:

    1. Runner (Mach-O binary, no extension) — contains BoringSSL/TLS constants like CLIENT_EARLY_TRAFFIC_SECRET, PRIVATE_KEY_ENCODE_ERROR
    2. BatteryWidget.appex/BatteryWidget — enum names like CREDENTIAL_MISMATCH, API_KEY, PROJECT_TOKEN
    3. GoogleService-Info.plist — config key names like API_KEY, GCM_SENDER_ID (already handled by your is_public_firebase_config in later commits)
    4. .framework/ contents — TwilioVoice, Flutter, Firebase SDK constants (covered by v1)

    Root cause

    The regex \b[A-Z][A-Z0-9_]{2,}\b matches ANY uppercase identifier with 3+ chars. In compiled iOS binaries, thousands of such identifiers exist as enum names, config keys, and SDK constants — none are actual secrets. The exact denied name byte search (for name in denied: if name.encode() in data) and private key markers also match compiled binary content.

    What we tested

    We triggered Codemagic ios-internal-auto builds from a fix branch. The approach that passed was restricting heuristic scans (private key markers, denied name bytes, regex tokens) to files with known text extensions only (.env, .json, .yaml, .swift, .dart, etc.) — while keeping CI secret value leak detection on ALL files. See PR #8747 (now closed) for the full implementation and 14-test suite if useful as reference.

    Also: empty glob exit code

    The nargs='*' + return 1 on empty artifacts kills the Codemagic pipeline when Android nullglob matches nothing (no AAB built yet). The build step itself already fails if no artifact was produced, so the scanner exiting 1 is redundant and blocks the pipeline. Consider return 0 with a warning.

    Codemagic build evidence

    • Build 6a451afb6f01cbbe3a0303b7 (v1 scanner) — FAILED on framework false positives
    • Build 6a451ff6089a3997e9181f57 (text-extension-only approach) — PASSED clean

    Let us know if you need any help or want to pair on this — happy to share the test artifacts and approach details!

    by AI for @beastoin

  2. beastoin commented on Jul 2, 2026

    @beastoin
    CollaboratorAuthor

    @Git-on-my-level One more thing — once you've got the scanner fix working, could you please let @beastoin know directly? We've got a mobile release blocked on this (build 970 failed on all 4 Codemagic workflows due to the scanner false positives). We need confirmation that the scanner passes on a real Codemagic build before we can re-tag and ship.

    Thanks David! 🙏

    by AI for @beastoin

  3. added
    docs-tooling
    p3
    on Jul 4, 2026
  4. added a commit that references this issue on Jul 6, 2026
    12e7bea
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

docs-toolingp3

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions