Skip to main content

SQL Sanitizer (Rust)

SQL security analysis plugin for ContextForge.

Features

  • Per-statement analysis: SQL payloads are split on ; and each statement is checked independently so a WHERE clause in one statement cannot suppress a violation in another
  • Blocked statement patterns: DROP, TRUNCATE, ALTER, GRANT, REVOKE (configurable)
  • DELETE FROM and UPDATE without a WHERE clause detection
  • Comment stripping: -- line comments and /* */ block comments are removed before analysis
  • Field filtering: scan only named argument keys, or all string values when fields is unset
  • Monitoring mode: pass through with metadata.sql_issues populated instead of blocking
  • Interpolation heuristic: optional detection of +, %., and {…} patterns

Build

make install

Runtime Requirements

This plugin depends on cpex>=0.1.0,<0.2 and imports hook models from cpex.framework. The compiled Rust extension is mandatory; there is no Python fallback implementation.

Usage

from cpex_sql_sanitizer import SQLSanitizerPlugin

The plugin is automatically discovered by the gateway via the cpex.plugins entry point registered in pyproject.toml.

Configuration

Key Type Default Description
fields list[str] | null null Field names to scan; null scans all strings
blocked_statements list[str] ["\\bDROP\\b", "\\bTRUNCATE\\b", "\\bALTER\\b", "\\bGRANT\\b", "\\bREVOKE\\b"] Replaces the default blocked-pattern set; [] disables this category
block_delete_without_where bool true Block DELETE FROM without WHERE
block_update_without_where bool true Block UPDATE without WHERE
strip_comments bool true Strip SQL comments before analysis
require_parameterization bool false Flag non-parameterized SQL interpolation
block_on_violation bool true Block request on violation; false = monitoring mode

Hook Signatures

async def prompt_pre_fetch(
    self,
    payload: typing.Any,
    context: typing.Any,
    extensions: typing.Any = None,
) -> typing.Any: ...

async def tool_pre_invoke(
    self,
    payload: typing.Any,
    context: typing.Any,
    extensions: typing.Any = None,
) -> typing.Any: ...

Metadata

Release files for cpex-sql-sanitizer 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cpex-sql-sanitizer 0.1.6
File Size Uploaded Provenance Actions
cpex_sql_sanitizer-0.1.6.tar.gz 50.6 kB With provenance Details for cpex_sql_sanitizer-0.1.6.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for cpex-sql-sanitizer 0.1.6
File Actions
cpex_sql_sanitizer-0.1.6-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details for cpex_sql_sanitizer-0.1.6-cp311-abi3-win_amd64.whl
cpex_sql_sanitizer-0.1.6-cp311-abi3-manylinux_2_34_x86_64.whl CPython 3.11 abi3 Linux glibc 2.34+ x86-64 Details for cpex_sql_sanitizer-0.1.6-cp311-abi3-manylinux_2_34_x86_64.whl
cpex_sql_sanitizer-0.1.6-cp311-abi3-manylinux_2_34_s390x.whl CPython 3.11 abi3 Linux glibc 2.34+ IBM System/390x Details for cpex_sql_sanitizer-0.1.6-cp311-abi3-manylinux_2_34_s390x.whl
cpex_sql_sanitizer-0.1.6-cp311-abi3-manylinux_2_34_ppc64le.whl CPython 3.11 abi3 Linux glibc 2.34+ PowerPC 64-le Details for cpex_sql_sanitizer-0.1.6-cp311-abi3-manylinux_2_34_ppc64le.whl
cpex_sql_sanitizer-0.1.6-cp311-abi3-manylinux_2_34_aarch64.whl CPython 3.11 abi3 Linux glibc 2.34+ ARM64 Details for cpex_sql_sanitizer-0.1.6-cp311-abi3-manylinux_2_34_aarch64.whl
cpex_sql_sanitizer-0.1.6-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details for cpex_sql_sanitizer-0.1.6-cp311-abi3-macosx_11_0_arm64.whl

Total release size: 4.7 MB

Release files / cpex_sql_sanitizer-0.1.6.tar.gz

