Repository navigation
Description
Summary
sec_tainted_injection (the O(H) data-flow taint tracker in security_lens.py) is score-dead and empirically near-useless. A corpus measurement shows ~0% recall and 0% precision. This issue documents the evidence and recommends expunging it via the #1020 freeze playbook.
Background: how it's wired today
- Computed:
security_lens.py:385-454(the "DATA FLOW & TAINT TRACKING" block) ->counts["tainted_injection"]. - Merged:
galaxyscope.pymerges it additively intosec_tainted_injection. - Self-amplified:
spatial_correlation.py:157("sec_tainted_injection": (("amplified_rce", 1),)) +:293-300.amplified_rceis not an independent consumer -- viaweighted_count()it only boosts the recorded weighted count ofsec_tainted_injectionitself. - Recorded: in
SIGNAL_SCHEMA(analysis_lens.py:1268), inSURFACE_FAMILIES["threat"](analysis_lens.py:1520, "additive only ... does not touch golden-mastered audit output"), and persisted to thethreat_tainted_injectionfile_data column (record_keeper.py:198). - NOT scored:
grep taintedinsignal_processor.py/detector.pyreturns nothing._calc_safety'sattack_hits(signal_processor.py:1614) uses onlyhigh_risk_execution,safety_bypasses,state_mutation.
It was already downgraded (#1020)
sec_tainted_injection used to drive a real score. Commit 8bc93b8 ("Remove AST-dependent Security & Vulnerability metrics", #1020) deleted the _calc_injection_surface method, whose only taint use was:
# ---> CONFIRMED TAINT VULNERABILITY <--- (deleted by #1020)
taint_confirmed = raw_signals.get("sec_tainted_injection", 0)
if taint_confirmed > 0:
injection_mass += taint_confirmed * 500.0 # Massive gravity spikeSince #1020 it is computed and recorded but feeds no risk_* score. #3022 later rebranded the sibling spike in that same deleted method (sec_amplified_sql_injection -> api_near_db_sink) after measuring it at ~0% precision.
Measurement
Ran security_lens.SecurityLens().scan_content() (the real detector) over a broad sample of training_repos (harness validated against the known-positive unit-test input first):
| Metric | Value |
|---|---|
| Source files scanned | 42,561 |
Files with io prereq |
561 (1.3%) |
Files with danger/db prereq |
3,374 (7.9%) |
| Files with both prereqs | 120 (0.28%) |
| Files with a taint hit | 4 (0.0094%) |
| Total hits | 4 |
Hand-evaluation of all 4 hits (real untrusted-input -> sink flow?):
brew/Library/Homebrew/bundle/brew.rb--Kernel.system(@postinstall)-- FALSE (formula-defined attribute, not external I/O)brew/Library/Homebrew/bundle/cask.rb--Kernel.system(postinstall)-- FALSE (same)openclaw-typescript/.../GatewayEndpointStoreTests.swift--URL(string: "ws://127.0.0.1:18789")-- FALSE (hardcoded localhost literal in a test; no exec sink)vapor/Tests/VaporTests/ServerTests.swift--app.http.client.shared.execute(-- FALSE (HTTP client.execute()in a test; verb misfire, not code/DB injection)
Precision: 0/4 = 0%. Recall: effectively 0 (4 in 42,561). Both dimensions fail; consistent with #3022's ~0% finding on the sibling signal.
Why an AST-less taint tracker can't win here
Per #1020/#3022's reasoning: without proving a value reaches a sink, taint reduces to "an io-classified line assigned a variable, and a danger/db verb later mentions that variable." On real code that is dominated by configured values (system(@postinstall)) and framework verbs (.execute(), URL(), which is exactly what the 4 hits are.
Recommendation: expunge (via the #1020 freeze playbook)
- Re-wire into scoring? No -- can't score 0% precision / 0% recall.
- Keep as descriptive/LLM signal? No -- surfacing a 0%-precision "threat" in reports misleads.
- Expunge:
- Delete the taint block in
security_lens.py(§4, lines ~385-454) and stop emittingtainted_injection. - Remove the
sec_tainted_injection -> amplified_rcecorrelation (spatial_correlation.py:157and the block at ~:293-300). - Freeze, do not hard-delete, the
SIGNAL_SCHEMA/threat_tainted_injectionnames as always-zero placeholders -- same treatment asprompt_injection/agentic_rce(Remove AST-dependent Security & Vulnerability metrics (Injection, RCE, Memory) #1020), because a trained model expects the column (security_auditor.py:405-415; dropping it feeds NaN viadf.reindex). - Re-bless golden masters with
python tests/tools/crucible_check.py --update --yes-- diff expected to be tiny (fires ~never).
- Delete the taint block in
References
- Remove AST-dependent Security & Vulnerability metrics (Injection, RCE, Memory) #1020 (removed the score that used taint), fix(#3018,#3019,#3020): stop overclaiming SQL injection from co-located regexes #3022 (~0% precision on sibling; api_near_db_sink), [METRICS] Wire ECOSYSTEM_MISMATCH_WEIGHTS injection penalty into security_auditor.py taint tracking #1089 (closed won't-do), [METRICS] Remove the dead
injectionkey from SignalProcessor._get_context_multipliers #3099 (dead injection-multiplier key) - Measurement scripts + raw results retained locally (scratchpad); reproducible via
security_lens.scan_contentovertraining_repos.
Activity
docs(security): correct signal, validation and blind-spot claims (#8442)