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.0.tar.gz (37.9 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.0-py3-none-win_amd64.whl (5.1 MB view details)

Uploaded Python 3Windows x86-64

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

Uploaded Python 3manylinux: glibc 2.17+ x86-64

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

Uploaded Python 3manylinux: glibc 2.17+ ARM64

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

Uploaded Python 3macOS 11.0+ ARM64

codepathfinder-2.0.0-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.0.tar.gz.

File metadata

  • Download URL: codepathfinder-2.0.0.tar.gz
  • Upload date:
  • Size: 37.9 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.0.tar.gz
Algorithm Hash digest
SHA256 55ff3d578ec5780982339252c0676ced97ea39a9c5bf05962ff4149151961e8e
MD5 67a3104764473edebe830b4893add3c5
BLAKE2b-256 c7501ea888e396dcb27dda7ea59a556d7fc1ca873415cba5765bef12d1e72805

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for codepathfinder-2.0.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 45fe32c1feedef21dacf8e9f73881cce729f1e713969d9171269f9b1589c66ca
MD5 7de17b6438a60910da8099709b7126b6
BLAKE2b-256 9615837cda00b81b9eb36a1b7cbb1a68005c4432bca8c2f83308227431edbf34

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for codepathfinder-2.0.0-py3-none-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 3f347d1d9763df312c56d12fbafe05aade225e39192709526115f62f2a285a72
MD5 4a9cb63f7f0c3c80c9ab6e81dc05f01d
BLAKE2b-256 2c2f2592d6c8a33f13f5551227251cfdd012414d9acea4e49368b16c327598dc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for codepathfinder-2.0.0-py3-none-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 c9e872d18c075b2728377580fdbfc8543582deb087d9c931aa63e7c645f2f91a
MD5 87c60cd0de78f1c7a38e94c197dced20
BLAKE2b-256 b48472530ba93c793e20c76f437ee095d7159f75b29721bbee8838082bfea69c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for codepathfinder-2.0.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9fc9b816974cdd2a1c8e010c5fbaec668deea0027dd09934bd54e8725f4564dd
MD5 7147ff86cbf873789288174b7c1d4b38
BLAKE2b-256 a3ba1d24ed4be59210c2bb79a88879cd9487f168c72b6bef7257f16e70a517db

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for codepathfinder-2.0.0-py3-none-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a95705902c1aa29d70caf34a73f0862d8e85ac60d311888c491320f23b84562f
MD5 27f4a398a3dbe8a4c55ad7839b4afbd9
BLAKE2b-256 507ce4c230649539df60f49d563d167b09fcb410ad42870f0dbc43ba49cc2132

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