PyFlow: An Inter-procedural Static Analysis Framework for Python
Listen
Radio episode about this paper
Transcript
Introduction to the show: ident: Computer Science. The day in computer science: software, systems and theory on arXiv.
Tom: We're looking at the paper: "PyFlow: An Inter-procedural Static Analysis Framework for Python".
Paper summary: Tom: So this paper is about this framework called PyFlow which aims to do interprocedural static analysis for Python. The authors are Zinan Gu, Haoxiang Yan, and Peisen Yao from Zhejiang University.
Jane: It basically says that static program analysis can figure out things automatically, but doing it precisely across different parts of a program is really hard, especially in Python because it's so dynamic.
Lu: The core idea here is to solve this by creating a generic framework based on IFDS, which stands for Interprocedural Finite Distributive Subset. They're parameterized by these abstract domains they use.
Meng: What does that mean for us? It sounds like they're trying to build something that can handle the complexities of Python’s dynamic nature, like first-class functions and metaprogramming, which makes traditional analysis tricky.
Lalam: I see them implementing a taint analysis in PyFlow, and they are testing it against eight existing Python SAST tools. That sounds like a real test of whether this framework actually gives us better results.
Tom: Right, so the paper claims that PyFlow provides a multi-stage intermediate representation pipeline and a generic IFDS solver that lets developers focus only on the dataflow semantics, and the framework handles building the supergraph and caching summaries.
Jane: And they use this structure to implement two specific analysis clients: taint analysis and typestate analysis. That shows how flexible the generic solver is because it can handle structurally different problems like tracking resource states versus tracking tainted data.
Lu: What's interesting is that they use procedure summaries to get context sensitivity in the interprocedural dataflow, which means they reuse information about a function across all the places you call it.
Meng: From a production standpoint, I wonder how much overhead this pipeline adds when we are trying to ship models. The paper mentions the cost of Python's data model is high because one single statement can lower into five or more intermediate representation nodes.
Lalam: That cost is something I know well; dealing with that many nodes can really slow down the analysis, so how they manage that in their framework needs to be tight.
Tom: The evaluation shows PyFlow gets the best aggregate precision and recall among all nine tools on synthetic benchmarks, which is a strong result for a generic framework.
Jane: But more importantly, on the real-world benchmark with one hundred eight common vulnerabilities across sixty-two projects, PyFlow hit a recall of forty-eight point one percent and an F1 score of fifty-seven point five percent.
Lu: That recall figure is what really stands out because it shows that the precision they got was competitive even against the interprocedural taint engines already available.
Meng: Forty-eight percent recall on real code is better than most tools, but I still have to ask how they manage those false positives when you're deploying this thing to production environments where you can't afford constant alerts.
Lalam: The paper mentions that the precision remains competitive with the interprocedural taint engines, which suggests they aren't just chasing high recall at the expense of too many false alarms.
Tom: So, looking at this whole paper on PyFlow: it presents a generic framework designed to tackle Python’s dynamic semantics by using an IFDS approach and evaluating it against existing tools on both synthetic and real code.
Jane: And what that means for us is that we have a new way to build robust static analysis tools for Python where the developer only worries about the specific dataflow problem, not how to build the whole interprocedural solver from scratch.
Lu: The implication is that we can apply this same IFDS structure to other tricky languages by just plugging in different abstract domains for specific problems like typestate or nullness tracking.
Meng: For deployment, the paper points out that debugging this kind of analysis on real Python programs is hard because you have to reason about dynamic semantics and the IR lowering all at once.
Lalam: So, while the framework is powerful conceptually, making it practical for a developer who has to debug it on messy production code is a big challenge they acknowledge.
Tom: It sounds like PyFlow gives us a solid foundation for future research and tooling because it successfully translates precision gains seen on synthetic tests into real-world vulnerability detection without losing too much accuracy.
Jane: The framework itself is open source, available at the github link mentioned, which means the community can actually look at the implementation and try to extend it.
Lu: The authors are also sharing practical lessons about dealing with call-graph imprecision and the high cost of Python's data model when they debug their own analyses.
Meng: It shows that even with a generic solver, we still have to deal with the inherent difficulties of analyzing Python's execution model when we try to deploy it in the real world.
Lalam: The core idea is that this framework successfully demonstrates that its precision gains on synthetic benchmarks translate to real-world vulnerabilities, preserving recall without an excessive false positive rate.
Conclusion: Tom: So, PyFlow is this new framework for static analysis of Python that's designed to figure out how properties flow across different functions in a program, which is usually really hard because Python is so flexible with its code structure.
Jane: Right, it’s taking something that’s super complicated—interprocedural analysis—and making it generic so you can just plug in different tracking methods like taint or typestate without rewriting the whole engine.
Lu: The authors built this using a multi-level representation pipeline and an IFDS solver, which means they reduced the interprocedural problem down to checking reachability in a graph called the exploded supergraph.
Meng: From where I'm sitting, it sounds like they’ve managed to handle Python’s dynamic nature by creating this standardized structure that different analysis clients can use.
Lalam: What's really interesting is that they show how this single solver infrastructure can handle very different problems, like tracking data flow versus tracking resource states.
Tom: The results are pretty solid too. They tested it against eight existing tools on real-world vulnerabilities, and PyFlow got the best overall score in terms of precision and recall.
Jane: And they managed to keep the precision competitive with the taint engines, which is a big deal when you’re trying to find real bugs without drowning in false alarms.
Lu: It shows that their generic approach isn't just theoretical; it translates into measurable improvements on actual code problems.
Meng: I still have to wonder about how much overhead this pipeline adds when we actually try to deploy this thing on a large codebase, you know, what’s the runtime cost?
Tom: That's the next big question. The paper shows the framework is open source and available for research, so it sets a new foundation for how we might approach analyzing these tricky languages in the future.
Jane: It really lays out a clear path forward for building better tools for Python that can handle complexity without losing accuracy on real vulnerabilities.
Lu: And they've even shared some practical lessons on debugging this kind of analysis when you’re dealing with the messiness of real Python programs.
Zinan Gu, Haoxiang Yan, Peisen Yao
State Key Laboratory of Blockchain and Data Security, Zhejiang University
cs.PL
Submitted: 2026-08-07
Updated: 2026-12-03
Code: https://github.com/ZJU-PL/pyflow
License: http://creativecommons.org/licenses/by/4.0/
The gist: Static program analysis infers program properties automatically; yet precise interprocedural analysis remains challenging, and dynamically typed languages amplify the difficulty.
Key concepts
- IFDS
- Interprocedural Finite Distributive Subset is a framework used for dataflow analysis. It simplifies complex interprocedural problems by reducing them to graph reachability problems in an exploded supergraph. This allows the solver to efficiently track information across function calls.
- Generic Solver
- A single, reusable solver infrastructure that can be adapted for various analysis tasks. PyFlow instantiates this generic engine with different 'clients' like taint tracking or typestate checking, showing its versatility across structurally different problems.
- Multi-level Intermediate Representation (IR)
- A structured representation of source code created through a pipeline. This allows the framework to produce different levels of detail from the same initial code, which is crucial for feeding specialized analysis engines at the appropriate level of abstraction.
- Exploded Supergraph (ESG)
- The graph structure derived from the IFDS framework. It represents all possible execution paths and interactions between functions in a program. Solving reachability on this graph helps determine how data or properties flow through the entire program.
Terminology
Summary
Static program analysis infers program properties automatically; yet precise interprocedural analysis remains challenging, and dynamically typed languages amplify the difficulty. p. 0 Static program analysis infers program properties automatically. Yet precise interprocedural analysis remains challenging, and dynamically typed languages amplify the difficulty. Python is particularly
problematic: dynamic dispatch, first-class functions, metaprogramming,
pervasive exceptions, and an object model based on descriptors and
attribute-driven lookup collectively impede precise reasoning. We present
PyFlow, a generic IFDS-based static-analysis framework for Python.Where the paper says it
Where the paper says it
Framework Design and Architecture
PyFlow provides a multi-stage intermediate-representation pipeline and a generic IFDS solver parameterized by abstract domains. The frontend and IR pipeline perform source extraction, dependency resolution, and class-hierarchy construction to produce a unified multi-level representation shared by all analyses. p. 1 We present PyFlow, a generic IFDS interprocedural dataflow framework for
Python. The frontend and IR pipeline perform source extraction, dependency
resolution, and class-hierarchy construction to produce a unified multi-level representation shared by all analyses. The frontend and IR pipeline perform source extraction, dependency
resolution, and class-hierarchy construction to produce a unified multi-level representation shared by all analyses. An LLVM-inspired pass manager provides dependency resolution, caching, and invalidation across the pipeline, and a pointer
analysis supplies the heap alias information. Tool Inter- Context- Flow- Generic Pointer
procedural sensitive sensitive IFDS analysis
Bandit − − − − −
Semgrep ◦ − − − −
Mypy ◦ ◦ − − −
Pyright ◦ ◦ − − −
Pylint − − − − −
Scalpel • ◦ ◦ − −
PyFlow • • • • •
3 System Architecture
PyFlow’s architecture is structured as a layered pipeline. The frontend transforms source code into a multi-level intermediate representation; the optimisation
pass manager orchestrates transformations across the pipeline; and the analysis
engines (pointer analysis, IFDS solver, security clients) consume the shared IR
through their respective entry points. Tool Inter- Context- Flow- Generic Pointer
procedural sensitive sensitive IFDS analysis
Bandit − − − − −
Semgrep ◦ − − − −
Mypy ◦ ◦ − − −
Pyright ◦ ◦ − − −
Pylint − − − − −
Scalpel • ◦ ◦ − −
PyFlow • • • • •
3 System Architecture
PyFlow’s architecture is structured as a layered pipeline. The frontend transforms source code into a multi-level intermediate representation; the optimisation
pass manager orchestrates transformations across the pipeline; and the analysis
engines (pointer analysis, IFDS solver, security clients) consume the shared IR
through their respective entry points.Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Interprocedural Dataflow Mechanism
Dataflow analysis propagates information about a property of interest—dataflow facts—over a program model. When flow functions are monotone and distributive with respect to the merge operator, the analysis can be cast in the Interprocedural Finite Distributive Subset (IFDS) framework. p. 5 4 Interprocedural Dataflow Analysis
Dataflow analysis propagates information about a property of interest—dataflow
facts—over a program model (typically a control-flow graph) and captures the
effect of each statement on these facts via flow functions [6, 21]. When flow
functions are monotone and distributive with respect to the merge operator, the
analysis can be cast in the Interprocedural Finite Distributive Subset (IFDS)
framework [17] or its generalization, the Interprocedural Distributive Environments (IDE) framework [18]. When flow
functions are monotone and distributive with respect to the merge operator, the
analysis can be cast in the Interprocedural Finite Distributive Subset (IFDS)
framework [17] or its generalization, the Interprocedural Distributive Environments (IDE) framework [18]. IFDS reduces an interprocedural dataflow problem to graph reachability in
the exploded supergraph (ESG). Reachability from a distinguished tautological node Λ corresponds to validity: ⟨n, d⟩ is reachable iff d holds
at n. Unlike the call-string approach [21], which requires an a priori bound k,
IFDS attains context sensitivity via procedure summaries: once the solver computes a summary for a given (start-fact, end-fact) pair, it reuses that summary at
all call sites.Where the paper says it
Where the paper says it
Where the paper says it
Analysis Clients and Domain Modeling
The generic solver is instantiated with three analysis clients: taint, nullness, and typestate. The Taint analysis tracks facts as access-path pairs rooted at a storage location. p. 8 Taint analysis. Facts are access-path pairs rooted at a storage location (local
variable, field, or container element). Analysis clients compose these primitives with application-specific logic. For
example, the taint analysis combines GenFlow (to introduce taint at source calls)
with IdentityFlow (to preserve existing taint across unrelated statements) and
custom kill logic (to remove taint at sanitizer calls). get(key) on a tainted dictionary produces a tainted return value—by resolving the container’s abstract storage slots. Typestate analysis tracks resource lifecycle states via finite-state automata. This client demonstrates the generic-solver advantage: typestate problems are
structurally different from taint (finite automaton vs. access-path propagation),
yet both share the same solver and supergraph infrastructure.Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Evaluation Against Existing Tools
PyFlow is evaluated against eight widespread Python SAST tools on synthetic and real-world benchmarks. On the synthetic benchmark, PyFlow achieves the best aggregate precision, recall, and F1-score among all nine tools. p. 0 On the synthetic benchmark, PyFlow achieves
the best aggregate recall and F1 score among all nine tools. On the realworld benchmark, it attains the highest recall and F1 score while maintaining precision competitive with taint-based engines. 8%, respectively. On the real-world benchmark (108 CVEs across 62 projects),
PyFlow attains the highest recall (48. We implement a taint analysis in PyFlow and evaluate it against eight
Python SAST tools (DevSkim, Dlint, Bandit, Bearer, CodeQL, Pysa,
Semgrep, and Snyk) on the synthetic and real-world benchmarks from a
recent ICSE ’26 study. On the synthetic benchmark, PyFlow achieves
the best aggregate recall and F1 score among all nine tools. 1%) and F1-score (57. 5%) while keeping
precision competitive with the interprocedural taint engines.Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Practical Implementation Challenges
Developing static analysis for Python presents challenges due to its dynamic semantics. Call-graph imprecision is a major issue because Python provides no nominal type system that can resolve most call targets statically. p. 9 Call-graph imprecision and its impact. Unlike Java or C++, Python provides no nominal type system that can resolve most call targets statically. PyFlow: An Inter-procedural Static Analysis Framework for Python 3
– We describe the design of the multi-level IR pipeline and generic IFDS solver,
which together enable interprocedural dataflow analysis for Python. – We share practical lessons from building and debugging IFDS analyses on
real-world Python programs, covering call-graph imprecision, the cost of
Python’s data model, exceptional control flow, and debugging strategies. Existing Python static analyzers such as Pysa [11] and CodeQL [5] support taint
tracking, but via special-purpose mechanisms—summary-based fixed-point iteration and ESSA-graph reachability, respectively—and do not expose a general
IFDS/IDE-style abstraction. This section presents PyFlow’s IFDS implementation, its adaptation to Python’s dynamic semantics, and the analysis clients
built on top of it.Where the paper says it
Where the paper says it
Where the paper says it
Conclusion
PyFlow is released as open source to support future research and tooling. The framework successfully demonstrates that its precision gains on synthetic benchmarks translate to real-world vulnerabilities, preserving recall without an excessive false positive rate. p. 1 We evaluate PyFlow’s taint analysis against eight widespread Python SAST
tools (DevSkim, Dlint, Bandit, Bearer, CodeQL, Pysa, Semgrep, and Snyk) on
the synthetic and real-world benchmarks released by the recent ICSE ’26 study
of Python SAST tools [8], spanning web frameworks, HTTP clients, CLI tools,
and data pipelines. On the synthetic benchmark—240 programs (120 vulnerable and 120 patched) covering six CWE categories—PyFlow achieves the best
aggregate precision, recall, and F1-score of all nine tools: 83. Existing Python static analyzers such as Pysa [11] and CodeQL [5] support taint
tracking, but via special-purpose mechanisms—summary-based fixed-point iteration and ESSA-graph reachability, respectively—and do not expose a general
IFDS/IDE-style abstraction. This section presents PyFlow’s IFDS implementation, its adaptation to Python’s dynamic semantics, and the analysis clients
built on top of it. PyFlow: An Inter-procedural Static Analysis
Framework for Python
Zinan Gu, Haoxiang Yan, and Peisen Yao
The State Key Laboratory of Blockchain and Data Security, Zhejiang University,
Hangzhou, China
{guzinan1998, yanhx, pyaoaa}@zju. cn
Abstract. PyFlow: An Inter-procedural Static Analysis
Framework for Python
Zinan Gu, Haoxiang Yan, and Peisen Yao
The State Key Laboratory of Blockchain and Data Security, Zhejiang University,
Hangzhou, China
{guzinan1998, yanhx, pyaoaa}@zju. cn
Abstract.Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Artifact Availability
The PyFlow implementation, including the IFDS engine, analysis models, and PySASTBench evaluation harness is publicly available at https://github.com/ZJU-PL/pyflow.
Green — the paper says it, and the page is printed. Red — no passage carries it, so treat that sentence as unverified. The same check runs on your own text: check a summary against its source, $5.
Improvements for AI systems
-
Context-sensitive interprocedural dataflow analysis for Python can be achieved by parameterizing a generic IFDS solver over abstract domains, enabling reuse across different analysis clients like taint, typestate, and beyond. This allows analysis developers to implement only the dataflow semantics while the framework constructs the supergraph and performs fixed-point iteration.
-
The system can perform precise taint tracking in complex Python applications by using an access-path domain where each fact is a pair ⟨location, access path⟩, which is enriched by pointer analysis to resolve field accesses on heap-allocated objects. This enables
field-sensitive taint tracking.
-
The framework can handle complex control flow and dynamic language features by employing a multi-level IR pipeline that includes SSA form and dependence graphs (PDG/CPG). This allows different engines, such as an IFDS solver needing the supergraph, to consume representations tailored to their needs, while the frontend handles
source extraction, dependency resolution, and class-hierarchy construction.
-
The AI system can improve code quality by integrating typestate analysis that tracks resource lifecycle states via finite-state automata. This allows detection of errors like
reading from a closed file
by tracking state transitions through methods called on resources in unexpected states. -
The tool can enhance debugging capabilities by providing tracing and provenance features, where the solver records a predecessor graph for every propagated path edge, enabling users to reconstruct the propagation chain for any reported finding via an
explain facility.
Abstract
Static program analysis infers program properties automatically. Yet precise interprocedural analysis remains challenging, and dynamically typed languages amplify the difficulty. Python is particularly problematic: dynamic dispatch, first-class functions, metaprogramming, pervasive exceptions, and an object model based on descriptors and attribute-driven lookup collectively impede precise reasoning. We present PyFlow, a generic IFDS-based static-analysis framework for Python. PyFlow provides a multi-stage intermediate-representation pipeline and a generic IFDS solver parameterized by abstract domains. Analysis developers implement only the dataflow semantics; the framework constructs the supergraph, performs fixed-point iteration, and caches summaries. We implement a taint analysis in and evaluate it against eight Python SAST tools (DevSkim, Dlint, Bandit, Bearer, CodeQL, Pysa, Semgrep, and Snyk) on the synthetic and real-world benchmarks from a recent ICSE '26 study. On the synthetic benchmark, PyFlow achieves the best aggregate recall and F1 score among all nine tools. On the real-world benchmark, it attains the highest recall and F1 score while maintaining precision competitive with taint-based engines. We conclude with lessons learned from building IFDS analyses for Python.
Sources
Related papers
- Omnidirectional type inference for ML: principality any way
- The Best of Times, the Worst of Times: Moment-Based Analysis of Probabilistic Cost Structures
- Formal Verification of an Out-of-Order Multiprocessor against an In-Order Weak-Memory ISA
- ETAS: An Effect-Typed Language for Agent Systems
- Fuss-free cumulative universes: theory and practice
- Function Contracts and Beyond: Machine-Checked Assurance Cases for Conformance of C Libraries to Their Requirements