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

Apache-2.0 - Apache License, Version 2.0

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-2.0.2.tar.gz (38.6 kB view details)

Uploaded Source

Built Distributions

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

codepathfinder-2.0.2-py3-none-win_amd64.whl (5.1 MB view details)

Uploaded Python 3Windows x86-64

codepathfinder-2.0.2-py3-none-manylinux_2_17_x86_64.whl (5.0 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

codepathfinder-2.0.2-py3-none-manylinux_2_17_aarch64.whl (4.6 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

codepathfinder-2.0.2-py3-none-macosx_11_0_arm64.whl (4.6 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

codepathfinder-2.0.2-py3-none-macosx_10_9_x86_64.whl (5.0 MB view details)

Uploaded Python 3macOS 10.9+ x86-64

File details

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

File metadata

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

File hashes

Hashes for codepathfinder-2.0.2.tar.gz
Algorithm Hash digest
SHA256 4427106ee33e94405417f8f363ff7fb40ebf80ce7a3e21409a5fc2ec3d67bedd
MD5 573759c90ec10423e6a2f4ad0cf2c2ae
BLAKE2b-256 57450e3e31d3787809464641fc8b0f633c5ff06d25fffe39c5c681e8e1bf618d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for codepathfinder-2.0.2-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 78877f8bf263c1b0b8c2ff80c5dd2348f1add9842e5a16e39fcb61ad5a1566eb
MD5 91ff209e52342c1c2fd581d3c2c8a749
BLAKE2b-256 797b351907cbdd81485066fa0256c00d6b71cb8b4d9081a8a32b032016733a04

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for codepathfinder-2.0.2-py3-none-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 11a9e6df05958f7a65658c5bc5e07faca28cb9e02ce7f7c2f94a9f66dc8e8094
MD5 3091aa2e73570c152a03f04389520003
BLAKE2b-256 6d104c5a0c265ecb80bbc4088618519b169ee8e8890b0c24f646ad7cc5185572

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for codepathfinder-2.0.2-py3-none-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 bc6a6941fd7247ee71ea93968b8a0d58df77d8525ed80ddf970fd2a57dbe3c04
MD5 e801a6dd489528b3915b8b5df86b52a0
BLAKE2b-256 650bb39a187dc07c0730bd597a38418dbc808da70a5ead579c906e159f1bab20

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for codepathfinder-2.0.2-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5767a405f2a90c7ea84aeac52c95417d15a94802e4b043ce85ec0b23ad8a2665
MD5 90ea9f560dcae0920436bafc94f79ffd
BLAKE2b-256 0af80a719eef9637cbf4c0d44f3440a9b8d444a20579d610f226bff4c50db24a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for codepathfinder-2.0.2-py3-none-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6be4af2834d46ead0656c82d11bf830ad41fbefa67a84a42245440487406b91a
MD5 67be21ae53022ada9622b7960b7ff30e
BLAKE2b-256 172df6091bfb37ed5f1df9408e3f236ad18370e5ab92e35a426d33b886669776

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