Skip to content

Implement the Spatial Radar for DB injection funnels (#105) - #359

Merged
squid-protocol merged 1 commit into
mainfrom
feature/105-db-injection-funnel
Jul 24, 2026
Merged

squid-protocol merged 1 commit into
mainfrom
feature/105-db-injection-funnel

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Summary

Closes #105. Landing order per the #102 epic (#344 -> #346 -> #105 -> #106): with #348's persisted, satellite-aware threat_locations ledger and its correlate_against_ledger() primitive already in place, this is a small, self-contained consumer of that infrastructure rather than a new correlation mechanism.

  • galaxyscope.py's Phase 5.5, right after the Active Hemorrhage block: correlates detector.py's api (public route) hits against security_lens.py's sec_db_hooks (raw DB sink) hits via correlate_against_ledger(), scoped to the same function -- a public API route directly invoking a DB query in its own body is deterministic proof of an injection funnel, not the flat probabilistic guess # [FEATURE/SAST] Implement Spatial Radar for Database Injection Funnels #105's original proposal described. Feeds a new sec_amplified_sql_injection signal, mirroring the amplified_leaks/amplified_rce telemetry pattern already established for the other post-hoc correlations.

    max_distance=5 (lines) reuses the exact char->line conversion the Active Hemorrhage block just above it already established (150 chars -> 5 lines), applied here to # [FEATURE/SAST] Implement Spatial Radar for Database Injection Funnels #105's originally-proposed 100-char radius. Same-function scoping via correlate_against_ledger() does the real precision work; this just guards against sprawling functions where an unrelated DB call happens to share a function with an API route.

  • signal_processor.py's _calc_injection_surface(): sec_amplified_sql_injection is now treated as deterministic proof, exactly like sec_tainted_injection already is -- same +500 gravity spike, and it also exempts the score from the "unconfirmed guess" 90% dampener applied when no other explicit io/exec signal is present.

Test plan

  • test_galaxyscope.py: test_worker_amplifies_db_injection_funnel_post_hoc -- a real detector.py api hit correlated against a mocked security_lens db_hooks position, driven through the full worker path.
  • test_signal_processor.py: test_signal_processor_db_injection_funnel -- proves the signal alone (no other io/exec signals) spikes injection_surface, matching sec_tainted_injection's existing behavior.
  • python -m pytest tests/ -q -- full suite, 834 passed, 1 pre-existing xfail.

🤖 Generated with Claude Code

Landing order per the #102 epic (#344 -> #346 -> #105 -> #106): with
#348's persisted, satellite-aware threat_locations ledger and its
correlate_against_ledger() primitive now in place, #105 becomes a
small, self-contained consumer of that infrastructure rather than a
new correlation mechanism.

- galaxyscope.py's Phase 5.5, right after the Active Hemorrhage block:
  correlates detector.py's "api" (public route) hits against
  security_lens.py's "sec_db_hooks" (raw DB sink) hits via
  correlate_against_ledger(), scoped to the SAME function -- a public
  API route directly invoking a DB query in its own body is
  deterministic proof of an injection funnel, not the flat
  probabilistic guess #105's original proposal described. Feeds a new
  "sec_amplified_sql_injection" signal, mirroring the amplified_leaks/
  amplified_rce telemetry pattern already established for the other
  post-hoc correlations.

  max_distance=5 (lines) reuses the exact char->line conversion the
  Active Hemorrhage block just above it already established (150
  chars -> 5 lines), applied here to #105's originally-proposed
  100-char radius. Same-function scoping via correlate_against_ledger()
  does the real precision work; this just guards against sprawling
  functions where an unrelated DB call happens to share a function
  with an API route.

- signal_processor.py's _calc_injection_surface(): sec_amplified_sql_injection
  is now treated as deterministic proof, exactly like sec_tainted_injection
  already is -- same +500 gravity spike, and it also exempts the score
  from the "unconfirmed guess" 90% dampener applied when no other
  explicit io/exec signal is present.

Tests: a worker-level regression test in test_galaxyscope.py (a real
detector.py "api" hit correlated against a mocked security_lens
db_hooks position, through the full worker path) and a
signal_processor.py unit test proving the signal alone (with no other
io/exec signals) spikes injection_surface, matching sec_tainted_injection's
existing behavior.

Full suite: 834 passed, 1 pre-existing xfail.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol merged commit 2082473 into main Jul 24, 2026
33 of 34 checks passed
@squid-protocol
squid-protocol deleted the feature/105-db-injection-funnel branch July 24, 2026 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

# [FEATURE/SAST] Implement Spatial Radar for Database Injection Funnels

1 participant