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.1.1.tar.gz (84.4 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.1.1-py3-none-win_amd64.whl (7.0 MB view details)

Uploaded Python 3Windows x86-64

codepathfinder-2.1.1-py3-none-manylinux_2_17_x86_64.whl (6.8 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

codepathfinder-2.1.1-py3-none-manylinux_2_17_aarch64.whl (6.3 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

codepathfinder-2.1.1-py3-none-macosx_11_0_arm64.whl (6.4 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

codepathfinder-2.1.1-py3-none-macosx_10_9_x86_64.whl (6.9 MB view details)

Uploaded Python 3macOS 10.9+ x86-64

File details

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

File metadata

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

File hashes

Hashes for codepathfinder-2.1.1.tar.gz
Algorithm Hash digest
SHA256 79d756b09678255f312f94d951d6136fde26e7747fff425aff3588a59975fed0
MD5 51828ae8624c0600ce8bc631748396e0
BLAKE2b-256 9feb311ca304a62c8c6257d1a61cc7eb38d66182a0c2f39a3ef95233b43fe5c7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for codepathfinder-2.1.1-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 a7f68a161d54edd80f152eb1952f95a85b8e49abfc6e443e582eaeb9ce8326e2
MD5 77645b4f9ac1c0bef114636101315888
BLAKE2b-256 1bd62c5a9fe7511490358ef837eb07f2d6965589153d8dcbdac7a7c76b8256f5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for codepathfinder-2.1.1-py3-none-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 bca74e15595b3ba111bb7da8e0e193c324886aa37f17f05fed00ed0a8262f353
MD5 6ee749dc9d92fe041b9722a4c4c42cff
BLAKE2b-256 c41dd96d9b3a25400eac15d101d77087f65e079b863f590d1e01a9036665add3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for codepathfinder-2.1.1-py3-none-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 0a0603fa17f20ecde5f44b3ed28f436c7e3680eb2cc86eec5398f0efc70e2def
MD5 5a9934ab1f6ec8a37fcd6fa0af2c1a2f
BLAKE2b-256 7a8b1826ee5d6cbfc605eaf1bada1d1cd45b4736dc4ffd6ac37188541e2761e5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for codepathfinder-2.1.1-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 55b968d20639a2f0c92e42845132316f23cd105c95ae1905299d1c4c6590841c
MD5 cfc2f28e2ad2343206dd15e1f8418303
BLAKE2b-256 52e949545deefa9c75c1bb22533bc30e1f10fbe5e59dee2bca59b51f5f9e342e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for codepathfinder-2.1.1-py3-none-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5f268a47a49e5bb442a1adacecc7d8107218e9d6b82b2706c7b1b3d8593c19f4
MD5 4f417a8ae2a0f1604023fce378530c76
BLAKE2b-256 7a4cb133037022867d28660d7e20335dd95d5d3739544ed69eb21696828a0a01

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