Cross-function taint phase 1: single-file return propagation (0.20.0) - #24
Merged
Conversation
First real engine upgrade beyond single-function tracking. Adds a minimal same-file call
graph and applies it to AG040 (insecure model-output handling).
Engine (astutils):
- function_defs(tree): map function name -> its definition (first wins) — the minimal
call graph for resolving a plain helper(x) call to its def in the same file.
- return_values(func): the value expressions of func's own return statements, scope-
respecting (does not descend into nested functions).
AG040 now follows model output across a local helper's return:
def get_response(p): return llm.invoke(p)
def run(p): exec(get_response(p)) # now caught; before, taint died at the boundary
Handles return-via-variable and .content/.choices accessors on the helper result. Bounded
depth (guards against deep/cyclic chains); still single-file (no cross-module reachability).
Verification:
- Ground-truth corpus: 156 cases, precision 1.000 / recall 1.000 (adds cross-function cases:
helper returns model, via-variable, accessor, bare-return; negatives: helper returns
non-model, unknown/undefined callee, over-depth chain).
- Real-repo benchmark: AG040 = 0 across 41 repos — zero false positives, total findings flat.
- 623 tests, 100% branch coverage, ruff + ruff format + mypy all clean.
README limits note updated (now: single-file cross-function taint; not yet cross-module).
Bumps 0.19.0 -> 0.20.0.
Signed-off-by: AutonomyProof <info@autonomyproof.io>
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.
First engine upgrade beyond single-function tracking. New astutils.function_defs/return_values build a minimal same-file call graph; AG040 now follows model output across a local helper's return.
Verified: corpus 156 cases 1.000/1.000; AG040=0 across 41 repos (zero FP); 623 tests, 100% coverage. Bumps 0.19.0 -> 0.20.0.