Repository navigation
feat: proof and refutation engine - #33
Merged
Merged
Conversation
6 tasks done
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.
Summary
Opens Phase 8 of
docs/architecture.md: the proof / refutation engine (§24). Every taint flow now gets a verdict before it becomes a finding.test: define proof and refutation behavior), implementation follows.findings/refutation.py:RefutationAnalysis(findings.refutation) walks the dominators of the sink block; each branch whose one side alone reaches the sink fixes the truth of its condition there. Conditions are interpreted: string validators (isdigit(),isalnum(), ...), membership in a constant allowlist and equality with a constant prove a value safe;not,andandorcombine as expected; a recognised check evaluated the wrong way yields nothing; any other condition mentioning the value is a guard that does not prove it. Proofs follow data dependencies, so a validated name stays validated inside"SELECT ... " + name, and every tainted origin of the argument must be proven.REFUTED(all origins proven, or the sink unreachable by constant propagation),HOTSPOT(an unproven guard mentions the value),VULNERABILITY(no guard at all). Each carries a one-line evidence string.TaintDetectorconsults the verdicts: refuted flows are dropped, hotspots are reported with medium confidence, vulnerabilities with high confidence;verdictandevidencego into the finding metadata. Detector manifests declarefindings.refutation.The §24 example,
if not value.isdigit(): returnbefore the sink, is refuted withguarded by isdigit().Not in this PR: numeric range analysis, authorization guards, and a
RefutationPlugintype letting plugins add evidence; the engine's rule set is fixed for now.Part of #32