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

Uploaded Python 3Windows x86-64

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

Uploaded Python 3manylinux: glibc 2.17+ x86-64

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

Uploaded Python 3manylinux: glibc 2.17+ ARM64

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

Uploaded Python 3macOS 11.0+ ARM64

codepathfinder-1.3.5-py3-none-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded Python 3macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: codepathfinder-1.3.5.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.5.tar.gz
Algorithm Hash digest
SHA256 18c65ef39b9eba8a1bd976ea12393bf79ab55cdbaf2b6491344074cabc409acb
MD5 3e7c1789d9a224203b6140c0d421e4e2
BLAKE2b-256 9d3260ba11b3d8d9b816a6cc0b3cb5ac686d9568442ad7b980e242ea3bbc671f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for codepathfinder-1.3.5-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 daac6b1d0d42031fd1659502249f6656588932df74b1eff23547f9a4688e70f0
MD5 49d095b302d83a0e4f9ca5aae96aa49c
BLAKE2b-256 a5aef7ed06468630eb24006c24e6e6b8a7d1a74818b8075420d3725725f498d0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for codepathfinder-1.3.5-py3-none-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 6c903aa88c5b6958cc63b8fc8333f3bff32f207f41eece76243ede78e86c41cb
MD5 10cf25f2f4e64e357eac319ddd7bcfab
BLAKE2b-256 4c3728a984785a1068fff4ebfccb5352ff3e4331d3d194401da1c02e1b50e326

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for codepathfinder-1.3.5-py3-none-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 16d3cfca521176f932faa21650cd02d359c23e4d60c8c5495bf8bfa9d727db21
MD5 d165ec27822fb5c44013bb179c1b3448
BLAKE2b-256 1dec991e760a7edff0b1f495d90bb86418bb2e51087cdbef3e88112cfc90501e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for codepathfinder-1.3.5-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c4c354b288fe0800f02d53835a571316a66caf0f3a4b1f6941d09217d066a120
MD5 3107410dc372bc483b974308c0c4c6b1
BLAKE2b-256 11323017d4ef2cf352ab9bd26b2c0e7af4e281cda1b507d8e60e7ce23ef5b94a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for codepathfinder-1.3.5-py3-none-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9f4a9f70d8c2eb08899bebd2153560fed7f23371897244947155ac0398b6fa14
MD5 798a52aae0d560c8f2e4946b4be8b1da
BLAKE2b-256 bf7df87b0db8d2a0991fcd91083d43a924dd205f87cf21631ba1518f8f690818

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