Repository navigation
Resolve the taint graph to a fixed point with sink-reachability pruning - #11951
Merged
Merged
Conversation
Taint resolution previously ran a fixed 40-round BFS and stopped at a hard-coded nesting limit, so flows longer than 40 hops were silently missed and the round count was unrelated to convergence. Run to a true fixed point instead: loop while sources and sinks remain, relying on the existing (id, taints) visited guard -- whose state space is finite -- to guarantee termination. This removes the resolution-depth limit entirely, so deep taint flows are no longer missed. Propagation semantics are otherwise unchanged: each (id, taints) state is explored exactly as before. Adds tests for a flow deeper than the old 40-hop cap (via plain assignments and via a chain of distinct specialized function calls) and for a sanitized array value that must not be reported. Co-Authored-By: Claude Opus 4.8
Restrict resolution to the sub-graph from which a sink is actually reachable, via a backward reachability pass from the sinks over the forward edges: a node from which no sink is reachable can never produce an issue, so propagating taint into it is wasted work. On real codebases the full taint graph is huge while this relevant sub-graph is tiny, which is what keeps running to convergence cheap. Specialized and unspecialized nodes are linked both by their authoritative unspecialized_id field and by the id-string separator, so the prune never drops a node whose specialized or de-specialized form can reach a sink (the resolution walk maps freely between the two). Co-Authored-By: Claude Opus 4.8
This was referenced Sep 15, 2026
Merged
danog
added a commit
to danog/psalm
that referenced
this pull request
Sep 22, 2026
Resolve the taint graph to a fixed point with sink-reachability pruning
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.
Taint resolution previously ran a fixed 40-round BFS and stopped at a hard-coded nesting limit, so flows longer than 40 hops were silently missed and the round count was unrelated to convergence.
This runs resolution to a true fixed point instead:
(id, taints)visited guard (whose state space is finite) to guarantee termination. Removes the resolution-depth limit entirely, so deep taint flows are no longer missed. Propagation semantics are otherwise unchanged.unspecialized_idfield and the id-string separator, so the prune never drops a live node.Adds tests for a flow deeper than the old 40-hop cap (via assignments and via a chain of distinct specialized calls) and for a sanitized array value that must not be reported.
Part 1 of a 4-PR stack making taint resolution deterministic and correct; the others build on this one.
🤖 Generated with Claude Code