Repository navigation
[FEATURE/CORE-ENGINE] Persist a satellite-aware spatial ledger for post-hoc correlation (#346 phase 2) #348
Description
🛑 Problem Statement
This is phase 2 of #346, split out to ship the safety-critical dampener-scoping fix (phase 1) independently and sooner, without also solving the larger problem below in the same PR.
detector.py's six existing _correlate_signals calls (now migrated onto the shared primitive and satellite-scoped for the three dampener pairs, in phase 1) still only operate on spatial_map — a dict local to a single coding_analysis() call, discarded the moment that function returns. Nothing outside detector.py can correlate against it.
That's a hard blocker for #105 and #106: both need to correlate signals from outside detector.py, at the post-hoc pipeline stage (dev_agent_firewall.py and the eventual db_hooks correlation both run over parsed_files in galaxyscope.py, well after coding_analysis()'s spatial_map is gone). threat_locations (rule_name -> [line_numbers]) does survive to that stage, but it's write-only today, has no notion of which satellite/function a hit belongs to, and security_lens.py's own already-computed line positions (e.g. for db_hooks) never get folded into it.
🎯 Objective
Make threat_locations (or its successor) the one persisted, satellite-aware spatial ledger usable by any pipeline stage, not just internal to detector.py.
🛠️ Proposed Implementation
- Extend
threat_locationsentries to carry owning-satellite/function id alongside line number, using the same satellite start/end data_calculate_block_metricsalready computes. - Fold
security_lens.py's already-computed line positions (db_hooks, and any other Passive Security Lens Observer signal with position data) into the same ledger, instead of discarding them after producing a flat count. - Migrate the three amplifier-only correlate() pairs (RCE/IO taint corroboration, active-secret-leak amplification, race-condition/cascading-flux amplification) onto satellite scoping too, now that the ledger and primitive are shared -- lower urgency than the phase-1 dampener fix (a false positive here just costs one extra review item), but should land before or alongside # [FEATURE/SAST] Implement Spatial Radar for Database Injection Funnels #105/# [BUG/APPSEC] Spatially Verify Metaprogramming Hallucination Risk in Dev Agent Firewall #106 so all six pairs are consistent.
- Expose a small read helper (e.g.
correlate_against_ledger(file_data, source_keys, sink_keys, max_distance)) that post-hoc tools can call directly againstparsed_files[i]["threat_locations"], so # [FEATURE/SAST] Implement Spatial Radar for Database Injection Funnels #105 and # [BUG/APPSEC] Spatially Verify Metaprogramming Hallucination Risk in Dev Agent Firewall #106 don't each hand-rope their own access pattern.
✅ Acceptance Criteria
-
threat_locations(or its successor) carries owning-satellite id per hit, not just line number. -
security_lens.py's position data for at leastdb_hooksis merged into the shared ledger. - The three amplifier-only correlate() pairs are migrated onto the shared, scope-aware primitive.
- Post-hoc tools (
dev_agent_firewall.py, futureai_appsec_sensor.pywork) can read the ledger without depending on anything internal todetector.py'scoding_analysis()call. - Unblocks # [FEATURE/SAST] Implement Spatial Radar for Database Injection Funnels #105 and # [BUG/APPSEC] Spatially Verify Metaprogramming Hallucination Risk in Dev Agent Firewall #106.
Part of #102. Depends on #346 phase 1 (dampener scoping) landing first.
Activity
Scope dampener correlation to real function boundaries (#346 phase 1) (…
squid-protocol commentedon Jul 24, 2026
Opened PR #350. One design deviation worth flagging: rather than literally embedding an owning-satellite id into each
threat_locationsentry,correlate_against_ledger()joinsthreat_locationsagainstfile_data["functions"](which already has file-globalstart_line/end_line) at query time. Mutatingthreat_locations's shape would have brokensarif_recorder.py, which readsthreat_locations[key][idx]expecting a plain int line number. Also folded in an extra fix: the still-dead "Active Hemorrhage" block from #344/#346 is now removed from detector.py and reimplemented as a real post-hoc correlation using this new ledger.Persist a satellite-aware spatial ledger for post-hoc correlation (#348…
Implement the Spatial Radar for DB injection funnels (#105) (#359)
Spatially verify Metaprogramming Hallucination Risk in Dev Agent Fire…
Scope the Exfiltration Distance Check to real function boundaries (#102…
Fix record_keeper.py's four dead security-flag SQLite columns (#366-3…
expunge(#3101): remove score-dead sec_tainted_injection taint trackin…