Skip to content

sec_extension_mismatch can never fire in a scan: binary sensor gate checks a renamed aperture reason (3477c48cc), text-spoof path unreachable #4126

Closed

Description

@squid-protocol

Problem

threat_extension_mismatch (sec_extension_mismatch, "Sec Extension Mismatch") is 0 on every file of the v2.9.0 corpus (739 repos, 1.48M files) and on the golden crucible. It isn't a corpus gap. Neither of its two producers can fire in a galaxyscope scan.

Producer 1: the Binary Analysis Sensor is unreachable (regression from 3477c48, 2026-06-18)

galaxyscope.py:507 only calls security.scan_binary() when the aperture reason contains "Binary Format", "Blacklisted Extension" or "Embedded Data Payload":

if "Binary Format" in reason or "Blacklisted Extension" in reason or "Embedded Data Payload" in reason:

The reason it is tested against comes from aperture.evaluate_path_integrity(), and that function emits none of the three strings:

  • 3477c48 renamed the Gate 1.3 reason from Blocked (Explicitly Blacklisted Extension: ...) to Blocked (Explicitly Denied Extension: ...). The gate still tests for the old wording.
  • Blocked (Binary Format Detected) exists, but only in is_in_scope()'s content gate (aperture.py ~364), not in evaluate_path_integrity().
  • Nothing in gitgalaxy/ has emitted Embedded Data Payload since 1c130f2/6d4138bf2.

As a result, scan_binary()'s magic-byte check, its embedded-header check and its entropy check never run during a scan. The #368 hit_vector plumbing that carries them into threat_extension_mismatch/binary_anomaly has no input. The standalone tool tools/supply_chain_security/binary_anomaly_detector.py calls scan_binary() directly and is not affected.

Probe on origin/main 46acb01: a text file named fake.png is excluded with Blocked (Explicitly Denied Extension: '.png'), no BINARY ANALYSIS TRIGGERED is logged, and no row is written.

Producer 2: the text spoof check in signal_processor.py:~350-389 can't be reached either

It fires when ext in {.txt,.md,.csv,.json,.yaml,.yml,.xml,.log,...} and lang_id is an executable language. Language detection never produces that combination. Probes, each with an unambiguous script body:

file result
notes.txt (python shebang plus a class and functions) Unsupported Format (.undeterminable)
build.log (same content) Unsupported Format (.undeterminable)
readme.md (bash shebang, `curl bash`)
data.csv (<?php ... eval($_GET[...])) csv

Why restoring the gate string is not a small fix

Restoring the old wording (or matching Denied Extension) brings back scan_binary() on every denied-extension file. It also brings back the escalation that comes with it: a WEAPONIZED BINARY DETECTED synthetic artifact with sum_fxn_impact 5000. I measured scan_binary() directly over the corpus pool /nvme-data/gitgalaxy-data (141 repos):

  • Of 98,454 denied-extension files, 10,321 (10.5%) would be flagged.
  • sec_reflection_metaprogramming (5,784): byte entropy above 7.95. Every compressed format (.tgz, .gz, .png) is high-entropy by construction.
  • sec_high_risk_execution (4,607): the 2-byte b"MZ" "PE header" appears anywhere in the first 8 KB of ordinary gif/png data. The entropy branch also overwrites threat_snippet.
  • sec_extension_mismatch (587): the classified mismatches are all benign:
    • about 367 git-LFS pointer files (version https://git-lfs...)
    • 62 empty files
    • about 124 real images under the wrong image extension (jpeg named .png, png named .jpg, gif, webp)
    • test fixtures (terraform's intentionally invalid .zip, text .gz)
    • an empty-zip PK\x05\x06
    • none of them is a disguised executable.

The golden crucible (v1.6.0) is not affected either way: it has 8 denied-extension files and none of them trips the sensor. That also means the golden master cannot see this sensor at all.

Options (needs a decision)

  1. Restore it with precision fixes. Gate on Denied Extension. Make the magic check tolerate LFS pointers, empty files and cross-image-format mislabels (treat an image magic under any image extension as consistent). Look for MZ/ELF only at offset 0. Drop or raise the entropy check for formats that are compressed by design. Then add planted cases (a real ELF renamed .png) to a fixture, since the crucible can't carry them.
  2. Declare it dead. Remove the in-scan call and freeze sec_extension_mismatch as an always-zero positional placeholder, the same way prompt_injection/agentic_rce (Remove AST-dependent Security & Vulnerability metrics (Injection, RCE, Memory) #1020) and sec_tainted_injection ([SECURITY] sec_tainted_injection taint tracking is score-dead + measures ~0% precision/recall -- expunge #3101) were frozen. Keep binary_anomaly_detector.py as the dedicated tool for this check.

Either way, #4108's coverage floor should not count this signal as a corpus gap.

Found during #4108 (step 3: zeros that are broken detection rather than corpus gaps).

Activity

  1. added
    bug
    core-engine
    on Oct 2, 2026
  2. added 2 commits that reference this issue on Oct 3, 2026
  3. added
    scope:infra
    on Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcore-enginescope:infra

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions