Skip to content

Move ai_appsec_sensor.py/dev_agent_firewall.py from tools/ai_guardrails/ to security/ #1180

Description

@squid-protocol

🛑 Problem Statement

gitgalaxy/tools/ai_guardrails/ai_appsec_sensor.py and dev_agent_firewall.py are miscategorized.
gitgalaxy/tools/ is documented (in tools/README.md) and, for everything else in it, actually
true as a suite of standalone, independently-invocable CLIs — each registered as its own
pyproject.toml console script (vault-sentinel, pii-leak-hunter, api-network-map, the
cobol-* tools, etc.) with a real if __name__ == "__main__"/argparse entry point.

These two files have neither. No standalone entry point, no pyproject.toml registration —
tools/README.md's "Dual-Sided AI Guardrails" section currently describes them as independently
runnable "Deep-inspection middleware sensors," which isn't accurate; there is no way to invoke
them except as part of the main engine run. galaxyscope.py imports both directly and runs them
unconditionally in "Phase 5: Zero-Trust Guardrails" on every single scan — architecturally
identical to how security_lens.py/security_auditor.py (already in gitgalaxy/security/) are
unconditionally run as core phases. Further evidence this is a location bug, not a naming
preference: their existing tests already live in tests/security_auditing/
(test_ai_appsec_sensor.py, test_dev_agent_firewall.py), not anywhere under a tests/tools/
equivalent — the test suite already treats them as security-domain code.

Surfaced while evaluating whether gitgalaxy/security/ and gitgalaxy/tools/ needed
reorganizing; everything else flagged in that pass turned out to be an intentional, sensible split
(see that discussion) — this is the one real mismatch.

🎯 Objective

Move both files into gitgalaxy/security/, update the two import lines in galaxyscope.py, and
correct both READMEs so they describe reality.

🛠️ Proposed Implementation

  • git mv gitgalaxy/tools/ai_guardrails/ai_appsec_sensor.py gitgalaxy/security/ai_appsec_sensor.py
    and same for dev_agent_firewall.py. gitgalaxy/security/ is currently flat (no subfolders) —
    match that convention rather than introducing a new security/ai_guardrails/ subfolder, unless
    whoever picks this up has a good reason to prefer the subfolder.
  • Update galaxyscope.py's two import lines (currently
    from gitgalaxy.tools.ai_guardrails.ai_appsec_sensor import AIAppSecSensor and the
    dev_agent_firewall equivalent).
  • Remove gitgalaxy/tools/ai_guardrails/ entirely once empty (including its own README section)
    if nothing else lives there.
  • Update tools/README.md: remove or correct the "Dual-Sided AI Guardrails" section so it no
    longer claims these are standalone-runnable.
  • Update gitgalaxy/security/README.md's module breakdown to document these two as part of the
    core security suite, matching its existing style for security_lens.py/security_auditor.py.
  • Sweep for any other stale references to the old import path (docs, comments — e.g.
    gitgalaxy/core/spatial_correlation.py has a comment mentioning dev_agent_firewall.py/
    ai_appsec_sensor.py by basename only, so it's unaffected either way, but worth a full repo grep
    rather than assuming).
  • Pure code-organization change, no behavior change — full test suite + audit_check.py should be
    sufficient verification; a golden-master rebless shouldn't be needed, but confirm with
    crucible_check.py anyway since it touches galaxyscope.py's import wiring.

Related: #1178 (making this phase optional) touches the same two files — no required ordering
between the two, but worth noting in whichever PR lands second that the other is in flight, to
avoid a merge conflict on the same galaxyscope.py lines.

✅ Acceptance Criteria

  • Both files live under gitgalaxy/security/; gitgalaxy/tools/ai_guardrails/ no longer
    exists
  • galaxyscope.py imports updated; full test suite passes unchanged
  • tools/README.md and gitgalaxy/security/README.md both describe reality
  • audit_check.py clean; crucible_check.py confirms no output drift

Metadata

Metadata

Assignees

No one assigned

    Labels

    appsecAgentic guardrails, prompt injection, and RCE sensorspriority: lowUI tweaks, documentation, and minor optimizationsrefactorStructural cleanup or optimization without altering behavior

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions