Skip to content

[BUG/DATA-INTEGRITY] galaxyscope.py computes typosquat_hits but never persists it -- record_keeper.py's column is always 0 #376

Closed

Description

@squid-protocol

🛑 Problem Statement

Found by the dead key auditor (#325). gitgalaxy/galaxyscope.py computes a real typosquat-hit count and logs it:

typosquat_hits = 0
...
typosquat_hits += 1
...
if typosquat_hits > 0:
    logger.warning(f"Intercepted {typosquat_hits} typosquatting attempts via repository baseline analysis.")

...but typosquat_hits is a purely local variable -- it's never attached to summary or summary["ecosystem_audits"]. gitgalaxy/recorders/record_keeper.py:698 reads:

typosquat_count = summary.get("typosquat_hits", summary.get("summary", {}).get("typosquat_hits", 0))

Both fallback paths miss, so the SQLite typosquat_hits INTEGER column is always 0 -- even though the detection genuinely ran and the count is correct and visible in the console log. Detection itself is unaffected; this is purely a persistence/reporting gap.

🎯 Objective

The real typosquat-hit count should survive into the SQLite export, not just stdout.

🛠️ Proposed Implementation

Attach typosquat_hits to summary["ecosystem_audits"] (or summary directly, matching whichever fallback path record_keeper.py is meant to use) at the point it's computed in galaxyscope.py.

✅ Acceptance Criteria

  • A repo with a real typosquat hit produces a non-zero typosquat_hits column in the SQLite output, proven by a test.

Activity

  1. added
    bug
    supply-chain
    data-integrity
    priority: low
    on Jul 24, 2026
  2. squid-protocol commented on Jul 24, 2026

    @squid-protocol
    OwnerAuthor

    Fixed in #387 (merged).

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: lowsupply-chain

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions