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.5

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.5
File Size Uploaded Provenance Actions
cpex_sql_sanitizer-0.1.5.tar.gz 50.5 kB With provenance Details for cpex_sql_sanitizer-0.1.5.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for cpex-sql-sanitizer 0.1.5
File Actions
cpex_sql_sanitizer-0.1.5-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details for cpex_sql_sanitizer-0.1.5-cp311-abi3-win_amd64.whl
cpex_sql_sanitizer-0.1.5-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.5-cp311-abi3-manylinux_2_34_x86_64.whl
cpex_sql_sanitizer-0.1.5-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.5-cp311-abi3-manylinux_2_34_s390x.whl
cpex_sql_sanitizer-0.1.5-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.5-cp311-abi3-manylinux_2_34_ppc64le.whl
cpex_sql_sanitizer-0.1.5-cp311-abi3-manylinux_2_34_aarch64.whl CPython 3.11 abi3 Linux glibc 2.34+ ARM64 Details for cpex_sql_sanitizer-0.1.5-cp311-abi3-manylinux_2_34_aarch64.whl
cpex_sql_sanitizer-0.1.5-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details for cpex_sql_sanitizer-0.1.5-cp311-abi3-macosx_11_0_arm64.whl

Total release size: 4.7 MB

Release files / cpex_sql_sanitizer-0.1.5.tar.gz

Download URL cpex_sql_sanitizer-0.1.5.tar.gz
Size 50.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ed3f493c9a5d7d9293ebd272b664200dbb4fcd38a56dc3e2c484a57470fc4069
BLAKE2b-256 checksum
How to use checksums
58e75571ac32c39d299d41d7027286427defb246817b9644ba05a0efc266de3b
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 Oct 28, 2026.

Transparency log

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

Download URL cpex_sql_sanitizer-0.1.5-cp311-abi3-win_amd64.whl
Size 725.3 kB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
f520f696b3bf82f620bec2fe9b6af5978bafab3e533d9424ed1b49c922ec4a51
BLAKE2b-256 checksum
How to use checksums
d3846f03f8dbff5f6eab7939245b0701649c926bf2000e2de8892a43cd72f3a7
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 Oct 28, 2026.

Transparency log

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

Download URL cpex_sql_sanitizer-0.1.5-cp311-abi3-manylinux_2_34_x86_64.whl
Size 806.4 kB
Tags CPython 3.11 Linux glibc 2.34+ x86-64 abi3
SHA-256 checksum
How to use checksums
5c8acaf7809c61854b0507f08ae381da612d17a8040b8ec28e481ff016ca13eb
BLAKE2b-256 checksum
How to use checksums
fba4c6c6efb9d866ca1bf54d7ed9c550bdd0a4756b8a9da182c7c09453b218f9
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 Oct 28, 2026.

Transparency log

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

Download URL cpex_sql_sanitizer-0.1.5-cp311-abi3-manylinux_2_34_s390x.whl
Size 848.6 kB
Tags CPython 3.11 Linux glibc 2.34+ IBM System/390x abi3
SHA-256 checksum
How to use checksums
00986c6434bce020b04f21014d4c6b62f6abf346c6142c4b1b69f472c84a6709
BLAKE2b-256 checksum
How to use checksums
b0385b5ed5c3902d34dc172bd11c23b83511fb145e3afabf75d84c58ddcdb268
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 Oct 28, 2026.

Transparency log

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

Download URL cpex_sql_sanitizer-0.1.5-cp311-abi3-manylinux_2_34_ppc64le.whl
Size 825.9 kB
Tags CPython 3.11 Linux glibc 2.34+ PowerPC 64-le abi3
SHA-256 checksum
How to use checksums
e87d15898187c012ab1e720547f5aaf792e70ef658ce866a29b14eb5088e0a4b
BLAKE2b-256 checksum
How to use checksums
d1aee7f18d1ba524128a04d595f23120b735091a0019aad424d7411c1ee35370
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 Oct 28, 2026.

Transparency log

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

Download URL cpex_sql_sanitizer-0.1.5-cp311-abi3-manylinux_2_34_aarch64.whl
Size 756.6 kB
Tags CPython 3.11 Linux glibc 2.34+ ARM64 abi3
SHA-256 checksum
How to use checksums
b0d42633ead57159145da75555bb0bd9d5b822cef0bdf0713d37fbf0f8c25728
BLAKE2b-256 checksum
How to use checksums
bd5cf06d0f5b6798ea98b7bfb1a678cfbb4d3cafab02a7729f1aab037e161915
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 Oct 28, 2026.

Transparency log

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

Download URL cpex_sql_sanitizer-0.1.5-cp311-abi3-macosx_11_0_arm64.whl
Size 703.7 kB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
1ae968a77858775eb6c611afeb8f27366c7f62eec16a3383f793381dafc74fd5
BLAKE2b-256 checksum
How to use checksums
3e8fe2d1c8671c571d434a62369caec6541d2c3004673bb026ecee47045cc46a
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 Oct 28, 2026.

Transparency log

Security for cpex-sql-sanitizer 0.1.5

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.5.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 Oct 28, 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