You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(symbolic): T6 -- SQLi/race-condition pattern-matching prototype, real RuleEngine bug fix
Fase 5 of the research roadmap: SQL Injection Prevention and No
Check-Then-Act Race have existed as KG rules since the project's
earliest seed data, each with a PRE/POST formal_spec, but neither was
ever wired to anything that extracts those preconditions from real
code -- prompt guidance only, never independently checked.
symbolic/security_facts.py adds two narrow, well-documented AST fact
extractors (SQL query built via concatenation/f-string/%-format/
.format() into an execute-like call, with one-hop variable resolution
and recognition of the safe parameterized-query idiom; unguarded
check-then-act on a shared container, tracking real with-block
containment for the lock guard). Z3 cannot help here regardless --
microsoft/z3guide's own Strings page (fetched as real evidence in the
prior evidence-pipeline work) states its string solver is "an
incomplete heuristic solver" and the combined theory "is not decidable
anyway."
Wiring the race-condition extractor's output into the pre-existing
RuleEngine.apply_rule_to_code surfaced a real design gap, not by
inspection but by running it: that method is a positive-derivation
checker (precondition met -> derive postcondition -> PASS) with no
code path that ever returns FAIL, for any input. Fed a rule whose PRE
names a dangerous pattern, meeting that PRE derives the POST and
reports PASS on genuinely vulnerable code. Fixed via a new, additive
check_for_violation method (apply_rule_to_code itself untouched --
nothing else calls it) with the inverse framing: FAIL if the trigger
is present and unmitigated, PASS if mitigated, UNKNOWN if the trigger
doesn't apply (never an affirmative "proven safe"). Also corrected SQL
Injection Prevention's formal_spec from prose to the same fact-string
syntax No Check-Then-Act Race already happened to use.
Verified end-to-end against hand-written vulnerable/safe fixtures for
both patterns (neither existing security benchmark covers SQLi or race
conditions) and against the two closest existing security-benchmark
shapes, with zero false positives.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
0 commit comments