Skip to content

[BUG/METRICS] Critical Secrets Exposure Override never sees Aperture's own block reason -- reads "aperture_reason", real key is "reason" #374

Closed

Description

@squid-protocol

🛑 Problem Statement

This is #325's own pre-documented instance #3, now confirmed by the dead key auditor. Two read sites:

# gitgalaxy/metrics/signal_processor.py:305
aperture_reason = ghost_meta.get("aperture_reason", "")
# gitgalaxy/recorders/audit_recorder.py:461

gitgalaxy/core/aperture.py always writes the key "reason" (never "aperture_reason") when it blocks a file, e.g. "reason": "Blocked (Machine-Generated Source Code Signature: ...)". aperture_reason is always "".

This feeds the "CRITICAL SECRETS EXPOSURE OVERRIDE" in signal_processor.py:

is_critical_leak = "CRITICAL LEAK" in aperture_reason or ext in secrets_exts or filename in secrets_exact

This is an or with two other independent, working detection paths (extension match, exact filename match), so this isn't a total failure of critical-leak detection -- but it is a fully dead third path. Worth checking whether Aperture's own reason strings ever actually contain the literal substring "CRITICAL LEAK" today (a quick grep of aperture.py's "reason": assignments suggests they currently read more like "Blocked (...)" rather than that exact phrase) -- if so, this may need both the key name AND the matched substring fixed.

🎯 Objective

The critical-leak override should see Aperture's real block reason, not always an empty string.

🛠️ Proposed Implementation

Fix the key name (ghost_meta.get("reason", ""), or thread the correct field through ghost_meta if aperture_reason was meant to be a distinctly-named copy). Confirm the "CRITICAL LEAK" substring match still makes sense against Aperture's actual current reason strings once the key is fixed.

✅ Acceptance Criteria

  • A file Aperture blocks for a genuine critical-leak reason correctly sets is_critical_leak = True via this path, proven by a test.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmetricspriority: medium

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions