Skip to main content

Data Flow / Call Graph

Use data-flow and call-graph tools to investigate how input moves through code and which functions call one another. For example: "Does untrusted input reach os.system? What functions transitively call execQuery?"

Fit: tracing input to potentially unsafe operations and investigating call paths that retrieval and LSP tools cannot resolve. Start with a specific question to investigate.

Both the individual and team options use Semgrep, but at different tiers. The CLI, rule syntax, and MCP tools stay the same; the tiers differ in how much code the analysis can follow.

Solo Dev — Semgrep Community Edition​

Semgrep Community Edition analyzes data flow within a function and matches patterns within a file. It is free, installs through pip, and includes an MCP server.

pip install semgrep
claude mcp add semgrep -s user -- semgrep mcp

Add these instructions to AGENTS.md:

For security or reachability questions ("does untrusted input reach this
function," "what could call this dangerous API," "find every place we do X
insecurely"), use Semgrep's MCP tools instead of writing your own greps.
Semgrep patterns look like the code and its dataflow engine tracks taint.

CE catches single-file lint patterns and pre-commit guardrails ("don't let the agent introduce subprocess.run(..., shell=True)"). Cross-file / cross-function reachability is where CE stops and the paid tier begins.

Org — Semgrep Code (paid tier)​

Semgrep Code uses the same CLI and MCP tools, but its analysis follows data across function and file boundaries. It can investigate whether input at a handler reaches an unsafe operation through a chain of function calls that Community Edition cannot trace.

Add Semgrep to your CI pipeline as a required PR check using your organization’s rulesets. The agent continues to use the same CLI and MCP tools with your organization’s licensed rulesets.

If your engagement forbids sending source to a paid SaaS: Joern is the on-premises alternative — native binary, no network during analysis, deepest interprocedural flow for a single language.

Dive deeper​