Skip to main content

Python SDK for code-pathfinder static analysis for modern security teams

Project description

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

AGPL-3.0 - GNU Affero General Public License v3

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

codepathfinder-1.3.2.tar.gz (47.3 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

codepathfinder-1.3.2-py3-none-win_amd64.whl (4.7 MB view details)

Uploaded Python 3Windows x86-64

codepathfinder-1.3.2-py3-none-manylinux_2_17_x86_64.whl (4.6 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

codepathfinder-1.3.2-py3-none-manylinux_2_17_aarch64.whl (4.2 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

codepathfinder-1.3.2-py3-none-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

codepathfinder-1.3.2-py3-none-macosx_10_9_x86_64.whl (4.6 MB view details)

Uploaded Python 3macOS 10.9+ x86-64

File details

Details for the file codepathfinder-1.3.2.tar.gz.

File metadata

  • Download URL: codepathfinder-1.3.2.tar.gz
  • Upload date:
  • Size: 47.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for codepathfinder-1.3.2.tar.gz
Algorithm Hash digest
SHA256 eb84b11ed3985153f3ffee238fd50fb011eef445fc60930dbdf4a00ad06a97b7
MD5 6d3800aca1a1bed4d992a229e692b2c7
BLAKE2b-256 09b6ecd1d852c6e16b2eb30057bc824d3b91f7ddc1c55dff1c7310670e29ffb3

See more details on using hashes here.

File details

Details for the file codepathfinder-1.3.2-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for codepathfinder-1.3.2-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 ad51c747bcf5d2ac5099e51a683462e3cf1e0663df11cb5f585db7bc956464ce
MD5 0612d7bbff3b662a5295cadb9e67cc74
BLAKE2b-256 cd10cb2ed1214681d05d3c56933771f234feddf4026576760b03f81c37336c16

See more details on using hashes here.

File details

Details for the file codepathfinder-1.3.2-py3-none-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for codepathfinder-1.3.2-py3-none-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 45001bc36daf2d4b27f1089b288f74e27533ffc53e5bd2316763553c4e22f5c0
MD5 a9b5b64071666e2f8800193d92537304
BLAKE2b-256 57cf2695b1cb5a78caec7597817f7cfa153b14d653750e94708d3f3813ff6153

See more details on using hashes here.

File details

Details for the file codepathfinder-1.3.2-py3-none-manylinux_2_17_aarch64.whl.

File metadata

File hashes

Hashes for codepathfinder-1.3.2-py3-none-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 b870db8d7538b6c2472a9c630e076b61d338cd1b5cd80ecc180d5aac0ee0a22a
MD5 70f6ea823afb033151e284b594124d0a
BLAKE2b-256 e6ef96c83c9d3c1577abbfdb49ce24afcdb414044c83fa75cf23c3694ce71e39

See more details on using hashes here.

File details

Details for the file codepathfinder-1.3.2-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for codepathfinder-1.3.2-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 eae2736c2bffca7160e76f91d259818ad8733226a4608613a519526875e2c501
MD5 6f0f2192750ff5d09c48c507fb935826
BLAKE2b-256 309388c1ac50d971c72f3a09b54f1a6b6733bc54b92c73abe4d3e51b5b90b465

See more details on using hashes here.

File details

Details for the file codepathfinder-1.3.2-py3-none-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for codepathfinder-1.3.2-py3-none-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a7816e78b3cdc1ae595a2fe9858d3dfdcc7321edcb5ee6787a604204452410b7
MD5 f4717bc67042478567e31589234b6dde
BLAKE2b-256 cf71369cadd9073899fd8ed4b6ac90f0078ef03339f008b12cd28d5a91a8bfcb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page