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

Uploaded Python 3Windows x86-64

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

Uploaded Python 3manylinux: glibc 2.17+ x86-64

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

Uploaded Python 3manylinux: glibc 2.17+ ARM64

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

Uploaded Python 3macOS 11.0+ ARM64

codepathfinder-1.3.3-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.3.tar.gz.

File metadata

  • Download URL: codepathfinder-1.3.3.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.3.tar.gz
Algorithm Hash digest
SHA256 f8fe27dd4679f12cade4d8f0e13a65165d3829f3bb528c04147269e2bf94a599
MD5 b20f66fc857918a2def953c2c1c37b44
BLAKE2b-256 4bb66526cd2489b398433baf44e7ea200f2a018784737b000309efd84ce60559

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for codepathfinder-1.3.3-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 e95824ec7d8c1e7492ee31102509cbdf61c71478c33e533bb49babb0bd9963e5
MD5 98d1c1c0f588d95f1a36666b5f831819
BLAKE2b-256 fff7d25adc992cee9c3457d06f8db90871f8a7b004a2fe047a38f43a8d75d5a4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for codepathfinder-1.3.3-py3-none-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 2d5a25f91ba57af6ce7e8807f6e9a59cb86ee1a7b059010ac00d4a848cafa083
MD5 ef448c617e5866ee239a61d8454c46f7
BLAKE2b-256 1f37756adb848a599b8afa643bfd48b7ab9110dc65904d03f3fd9c874e8d702b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for codepathfinder-1.3.3-py3-none-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 a5cfc5e957912ae1f86df441153bf9c36ae7926127e6e66c972cdd78e5d246be
MD5 ca06fda12a0df3d7a05ef4bb667c6a5c
BLAKE2b-256 132b1e22177889ed3a89d1c9df39093f27f9760422fa2d5c0e3cc467b5d96d39

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for codepathfinder-1.3.3-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 713b300e8146c1d7af413e66e639b11539d5926919d8cda2bee76476c53d63b8
MD5 40a70ce1dc50c962bcfb203e072516af
BLAKE2b-256 657dcafd6b5fc45a900addfc820501ed65df2ce3cebe7de98dc243c243a5e062

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for codepathfinder-1.3.3-py3-none-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 65aee211187494952465f5c57628cf4e0c95cb1883d91d2803d9dabf6fdecd65
MD5 ab9b1e0b916514d72992bc6dc0810a81
BLAKE2b-256 fdf7dd1b9d81eb7eb138c735e39e2e18f9648c7504c172b7767c94e553630bed

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