Download URL cpex_sql_sanitizer-0.1.6.tar.gz
Size 50.6 kB
Tags Source
SHA-256 checksum
How to use checksums
a2d181d154d67f079a7d15eb236996ac6457bbac92ea1ca67fd53a96351a1f17
BLAKE2b-256 checksum
How to use checksums
8ba7adb87706770bf34874bb31b0f4cdd39c0d7045e6db79ac3af9fa996d7fe1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Release files / cpex_sql_sanitizer-0.1.6-cp311-abi3-win_amd64.whl

Download URL cpex_sql_sanitizer-0.1.6-cp311-abi3-win_amd64.whl
Size 729.2 kB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
ba2bb26f1e9dfcf882d81f42533d43cd05cd8ce8240ba5c74f91196e5299d551
BLAKE2b-256 checksum
How to use checksums
eafa0462fd60facbf0d4258a183f9f8b2a4b7dd9a23ac93a666498bfa3b6854f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Release files / cpex_sql_sanitizer-0.1.6-cp311-abi3-manylinux_2_34_x86_64.whl

Download URL cpex_sql_sanitizer-0.1.6-cp311-abi3-manylinux_2_34_x86_64.whl
Size 799.2 kB
Tags CPython 3.11 Linux glibc 2.34+ x86-64 abi3
SHA-256 checksum
How to use checksums
ae1e6ba56de9ad3bd10c59e480dfc59699b841b288a1eca95cec38d7a8424717
BLAKE2b-256 checksum
How to use checksums
4f0c96d0cbe460277ecc3a31df3d91b1a02effea74e8f7cc0adfcf9a3d52cc22
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Release files / cpex_sql_sanitizer-0.1.6-cp311-abi3-manylinux_2_34_s390x.whl

Download URL cpex_sql_sanitizer-0.1.6-cp311-abi3-manylinux_2_34_s390x.whl
Size 834.2 kB
Tags CPython 3.11 Linux glibc 2.34+ IBM System/390x abi3
SHA-256 checksum
How to use checksums
0169c3b7038a72d6a21f57656f7d3d76535bc2931be5952b9b153a369a394d8d
BLAKE2b-256 checksum
How to use checksums
a5db53c2620c070c0be43ee3c50195ed78cbc7e69bab70013365495c59ac4283
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Release files / cpex_sql_sanitizer-0.1.6-cp311-abi3-manylinux_2_34_ppc64le.whl

Download URL cpex_sql_sanitizer-0.1.6-cp311-abi3-manylinux_2_34_ppc64le.whl
Size 819.3 kB
Tags CPython 3.11 Linux glibc 2.34+ PowerPC 64-le abi3
SHA-256 checksum
How to use checksums
70c3896a36ec1bcc8a345c28aaf2f17c84304e64391b9e9ca172a6c41ad5a2b8
BLAKE2b-256 checksum
How to use checksums
d48ed5bb75856f0cd73cbd15d0bb8c34b9ef560c1fff98e9b79ec56fa4d9974d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Release files / cpex_sql_sanitizer-0.1.6-cp311-abi3-manylinux_2_34_aarch64.whl

Download URL cpex_sql_sanitizer-0.1.6-cp311-abi3-manylinux_2_34_aarch64.whl
Size 749.8 kB
Tags CPython 3.11 Linux glibc 2.34+ ARM64 abi3
SHA-256 checksum
How to use checksums
f9acf167e7dd8fa1f707448850acb82ab23073ba46910b20a70ba5e3038f3321
BLAKE2b-256 checksum
How to use checksums
ba2f7655f969bcc9835349a0aa9a682cc9e1eda7101d5818ed4c276f64884a81
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Release files / cpex_sql_sanitizer-0.1.6-cp311-abi3-macosx_11_0_arm64.whl

Download URL cpex_sql_sanitizer-0.1.6-cp311-abi3-macosx_11_0_arm64.whl
Size 705.8 kB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
641ae98d362e08850022d56e3d17576a15385d1f381ec00f32fcb62c971f96df
BLAKE2b-256 checksum
How to use checksums
5978a4296319e7ac804b1db999f84f2aaabb6d5ff2449beec246183a68fa4996
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Security for cpex-sql-sanitizer 0.1.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 7 files in this release have been uploaded with provenance metadata.

Select from 7 files

Attestation for cpex_sql_sanitizer-0.1.6.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page