
Prahari — Security-Aware C Compiler and IDE
A C compiler whose own dataflow analyses prove how attacker-controlled data reaches a dangerous call — then fix it and re-verify the fix.
- Seven, source to sink
- 1,833
- SARIF 2.1.0
What it had to solve
A linter matches patterns over syntax, so it flags strcpy because the name sounds dangerous and drowns real findings in noise. The question that matters is different: can attacker-controlled data reach this operation, and is anything standing in the way? Answering it needs exactly the structures a compiler already builds, reaching definitions, liveness, a control-flow graph in SSA form, and it has to follow data across function boundaries rather than stopping at the first call. Then a fix has to be checked by something that cannot simply claim success.
The decisions that shaped it
One worklist solver, four analyses
Reaching definitions, live variables, taint propagation and a heap state machine are all instances of one generic worklist solver with edge transfer functions. It knows about blocks, edges, a lattice and a transfer function, and nothing about taint or the heap, so adding a weakness class costs a transfer function and a description, not an engine.
Across function boundaries
Taint summaries are computed bottom-up over the condensation of the call graph, with fixpoint iteration for recursive components. So build_command(host, cmd) is not a wall the analysis stops at: it is a summary that says parameter 0 flows to parameter 1, unsanitised, and the trace continues to system().
A finding is a path, not a line
Every finding shows the source, each propagation step, the sink, the guards already on the path and the control that is missing. Seven classes are covered: command injection, unbounded copies, format strings, null dereference, double free, use after free and leaks. The included safe.c contains strcpy, system and malloc and produces zero findings.
Measured one component at a time
The ablation adds exactly one component per row: pattern matching alone detects 66.7% at 69% FPR; intraprocedural taint, then interprocedural summaries, then the heap state machine bring it to 100% detection at 0% FPR. On NIST Juliet C it is strong where the memory model can see the issue, double free 100% and use after free 86%, and the weak classes are reported, not hidden.
An IDE that renders the whole trace
LSP diagnostics cannot say “this value came from argv, crossed strcpy, then build_command, and arrived at system”. So findings travel over a custom prahari/findings notification with the full trace, rendered as clickable steps in a findings panel and mirrored into Problems and the gutter. The language server is the only boundary between Python and TypeScript, and nothing upstream in Theia is patched.
AI that the compiler checks
Prahari AI edits inside a workspace jail with reviewable diffs, but a finding counts as fixed only when the compiler and scanner re-analyse the file and it is gone. Hard-coded secrets are masked before anything reaches a hosted model. A separate adjudicator may only demote findings, never create one, raise confidence or change severity, and each invariant has a test.
How the pieces sit together
- Self-contained preprocessor → pycparser adapter → PrahariAST → semantic analysis
- Three-address code, CFG with dominators and dominance frontiers, SSA with φ placement and pruning
- One worklist solver: reaching definitions, live variables, taint, heap state machine
- Bottom-up taint summaries over the call graph’s condensation
- Seven CWE detectors → SARIF 2.1.0 with codeFlows, console trace, table
- Native optimisation passes, then LLVM IR, assembly, object files and executables
- Python, JavaScript/TypeScript, Java, PHP, Go, C# and configuration files
- Eclipse Theia desktop and browser apps over LSP on stdio plus a findings notification
- Workspace jail, tool loop, compiler-verified fixes, secret masking, key-pool failover
Built into the product
Audit
One command or one button: every finding with its full source-to-sink path, the guards on it and the control that is missing.
Fix all
Fixes every finding it can and re-verifies each with the compiler; only a finding that is actually gone counts as resolved.
Build
Compiles plain and optimised, runs both on the same input, and shows the measured execution time and whether the output matched.
Project scanner
125 of 125 detected on a 160-program labelled corpus, 0 of 56 safe programs flagged, across six languages and configuration files.
CI-ready output
SARIF that renders natively in GitHub code scanning, and exit codes that gate a pipeline.
Inspectable phases
IR, CFG, dataflow facts, summaries and LLVM output each viewable on their own, so nothing is a black box.
What it is built out of
- Python, pycparser, networkx, llvmlite
- pygls, LSP, JSON-RPC
- Eclipse Theia, TypeScript, Electron, Monaco, React
- SARIF 2.1.0, LLVM IR
- 1,833 tests, NIST Juliet v1.3, 11 CI jobs, Docker
What it looks like






What it produced
- 125/125
- Scanner detections, 0 of 56 safe files flagged
- 9/9
- Security pairs — gcc -fanalyzer 5/9
- 11
- CI jobs on every push, including byte-for-byte reproducibility