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

Uploaded Python 3Windows x86-64

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

Uploaded Python 3manylinux: glibc 2.17+ x86-64

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

Uploaded Python 3manylinux: glibc 2.17+ ARM64

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

Uploaded Python 3macOS 11.0+ ARM64

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

File metadata

  • Download URL: codepathfinder-2.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 9b62817a8f6797d7a669b02daf314a5e9a2aea98c83146fb4d7437405a021137
MD5 b44c8222d846ee54927f33bb4b3929e9
BLAKE2b-256 66ad5a6bc2a14c61b946491f1c821aa26fb7655344f74238a0008118fcdca075

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for codepathfinder-2.1.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 f03ad834bc935962a464afe7ad8a4e37299872680b0da85f50a45082c8d7ec2d
MD5 1decf0802267660dbf699304cbffb831
BLAKE2b-256 f4e59943249ddbf213f8ab4f87b6758cdef99dcf0e79989c434c82a169508597

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for codepathfinder-2.1.0-py3-none-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 bca0961400bf0deee203426b4d4b2e4ec7af51b6a2c25cdbde9a49ec521c6d73
MD5 14adba06038f55d2eee8f4567be05334
BLAKE2b-256 8949013b160192297ab0fbd3454bdacb3f56197d254a80cb72d4a3a794c8eb61

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for codepathfinder-2.1.0-py3-none-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 dde250a8bbb7045a9b963b7f721be30f81caed4a32947aeba64c99021ecdde39
MD5 d3a4fb342b69213c9b43d5824eec3593
BLAKE2b-256 5d544d802c1871aaff7d519ed8a4fd906cc03d1308879df298eedf99a9681a82

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for codepathfinder-2.1.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a87c47be25224213d06453c7fa25d2dbcaa7a626385cdc96ddd8799ccd80feaa
MD5 391e72553bf7ec2de16e9561c54a76e3
BLAKE2b-256 01bb6f2dc5a8cc5bc55405e1bf78d20e206b9e9a176ce3190d1fce99511b192f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for codepathfinder-2.1.0-py3-none-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 08e0ab941f8b97273acddcb69ae307c7ddbb6da97b411e58a9a153421d137bdb
MD5 9c9bef07124cb6be025b163bd2e5a11a
BLAKE2b-256 abb12d7438d5f8087850b97eec059436bc2ea0201fdabad574d1006898292972

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