Skip to content

[BUG/DATA-INTEGRITY] record_keeper.py's "has_credentials" SQLite column is always False -- no producer exists #367

Closed

Description

@squid-protocol

🛑 Problem Statement

Found by the dead key auditor (#325). gitgalaxy/recorders/record_keeper.py:478:

has_creds = 1 if file_data.get("has_credentials", False) else 0

Unlike is_malware (#366, a near-miss rename), there is no producer at all for file_data["has_credentials"] anywhere in gitgalaxy/. The has_credentials INTEGER SQLite column is permanently 0 for every file, even though the engine already has a real hardcoded-secrets signal (sec_hardcoded_secrets, populated by security_lens.py and correlated in galaxyscope.py's Active Hemorrhage step, #348).

Related: #366/#367/#368 -- the same table's other security flag columns.

🎯 Objective

The SQLite has_credentials column should reflect real hardcoded-credential detections.

🛠️ Proposed Implementation

Thread a boolean off the existing sec_hardcoded_secrets equation (e.g. file_data["has_credentials"] = equations.get("sec_hardcoded_secrets", 0) > 0) into file_data before record_keeper.py reads it, or clarify if has_credentials was meant to signal something narrower (e.g. only exposed, unredacted credentials) that genuinely doesn't exist yet.

✅ Acceptance Criteria

  • A file with a detected hardcoded secret produces has_credentials = 1 in the SQLite output, proven by a real test.

Activity

  1. added
    bug
    data-integrity
    schema
    priority: high
    on Jul 24, 2026
  2. squid-protocol commented on Jul 24, 2026

    @squid-protocol
    OwnerAuthor

    Fixed in #381 (merged).

  3. squid-protocol commented on Aug 7, 2026

    @squid-protocol
    OwnerAuthor

    Regression found via population-scale validation (#1144)

    This was closed via #381 with a passing unit test, but a full v2.4.7 run against 718 real repos
    (1,201,836 files) shows has_credentials is still 100% zero across every file, despite real
    underlying signal existing: risk_secrets_risk has genuine nonzero values for 437 files in the
    same dataset.

    Root cause appears to be that #381's fix reads file_data.get("equations", {}).get("sec_hardcoded_secrets", 0)
    in record_keeper.py, and the merged #381 test validated that arithmetic by handing the function
    a hand-built equations dict directly -- it never proved the real pipeline populates
    file_data["equations"] the same way by the time record_keeper.py reads it. equations does
    get set in multiple places in galaxyscope.py (lines ~434, ~1100, ~1913), so this needs a real
    end-to-end trace of whether that dict (and the sec_hardcoded_secrets key specifically) survives
    intact from wherever it's computed to wherever record_keeper.py reads it for a given file --
    not just re-verified with another synthetic mock.

    Reopening. See #1144 for the full validation methodology and the other
    findings from the same run.

  4. added a commit that references this issue on Aug 28, 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

    bugdata-integritypriority: highschema

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions