Repository navigation
Description
Pattern observed
In one review pass, we found six independent instances of the same failure
shape: a consumer reads a dict/schema key that no producer ever writes,
under either the exact name or a near-miss rename.
SecurityLens.evaluate_risk()vsSignalProcessor's_calc_*methods --
two full disagreeing implementations of the same five risk categories (Two independent, disagreeing implementations of the same risk-scoring logic #249)supply_chain_firewall.pyreadingdependency_network-- key never written
anywhere; real data lives attelemetry.network_metrics(found during Two independent, disagreeing implementations of the same risk-scoring logic #249)signal_processor.pyreadingghost_meta["aperture_reason"]-- real key
isreason, and even that only gets copied on the opposite branch condition
from the one that matters (the "CRITICAL LEAK" shunt case)statistical_auditor.pyreadingartifact["lang_mix"]-- never written
anywhere, silently disabling polyglot-file detectionlanguage_standards.py's AI/LLM SDK names hand-pasted into 2 of 57
language blocks instead of using the established GLOBAL_ pattern (AI/LLM detection sensor cluster (llm_api, llm_orchestrator, ai_tools, etc.) is entirely non-functional -- no rule ever produces these signals #313
follow-up)AIAppSecSensorreading 7 of 8 inputs from atelemetrynamespace that
nothing populates (companion issue)
That's a strong enough pattern to treat as a process problem, not a string
of unlucky typos. All six were invisible at runtime (no exceptions, no
crashes -- code just silently computed nothing, or the wrong thing) and were
only found by manually grepping every .get("key"...) call against every
["key"] = / "key": assignment across the codebase.
Proposed fix: automate the manual diff
A one-time investment: a small static-analysis script that:
- Walks every
.get("some_key"(and equivalent dict-access patterns)
across the repo. - Cross-references each key against every place it's ever assigned
(["key"] =, dict-literal construction,.setdefault(, etc.). - Flags any read key with zero matching writes anywhere in the codebase.
- Runs as a CI check (or pre-commit hook), not just an ad-hoc audit.
Expect real noise on the first pass (config constants from external files,
legitimate external JSON schema keys like lockfile fields, keys that are
genuinely optional by design) -- the first sub-task is tuning it down to a
low-noise signal, not just writing the walker.
Sub-tasks
- Build the key-read vs key-write static analysis script
- Tune out false positives (external config constants, legitimate
optional keys, third-party JSON schema fields) - Wire into CI as a required check
- Fix each of the 6 enumerated instances above (linked once individually filed)
Workflow context
Several of these instances (at least #249's duplicate-math case and the
AIAppSecSensor telemetry mismatch) trace back to AI-assisted coding sessions
(Gemini) producing plausible-looking consumer code against a producer that
was never actually built or was renamed later without updating the consumer.
Worth keeping this epic open as the place that documents the pattern, even
as individual instances get fixed piecemeal.
Activity
squid-protocol commentedon Jul 24, 2026
Found a 7th instance of this pattern while scoping #102/#106:
dev_agent_firewall.py's "Metaprogramming Hallucination Risk" rule readstelemetry["doc_density"], which no producer anywhere in the codebase ever writes — the.get(..., 1.0)default always wins, so the< 0.2check can never fire. Filed as #345, since it's being superseded by #106's rework rather than patched in isolation.Build and tune the dead key auditor (#325) (#362)
5 remaining items
Wire the dead key auditor into CI as a baseline-gated required check (#…
Revive AIAppSecSensor's Over-Permissioned Agent rule with a real sign…
Dampen Silent Mutation Risk with real test coverage (#373) (#384)
Fix "aperture_reason" -> "reason" key mismatch (#374)
Fix TYPOSQUAT_WHITELIST, typosquat_hits, and disqualifiers (#375, #376,
Fix "aperture_reason" -> "reason" key mismatch (#374) (#385)
Fix TYPOSQUAT_WHITELIST, typosquat_hits, and disqualifiers (#375, #376,
Fix TYPOSQUAT_WHITELIST, typosquat_hits, and disqualifiers (#375, #376,
squid-protocol commentedon Jul 24, 2026
All 4 sub-tasks complete:
tests/dead_key_audit.py(Build and tune the dead key auditor (#325) #362), an AST-based walker with f-string prefix-write matching for thesec_{key}pattern.dead-key-audit.ymlworkflow (Wire the dead key auditor into CI as a baseline-gated required check (#325) #363).ai_toolsguardrail, revived withllm_orchestratorrepo_z_scorebackfillmax_big_obackfill from the network graphaperture_reason->reasonrenameTYPOSQUAT_WHITELISTconfig key addedtyposquat_hitsbackfilled into summary.mdisqualifiers populatedtests/dead_key_audit_baseline.jsonis now{}-- zero outstanding findings. The CI check will fail on any NEW instance of this pattern from here on.One related item intentionally left open as a candidate for separate future work:
AIAppSecSensor's "companion issue" reference andai_appsec_sensor.pymore broadly weren't audited beyond theai_toolsfix in #365 -- worth a dedicated pass if useful.Closing.
Adopt ruff for linting and formatting, replacing flake8 (#469)
Adopt ruff for linting and formatting, replacing flake8 (#469) (#470)