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.4.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.4-py3-none-win_amd64.whl (4.8 MB view details)

Uploaded Python 3Windows x86-64

codepathfinder-1.3.4-py3-none-manylinux_2_17_x86_64.whl (4.7 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

codepathfinder-1.3.4-py3-none-manylinux_2_17_aarch64.whl (4.3 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

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

Uploaded Python 3macOS 11.0+ ARM64

codepathfinder-1.3.4-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.4.tar.gz.

File metadata

  • Download URL: codepathfinder-1.3.4.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.4.tar.gz
Algorithm Hash digest
SHA256 209b522f511b3af16f41bc6456e8253f8406f7bc2dc48216404333f3e0decb79
MD5 280b9f57cfc137eab549d5f1748d7559
BLAKE2b-256 a308918bae865a7429e0d94fc1279877c982a9a79d0c2d6485217a800ebd0e9b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for codepathfinder-1.3.4-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 e1b6c670167a70e926f774445baf8d56b46b5c53730a21ef9a5836902088631c
MD5 3b88afc37ad05fc74f580f0fd9ff25fd
BLAKE2b-256 33682ee4c239a22b5daa91675e4aace122538f4109694eaf9e6b6618b6efcc99

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for codepathfinder-1.3.4-py3-none-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 23d8ca2245d1a0df74bd034675f5de32aadc1bde61ea9ad198fe745dcbbf314f
MD5 576881ea69bb43e21567b16cfe1d09c2
BLAKE2b-256 6463639d4c316580908ef86b0b24039e469265b59def7f157d7aa46107720ce3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for codepathfinder-1.3.4-py3-none-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 c16542a03ea9ba8c92e54fb4a2d3699fc31ba9878d94de4dad5fc3f1ef718378
MD5 dcfe5da50d0148d907c63fc6735455b3
BLAKE2b-256 bc76180aba2e6b364be9d970e4fdc48a5f9ffcd2f061c3a25c17e376324476d7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for codepathfinder-1.3.4-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 95e224978cdce9bb8a1e22335c0f2031a532022ef4bdc077fde32dc168776f48
MD5 746455bb9474bcc8bba24a5a50728f43
BLAKE2b-256 3978a4bee19690d21874528d6c58a967d9d6d82a84b67bace40e24276e30a4d4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for codepathfinder-1.3.4-py3-none-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 27a6ea6068ff25b4748b53fc44f76b67c749110faf8d872b043e8ddf230c5125
MD5 8ea7c738a10a98d2b834efdb7ec72347
BLAKE2b-256 c92247a601f0390dd6bf9501fd81da27774729dd8244109aa815b1d13b281f0c

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