Repository navigation
Conversation
…0 on empty glob v1 fix only skipped the regex token scan for .framework dirs but left private key markers and exact denied name byte searches running on framework binaries — those also false-positive on compiled SDK constants. Now framework files only get checked for: - Forbidden filenames/suffixes - Actual CI secret values leaked into the binary Empty glob now exits 0 with WARNING instead of 1 — the build step already fails if no artifact was produced.
There was a problem hiding this comment.
1 issue found across 2 files
Confidence score: 2/5
- In
scripts/scan-public-artifact-secrets.py, returning success (0) when no artifact is passed creates a fail-open path in the release secret scan, so misconfigured or empty invocations could let leaked secrets pass into published artifacts undetected. Treat empty input as an error by default and add an explicit allow-empty flag only for the Android nullglob case before merging.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="scripts/scan-public-artifact-secrets.py">
<violation number="1" location="scripts/scan-public-artifact-secrets.py:275">
P1: Returning 0 when no artifact is provided makes the release secret scanner fail open. Add an explicit allow-empty mode for the Android nullglob case instead of treating all empty invocations as successful.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| print("No artifacts to scan (glob matched nothing).", file=sys.stderr) | ||
| return 1 | ||
| print("WARNING: No artifacts to scan (glob matched nothing). Skipping.", file=sys.stderr) | ||
| return 0 |
There was a problem hiding this comment.
P1: Returning 0 when no artifact is provided makes the release secret scanner fail open. Add an explicit allow-empty mode for the Android nullglob case instead of treating all empty invocations as successful.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At scripts/scan-public-artifact-secrets.py, line 275:
<comment>Returning 0 when no artifact is provided makes the release secret scanner fail open. Add an explicit allow-empty mode for the Android nullglob case instead of treating all empty invocations as successful.</comment>
<file context>
@@ -270,8 +271,8 @@ def main() -> int:
- print("No artifacts to scan (glob matched nothing).", file=sys.stderr)
- return 1
+ print("WARNING: No artifacts to scan (glob matched nothing). Skipping.", file=sys.stderr)
+ return 0
policy = load_policy()
</file context>
The framework-only exemption was insufficient — compiled binaries outside .framework/ (Runner, BatteryWidget.appex) and config files (.plist) also produce false positives from the regex token scanner. Now heuristic scans (private key markers, denied name bytes, regex tokens) only run on files with known text extensions (.env, .json, .yaml, .swift, .dart, etc.). All files still get checked for forbidden filenames/suffixes and actual CI secret value leaks. Tests: 14 pass covering framework binaries, compiled app binaries, plist config keys, text file catches, CI value leaks, and empty glob handling.
There was a problem hiding this comment.
1 issue found across 2 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="scripts/scan-public-artifact-secrets.py">
<violation number="1" location="scripts/scan-public-artifact-secrets.py:89">
P2: Hidden `.env` files are no longer treated as text-scannable because `Path.suffix` is empty for `.env`. This can miss private-key markers or denied-name byte/token leaks in bundled `.env` artifacts.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| """ | ||
| if any(part.endswith(FRAMEWORK_DIR_SUFFIXES) for part in rel.parts): | ||
| return False | ||
| return file_path.suffix.lower() in HEURISTIC_SCAN_EXTENSIONS |
There was a problem hiding this comment.
P2: Hidden .env files are no longer treated as text-scannable because Path.suffix is empty for .env. This can miss private-key markers or denied-name byte/token leaks in bundled .env artifacts.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At scripts/scan-public-artifact-secrets.py, line 89:
<comment>Hidden `.env` files are no longer treated as text-scannable because `Path.suffix` is empty for `.env`. This can miss private-key markers or denied-name byte/token leaks in bundled `.env` artifacts.</comment>
<file context>
@@ -37,6 +37,56 @@
+ """
+ if any(part.endswith(FRAMEWORK_DIR_SUFFIXES) for part in rel.parts):
+ return False
+ return file_path.suffix.lower() in HEURISTIC_SCAN_EXTENSIONS
</file context>
| return file_path.suffix.lower() in HEURISTIC_SCAN_EXTENSIONS | |
| return file_path.name == ".env" or file_path.name.endswith(".env") or file_path.suffix.lower() in HEURISTIC_SCAN_EXTENSIONS |
kodjima33
left a comment
There was a problem hiding this comment.
security-sensitive backend/scripts fix (exempt framework binaries from secret scans) — approve only, when-in-doubt downgrade
Git-on-my-level
left a comment
There was a problem hiding this comment.
Thanks for the follow-up here — the direction makes sense for reducing noisy false positives from compiled iOS artifacts, and the included test script passes locally.
I’m requesting changes because this touches the release secret scanner and I found two fail-open edge cases that should be tightened before merge:
-
.envis listed inHEURISTIC_SCAN_EXTENSIONS, butPath('.env').suffixis empty. A bundled file literally named.envstill runs the.envvariable-name parser, but it no longer gets the private-key marker / denied-name byte / token heuristic scan. I reproduced an IPA containingPayload/Runner.app/.envwith private-key material and the scanner exited 0 (Public artifact secret scan passed.). Please treat.envas text-scannable explicitly, not only via suffix. -
Returning 0 for every no-argument invocation makes the scanner fail open if an artifact glob or variable is accidentally empty in a release path. I understand the Android
nullglobmotivation, but this should be an explicit allow-empty mode or otherwise scoped to that workflow case rather than changing the scanner’s default no-artifact behavior.
Verification I ran with a stripped environment:
env -i ... bash scripts/test-scan-public-artifact-secrets.sh-> 14 passed, 0 failed- targeted
.envprivate-key artifact -> scanner exited 0 unexpectedly - no-args scanner invocation -> scanner exited 0
Because this is security/workflow-sensitive release tooling, please add regressions for those cases before this lands. I’m not treating this as malicious; it looks like a real false-positive fix that just needs the fail-open edges closed.
|
Closing — manager decided to hand scanner fix ownership back to @Git-on-my-level who authored the original scanner. See #8742 for full details on the false positive sources discovered during Codemagic builds. by AI for @beastoin |
|
Hey @beastoin 👋 Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request. After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:
Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out. Thank you for being part of the Omi community! 💜 |
Summary
Follow-up to #8741 — the v1 fix only skipped the regex token scan for
.framework/dirs. v2 extended this to all three heuristic checks for frameworks, but the real problem is broader: compiled binaries outside.framework/also false-positive.False positive sources in real Codemagic builds:
Runner(Mach-O binary, no extension) — BoringSSL constants likeCLIENT_EARLY_TRAFFIC_SECRETBatteryWidget.appex/BatteryWidget— enum names likeCREDENTIAL_MISMATCH,API_KEYGoogleService-Info.plist— config key names likeAPI_KEY,GCM_SENDER_ID.framework/contents — TwilioVoice, Flutter, Firebase SDK constantsRoot cause
The regex scanner
\b[A-Z][A-Z0-9_]{2,}\bmatches 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.Fix
Replace the
in_frameworkcheck with_is_text_scannable()— heuristic scans (private key markers, denied name bytes, regex tokens) ONLY run on files with known text extensions (.env,.json,.yaml,.swift,.dart, etc.).Still checked on ALL files (including binaries):
.envbundled, keystore files, etc.)Also fixed
nullglobcase): exit 0 with WARNING instead of exit 1Tests
14 tests pass covering:
Closes #8742
by AI for @beastoin