Repository navigation
Wire supply chain firewall to SignalProcessor's risk_vector - #302
Merged
Merged
Conversation
The firewall's behavioral scoring (evaluate_risk on SecurityLens) and SignalProcessor's risk scoring were two independent, disagreeing engines computing risk from the same underlying signals. SecurityLens.evaluate_risk() and its self.policy/ThreatPolicy plumbing are now dead, so run_firewall_audit reads the risk score SignalProcessor already computed at Phase 3 instead of recomputing density from raw equations counts. - Replace the equations -> local_counts -> evaluate_risk() block with a one-time schema-index lookup (_FIREWALL_RISK_INDEXES) into SignalProcessor.RISK_SCHEMA, keyed by the same five risk categories the firewall previously gated on. - Block threshold is 50.0 (SignalProcessor's own sigmoid midpoint), so the firewall defers to SignalProcessor's judgment rather than maintaining a second, independently-tuned threshold. - build_time_multiplier (10x for setup.py/package.json/etc.) now scales the post-sigmoid score rather than pre-sigmoid hit counts, since multiplying raw counts pre-sigmoid and multiplying the sigmoid's output are not equivalent (saturates differently). Treated as a deliberate, tested behavior change rather than an assumed equivalence. - The firewall previously read a "dependency_network" key that nothing in the codebase ever wrote (network_multiplier was silently always 1.0 in production); this drops that dead read rather than reproducing it. Rewrote the 5 tests that exercised the old density-based scoring (test_behavioral_threat_evaluation[_strips_prefix], build/density multiplier tests, memory_corruption_detection) against risk_vector fixtures, with the threshold-crossing math spelled out in each docstring. The other 11 tests in the file exercise only import logic and needed no changes. Not in this change: the SecurityLens(policy=...)/ThreatPolicy cleanup cascade at the remaining call sites (galaxyscope.py x3, vault_sentinel.py, sbom_recorder.py) and actually wiring up network-centrality/blast-radius weighting (previously inert, so out of scope for a behavior-preserving fix). Co-Authored-By: Claude Sonnet 5 <[email protected]>
Contributor
5 tasks
squid-protocol
added a commit
that referenced
this pull request
Jul 23, 2026
Follow-up to #302 (which deleted SecurityLens.evaluate_risk() and self.policy). ThreatPolicy existed solely to build the policy dict that evaluate_risk() consumed; with that method gone, every _active_policy / ThreatPolicy.get_policy(...) call site is dead code, and SecurityLens's policy kwarg is silently ignored (the constructor no longer stores or reads it). Re-ran a repo-wide grep for ThreatPolicy/SecurityLens(policy= before touching anything, per the original cleanup plan, to confirm scope: - galaxyscope.py (3 sites): worker init, Orchestrator.__init__, and the CLI args.paranoid path. Dropped the ThreatPolicy import and the _active_policy if/else blocks; SecurityLens(policy=_active_policy) -> SecurityLens(). The CLI site's "ZERO-TRUST MODE" log line stays under args.paranoid -- PARANOID_MODE is still live via SignalProcessor.is_paranoid, only the now-dead policy computation goes. - vault_sentinel.py, sbom_recorder.py: same import + constructor simplification. These call SecurityLens.scan_content(), never evaluate_risk(), so they were never broken -- just carrying a policy kwarg with no effect. ThreatPolicy the class itself is left in analysis_lens.py; the grep confirms it's now only self-referential (the class body and its own get_policy() classmethod), but deleting the class is a separate call from cleaning up its callers. Full test suite: 772 passed, 1 xfailed (pre-existing), 0 failures. Co-authored-by: Joe Esquibel <[email protected]> Co-authored-by: Claude Sonnet 5 <[email protected]>
5 tasks done
squid-protocol
added a commit
that referenced
this pull request
Jul 23, 2026
Follow-up to #302's discovery that the firewall's old evaluate_risk() read a "dependency_network" key nothing ever wrote, so network_multiplier was silently always 1.0 in production -- a previously-inert feature, never actually live. This wires it up for real, deliberately, as its own reviewed change rather than folding it into the #302 refactor. Design decisions (both discussed and confirmed before implementing): - Formula: reuse the old evaluate_risk multiplier shape -- starts at 1.0, += blast_radius * 0.5 if normalized_blast_radius > 1.0, += 0.5 if betweenness_score > 0.05 -- applied post-hoc to the risk_vector score (same pattern #302 established for build_time_multiplier). This is an only-amplify design: a peripheral, low-centrality file is judged on its own merits and never gets a discount; only high-centrality "hub" files get less tolerance for the same embedded threat signal. - Rollout: opt-in via a new FIREWALL_NETWORK_WEIGHTING config flag (default False), mirroring Phase 10.5's MAX_SYSTEMIC_THREAT gate (also off-by-default). Since this feature never actually ran before, flipping it on unconditionally would be a silent behavior change for every existing firewall user the moment this ships -- opt-in keeps today's behavior unchanged until a repo explicitly turns it on. Reads file_node["telemetry"]["network_metrics"] (normalized_blast_radius, betweenness_score), written by network_risk_sensor.build_dependency_graph() at Phase 4 -- well before the firewall runs at Phase 10, same ordering guarantee #302 relied on for risk_vector from Phase 3. Added 3 tests: flag-off-by-default regression guard (proves the default itself, not just behavior under it), hub-file amplification crossing the block threshold vs. an identical peripheral file that doesn't, and the betweenness-only bonus in isolation. Full suite: 775 passed, 1 xfailed (pre-existing), 0 failures. Co-authored-by: Joe Esquibel <[email protected]> Co-authored-by: Claude Sonnet 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The firewall's behavioral scoring (evaluate_risk on SecurityLens) and SignalProcessor's risk scoring were two independent, disagreeing engines computing risk from the same underlying signals. SecurityLens.evaluate_risk() and its self.policy/ThreatPolicy plumbing are now dead, so run_firewall_audit reads the risk score SignalProcessor already computed at Phase 3 instead of recomputing density from raw equations counts.
Rewrote the 5 tests that exercised the old density-based scoring (test_behavioral_threat_evaluation[_strips_prefix], build/density multiplier tests, memory_corruption_detection) against risk_vector fixtures, with the threshold-crossing math spelled out in each docstring. The other 11 tests in the file exercise only import logic and needed no changes.
Not in this change: the SecurityLens(policy=...)/ThreatPolicy cleanup cascade at the remaining call sites (galaxyscope.py x3, vault_sentinel.py, sbom_recorder.py) and actually wiring up network-centrality/blast-radius weighting (previously inert, so out of scope for a behavior-preserving fix).
Description of Structural Changes
Visual Observatory Testing
The Differential Scan Acknowledgement