|
1 | | -<p> |
2 | 1 | <div align="center"> |
3 | | - <img src="./assets/cpv.png" alt="Code Pathfinder" width="100" height="100"/> |
4 | | -</p> |
| 2 | + <img src="./assets/banner.png" alt="Code Pathfinder - AI-Native static code analysis security scanner" width="100%"> |
| 3 | +</div> |
| 4 | + |
| 5 | +<div align="center"> |
5 | 6 |
|
| 7 | +[Website](https://codepathfinder.dev/) • [Installation](https://codepathfinder.dev/docs/quickstart) • [Rule Registry](https://codepathfinder.dev/registry) • [How to write rule?](https://codepathfinder.dev/docs/rules) • [VS Code](https://marketplace.visualstudio.com/items?itemName=codepathfinder.secureflow) • [Open VSX](https://open-vsx.org/extension/codepathfinder/secureflow) |
6 | 8 |
|
7 | 9 | [](https://github.com/shivasurya/code-pathfinder/actions/workflows/build.yml) |
8 | 10 | [](https://marketplace.visualstudio.com/items?itemName=codepathfinder.secureflow) |
9 | | -[](https://www.npmjs.com/package/@codepathfinder/secureflow-cli) |
10 | 11 | [](https://open-vsx.org/extension/codepathfinder/secureflow) |
11 | 12 | [](https://github.com/shivasurya/code-pathfinder/blob/main/LICENSE) |
12 | 13 | [](https://deepwiki.com/shivasurya/code-pathfinder) |
| 14 | + |
13 | 15 | </div> |
14 | 16 |
|
15 | | -# Code Pathfinder |
| 17 | +# [Code Pathfinder](https://codepathfinder.dev) |
16 | 18 |
|
17 | | -**An open-source security suite aiming to combine structural code analysis with AI-powered vulnerability detection.** |
| 19 | +With AI tools generating thousands of lines of code in seconds, the bottleneck has shifted from writing code to reviewing and securing it at scale. Traditional static analysis tools struggle with modern AI-generated codebases that mix languages, frameworks, and infrastructure-as-code in the same repository. |
18 | 20 |
|
19 | | -Code Pathfinder is designed to bridge the gap between traditional static analysis tools and modern AI-assisted security review. While mature tools excel at pattern matching and complex queries, Code Pathfinder focuses on making security analysis more accessible, leveraging large language models to understand context and identify nuanced vulnerabilities, and integrated throughout the development lifecycle. |
| 21 | +Code Pathfinder flips this model. Instead of brittle regex or AST pattern matching per language, it indexes your entire codebase as structured, queryable data (AST, CFG, DFG). Write language-agnostic queries that trace data flows across Python, [Dockerfiles](https://codepathfinder.dev/registry), and [docker-compose](https://codepathfinder.dev/blog/announcing-docker-compose-security-rules) in a single rule—critical for CVE detection and vulnerability research when you need to understand how dependencies are used, what privileges they run with, and what attack surface they expose. |
20 | 22 |
|
21 | | -- **Real-time IDE integration** - Bringing security insights directly into your editor as you code |
22 | | -- **AI-assisted analysis** - Leveraging large language models to understand context and identify nuanced vulnerabilities |
23 | | -- **Unified workflow coverage** - From local development to pull requests to CI/CD pipelines |
24 | | -- **Flexible reporting** - Supporting DefectDojo, GitHub Advanced Security, SARIF, and other platforms |
| 23 | +## What it is |
25 | 24 |
|
26 | | -Built for security engineers and developers who want an extensible, open-source alternative that's evolving with modern development practices. Here are the initiatives: |
| 25 | +- **[Open-source SAST](https://codepathfinder.dev)** that combines structural analysis (call graphs, dataflow, taint tracking) with AI to [understand real exploit paths](https://codepathfinder.dev/blog/static-analysis-isnt-enough-understanding-library-interactions-for-effective-data-flow-tracking), not just regex hits. |
| 26 | +- **AI-powered vulnerability hunting** via [SecureFlow](https://codepathfinder.dev/secureflow-ai), which layers 10+ models (Claude, GPT, Gemini, Grok, Ollama, etc.) on top of deterministic analysis for [context-aware triage](https://codepathfinder.dev/blog/introducing-secureflow-cli-to-hunt-vuln). |
| 27 | +- **Developer-first workflow** with [IDE integration](https://codepathfinder.dev/docs/quickstart), CLI, and CI support so security checks land where code is written and reviewed. |
27 | 28 |
|
28 | | -- **[Code-Pathfinder CLI](https://github.com/shivasurya/code-pathfinder/releases)** - Basic security analysis scanner better than grep |
29 | | -- **[Secureflow CLI](https://github.com/shivasurya/code-pathfinder/tree/main/extension/secureflow/packages/secureflow-cli)** - Claude-Code for security analysis powered by large language models with better context engineering |
30 | | -- **[Secureflow VSCode Extension](https://github.com/shivasurya/code-pathfinder/tree/main/extension/secureflow)** - IDE integration for security analysis powered by large language models with better context engineering |
| 29 | +## Why it's different |
31 | 30 |
|
32 | | -## :tv: Demo |
| 31 | +- **Graph-first engine**: builds a rich representation of [functions, endpoints, DB calls, and dataflows](https://codepathfinder.dev/blog/static-analysis-isnt-enough-understanding-library-interactions-for-effective-data-flow-tracking) to cut false positives and surface real source‑to‑sink issues. |
| 32 | +- **LLM as validator, not oracle**: uses models to [explain, prioritize, and validate findings](https://github.blog/ai-and-ml/llms/how-ai-enhances-static-application-security-testing-sast/) after structural analysis, keeping behavior predictable and reproducible. |
| 33 | +- **Privacy‑first, BYOK**: your code stays local; you [bring your own keys](https://codepathfinder.dev/secureflow-ai) and talk directly to providers with no vendor-side code ingestion. |
33 | 34 |
|
34 | | -### Secureflow CLI |
| 35 | +## Where it fits in your stack |
35 | 36 |
|
36 | | -```bash |
37 | | -$ secureflow scan ./path/to/project |
38 | | -``` |
| 37 | +- **Local & IDE**: SecureFlow VS Code extension ([VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=codepathfinder.secureflow) | [Open VSX](https://open-vsx.org/extension/codepathfinder/secureflow)) for real‑time security feedback as you type. |
| 38 | +- **CLI & agents**: [SecureFlow CLI](https://www.npmjs.com/package/@codepathfinder/secureflow-cli) runs agentic loops over your repo (profile, read, trace, validate) to hunt vulnerabilities with the same ergonomics as modern AI coding tools. |
| 39 | +- **Pipelines & reporting**: integrates into CI/CD and exports to formats and systems like SARIF, [GitHub Advanced Security](https://github.com/shivasurya/code-pathfinder), and DefectDojo so findings flow into existing governance. |
39 | 40 |
|
40 | | -### Code-Pathfinder CLI |
| 41 | +## Project components |
41 | 42 |
|
42 | | -```bash |
43 | | -docker run --rm -v "./src:/src" shivasurya/code-pathfinder:stable-latest ci --project /src/your-project --ruleset cpf/java |
44 | | -``` |
| 43 | +- **[Code Pathfinder CLI](https://codepathfinder.dev/blog/codeql-oss-alternative)** – structural security scanner and query engine for code graphs, better than grep/AST‑only search for paths and patterns. |
| 44 | +- **[SecureFlow CLI](https://www.npmjs.com/package/@codepathfinder/secureflow-cli)** – AI‑powered vulnerability hunter that uses agent loops and 10+ models for deep, context‑aware scans across real projects. |
| 45 | +- **SecureFlow VS Code extension** ([VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=codepathfinder.secureflow) | [Open VSX](https://open-vsx.org/extension/codepathfinder/secureflow)) – in‑editor experience for running scans, reviewing traces, and getting AI‑validated security insights without leaving your workspace. |
| 46 | +- **[Custom Rules](https://codepathfinder.dev/docs/rules)** – write your own security rules using the PathFinder query language to detect project-specific vulnerabilities and patterns. |
45 | 47 |
|
46 | | -## :book: Documentation |
| 48 | +## Supported Languages |
47 | 49 |
|
48 | | -- [Documentation](https://codepathfinder.dev/) |
49 | | -- [Pathfinder Queries](https://github.com/shivasurya/code-pathfinder/tree/main/pathfinder-rules) |
| 50 | +- **[Python](https://codepathfinder.dev/registry/python)** – Full support for security analysis and vulnerability detection |
| 51 | +- **[Docker](https://codepathfinder.dev/registry/docker)** – Dockerfile security scanning |
| 52 | +- **[Docker Compose](https://codepathfinder.dev/registry/docker-compose)** – Configuration analysis and security checks |
| 53 | +- **Go** – Coming soon |
50 | 54 |
|
| 55 | +## Installation |
51 | 56 |
|
52 | | -## :floppy_disk: Installation |
| 57 | +### Homebrew (Recommended) |
53 | 58 |
|
54 | | -### :whale: Using Docker |
| 59 | +The easiest way to install on macOS or Linux. Available from version 0.0.34 onwards. |
55 | 60 |
|
56 | 61 | ```bash |
57 | | -$ docker pull shivasurya/code-pathfinder:stable-latest |
| 62 | +brew install shivasurya/tap/pathfinder |
58 | 63 | ``` |
59 | 64 |
|
60 | | -### From npm |
| 65 | +### Docker |
61 | 66 |
|
62 | | -#### Secureflow CLI |
| 67 | +Quickest way to get started. Ideal for CI/CD pipelines. |
63 | 68 |
|
64 | 69 | ```bash |
65 | | -$ npm install -g @codepathfinder/secureflow-cli |
66 | | -$ secureflow scan --help |
67 | | -``` |
| 70 | +docker pull shivasurya/code-pathfinder:stable-latest |
68 | 71 |
|
69 | | -#### Code-Pathfinder CLI |
70 | | - |
71 | | -```bash |
72 | | -$ npm install -g codepathfinder |
73 | | -$ pathfinder --help |
| 72 | +# Run a scan |
| 73 | +docker run --rm -v "./src:/src" \ |
| 74 | + shivasurya/code-pathfinder:stable-latest \ |
| 75 | + scan --project /src --rules /src/rules |
74 | 76 | ``` |
75 | 77 |
|
76 | 78 | ### Pre-Built Binaries |
77 | 79 |
|
78 | | -Download the latest release from [GitHub releases](https://github.com/shivasurya/code-pathfinder/releases) and choose |
79 | | -the binary that matches your operating system. |
| 80 | +Download platform-specific binaries from [GitHub Releases](https://github.com/shivasurya/code-pathfinder/releases). Available for Linux (amd64, arm64), macOS (Intel, Apple Silicon), and Windows (x64). |
80 | 81 |
|
81 | | -```shell |
82 | | -$ chmod u+x pathfinder |
83 | | -$ pathfinder --help |
| 82 | +```bash |
| 83 | +chmod u+x pathfinder |
| 84 | +./pathfinder --help |
84 | 85 | ``` |
85 | 86 |
|
| 87 | +### From Source |
86 | 88 |
|
87 | | -## Getting Started |
88 | | -Read the [official documentation](https://codepathfinder.dev/), or run `pathfinder --help`. |
| 89 | +Build from source for the latest features. Requires Gradle and Go. |
89 | 90 |
|
90 | | -## Features |
| 91 | +```bash |
| 92 | +git clone https://github.com/shivasurya/code-pathfinder |
| 93 | +cd code-pathfinder/sast-engine |
| 94 | +gradle buildGo |
| 95 | +./build/go/pathfinder --help |
| 96 | +``` |
91 | 97 |
|
92 | | -- [x] Graph-based structural queries |
93 | | -- [x] Source Sink Analysis |
94 | | -- [ ] Data Flow Analysis with Control Flow Graph |
95 | 98 |
|
96 | 99 | ## Usage |
97 | 100 |
|
@@ -123,130 +126,9 @@ pathfinder scan --rules rules/ --project . --output json | jq . |
123 | 126 | pathfinder scan --rules rules/ --project . --fail-on=critical,high |
124 | 127 | ``` |
125 | 128 |
|
126 | | -### CI Command (Machine-Readable) |
127 | | - |
128 | | -```bash |
129 | | -# JSON output |
130 | | -pathfinder ci --rules rules/ --project . --output json > results.json |
131 | | - |
132 | | -# CSV output |
133 | | -pathfinder ci --rules rules/ --project . --output csv > results.csv |
134 | | - |
135 | | -# SARIF output (GitHub Code Scanning) |
136 | | -pathfinder ci --rules rules/ --project . --output sarif > results.sarif |
137 | | - |
138 | | -# With failure control |
139 | | -pathfinder ci --rules rules/ --project . --output json --fail-on=critical |
140 | | -``` |
141 | | - |
142 | | -## Output Formats |
143 | | - |
144 | | -### Text Output (Default for scan) |
145 | | - |
146 | | -``` |
147 | | -Code Pathfinder Security Scan |
148 | | -
|
149 | | -Results: |
150 | | -
|
151 | | -Critical Issues (1): |
152 | | -
|
153 | | - [critical] [Taint-Local] command-injection: Command Injection |
154 | | - CWE-78 | A1:2017 |
155 | | -
|
156 | | - auth/login.py:127 |
157 | | - > 125 | user_input = request.form['username'] |
158 | | - 126 | # Process input |
159 | | - > 127 | os.system(f"echo {user_input}") |
160 | | -
|
161 | | - Flow: user_input (line 125) -> os.system (line 127) |
162 | | - Confidence: High | Detection: Intra-procedural taint analysis |
163 | | -
|
164 | | -Summary: |
165 | | - 1 findings across 10 rules |
166 | | - 1 critical |
167 | | -``` |
168 | | - |
169 | | -### JSON Output |
170 | | - |
171 | | -```json |
172 | | -{ |
173 | | - "tool": { |
174 | | - "name": "Code Pathfinder", |
175 | | - "version": "0.0.25" |
176 | | - }, |
177 | | - "scan": { |
178 | | - "target": "/path/to/project", |
179 | | - "rules_executed": 10 |
180 | | - }, |
181 | | - "results": [ |
182 | | - { |
183 | | - "rule_id": "command-injection", |
184 | | - "severity": "critical", |
185 | | - "location": { |
186 | | - "file": "auth/login.py", |
187 | | - "line": 127 |
188 | | - }, |
189 | | - "detection": { |
190 | | - "type": "taint-local", |
191 | | - "source": {"line": 125, "variable": "user_input"}, |
192 | | - "sink": {"line": 127, "call": "os.system"} |
193 | | - } |
194 | | - } |
195 | | - ], |
196 | | - "summary": { |
197 | | - "total": 1, |
198 | | - "by_severity": {"critical": 1} |
199 | | - } |
200 | | -} |
201 | | -``` |
202 | | - |
203 | | -### CSV Output |
204 | | - |
205 | | -```csv |
206 | | -severity,confidence,rule_id,rule_name,cwe,owasp,file,line,column,function,message,detection_type,detection_scope,source_line,sink_line,tainted_var,sink_call |
207 | | -critical,high,command-injection,Command Injection,CWE-78,A1:2017,auth/login.py,127,8,login,User input flows to shell,taint-local,local,125,127,user_input,os.system |
208 | | -``` |
209 | | - |
210 | | -### SARIF Output |
211 | | - |
212 | | -SARIF 2.1.0 compatible output for GitHub Code Scanning integration. |
213 | | - |
214 | | -```bash |
215 | | -# Upload to GitHub Code Scanning |
216 | | -gh api /repos/:owner/:repo/code-scanning/sarifs -F sarif=@results.sarif |
217 | | -``` |
218 | | - |
219 | | -## Verbosity Levels |
220 | | - |
221 | | -| Flag | Output | |
222 | | -|------|--------| |
223 | | -| (default) | Clean results only | |
224 | | -| `--verbose` | Results + progress + statistics | |
225 | | -| `--debug` | All output + timestamps | |
226 | | - |
227 | | -## Exit Codes |
228 | | - |
229 | | -| Code | Meaning | |
230 | | -|------|---------| |
231 | | -| 0 | Success (no findings, or findings without --fail-on match) | |
232 | | -| 1 | Findings match --fail-on severities | |
233 | | -| 2 | Configuration or execution error | |
234 | | - |
235 | | -### Examples |
236 | | - |
237 | | -```bash |
238 | | -# Default: always exit 0 |
239 | | -pathfinder scan --rules rules/ --project . |
240 | | -echo $? # 0 even with findings |
241 | | - |
242 | | -# Fail on critical or high |
243 | | -pathfinder scan --rules rules/ --project . --fail-on=critical,high |
244 | | -echo $? # 1 if critical/high found, 0 otherwise |
245 | | - |
246 | | -# Fail on any finding |
247 | | -pathfinder scan --rules rules/ --project . --fail-on=critical,high,medium,low |
248 | | -``` |
249 | | - |
250 | 129 | ## Acknowledgements |
251 | 130 | Code Pathfinder uses tree-sitter for all language parsers. |
252 | 131 |
|
| 132 | +## License |
| 133 | + |
| 134 | +Licensed under [AGPL-3.0](https://github.com/shivasurya/code-pathfinder/blob/main/LICENSE). |
0 commit comments