Code Pathfinder Python SDK
Write security rules in Python for Code Pathfinder, an open-source security scanner that combines structural code analysis with AI-powered vulnerability detection.
What you can do:
- Write custom security rules using Python instead of regex or YAML
- Trace data flows from sources (user input) to sinks (SQL, eval, file operations)
- Run rules in VS Code, CLI, or CI/CD pipelines
- Export findings to DefectDojo, GitHub Advanced Security, SARIF, JSON, or CSV
Documentation: https://codepathfinder.dev/
Installation
pip install codepathfinder
This installs both the Python SDK and the pathfinder CLI binary for your platform.
Verify Installation
# Test CLI binary
pathfinder --version
# Test Python SDK
python -c "from codepathfinder import rule, calls; print('SDK OK')"
Supported Platforms
- Linux (glibc): x86_64, aarch64
- macOS: arm64 (Apple Silicon), x86_64 (Intel)
- Windows: x86_64
Source distributions are available for other platforms - the binary will be downloaded automatically on first use.
Quick Example
from codepathfinder import rule, flows, calls
from codepathfinder.presets import PropagationPresets
@rule(id="sql-injection", severity="critical", cwe="CWE-89")
def detect_sql_injection():
"""Detects SQL injection vulnerabilities"""
return flows(
from_sources=calls("request.GET", "request.POST"),
to_sinks=calls("execute", "executemany"),
sanitized_by=calls("quote_sql"),
propagates_through=PropagationPresets.standard(),
scope="global"
)
Features
- Matchers:
calls(),variable()for pattern matching - Dataflow Analysis:
flows()for source-to-sink taint tracking - Propagation: Explicit propagation primitives (assignment, function args, returns)
- Logic Operators:
And(),Or(),Not()for complex rules - JSON IR: Serializes to JSON for Go executor integration
Documentation
For detailed documentation, visit https://codepathfinder.dev/
Requirements
- Python 3.8+
- No external dependencies (stdlib only!)
License
Apache-2.0 - Apache License, Version 2.0
Metadata
Release files for codepathfinder 2.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| codepathfinder-2.1.1.tar.gz | 84.4 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| codepathfinder-2.1.1-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details |
| codepathfinder-2.1.1-py3-none-manylinux_2_17_x86_64.whl | Python 3 | none | Linux glibc 2.17+ x86-64 | Details |
| codepathfinder-2.1.1-py3-none-manylinux_2_17_aarch64.whl | Python 3 | none | Linux glibc 2.17+ ARM64 | Details |
| codepathfinder-2.1.1-py3-none-macosx_11_0_arm64.whl | Python 3 | none | macOS 11.0+ ARM64 | Details |
| codepathfinder-2.1.1-py3-none-macosx_10_9_x86_64.whl | Python 3 | none | macOS 10.9+ x86-64 | Details |
Total release size: 33.4 MB
Release files / codepathfinder-2.1.1.tar.gz
| Download URL | codepathfinder-2.1.1.tar.gz |
|---|---|
| Size | 84.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
79d756b09678255f312f94d951d6136fde26e7747fff425aff3588a59975fed0
|
|
BLAKE2b-256 checksum How to use checksums |
9feb311ca304a62c8c6257d1a61cc7eb38d66182a0c2f39a3ef95233b43fe5c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / codepathfinder-2.1.1-py3-none-win_amd64.whl
| Download URL | codepathfinder-2.1.1-py3-none-win_amd64.whl |
|---|---|
| Size | 7.0 MB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
a7f68a161d54edd80f152eb1952f95a85b8e49abfc6e443e582eaeb9ce8326e2
|
|
BLAKE2b-256 checksum How to use checksums |
1bd62c5a9fe7511490358ef837eb07f2d6965589153d8dcbdac7a7c76b8256f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / codepathfinder-2.1.1-py3-none-manylinux_2_17_x86_64.whl
| Download URL | codepathfinder-2.1.1-py3-none-manylinux_2_17_x86_64.whl |
|---|---|
| Size | 6.8 MB |
| Tags | Linux glibc 2.17+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
bca74e15595b3ba111bb7da8e0e193c324886aa37f17f05fed00ed0a8262f353
|
|
BLAKE2b-256 checksum How to use checksums |
c41dd96d9b3a25400eac15d101d77087f65e079b863f590d1e01a9036665add3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / codepathfinder-2.1.1-py3-none-manylinux_2_17_aarch64.whl
| Download URL | codepathfinder-2.1.1-py3-none-manylinux_2_17_aarch64.whl |
|---|---|
| Size | 6.3 MB |
| Tags | Linux glibc 2.17+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
0a0603fa17f20ecde5f44b3ed28f436c7e3680eb2cc86eec5398f0efc70e2def
|
|
BLAKE2b-256 checksum How to use checksums |
7a8b1826ee5d6cbfc605eaf1bada1d1cd45b4736dc4ffd6ac37188541e2761e5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / codepathfinder-2.1.1-py3-none-macosx_11_0_arm64.whl
| Download URL | codepathfinder-2.1.1-py3-none-macosx_11_0_arm64.whl |
|---|---|
| Size | 6.4 MB |
| Tags | Python 3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
55b968d20639a2f0c92e42845132316f23cd105c95ae1905299d1c4c6590841c
|
|
BLAKE2b-256 checksum How to use checksums |
52e949545deefa9c75c1bb22533bc30e1f10fbe5e59dee2bca59b51f5f9e342e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / codepathfinder-2.1.1-py3-none-macosx_10_9_x86_64.whl
| Download URL | codepathfinder-2.1.1-py3-none-macosx_10_9_x86_64.whl |
|---|---|
| Size | 6.9 MB |
| Tags | Python 3 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
5f268a47a49e5bb442a1adacecc7d8107218e9d6b82b2706c7b1b3d8593c19f4
|
|
BLAKE2b-256 checksum How to use checksums |
7a4cb133037022867d28660d7e20335dd95d5d3739544ed69eb21696828a0a01
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|