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

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.3
File Size Uploaded
cpex_sql_sanitizer-0.1.3.tar.gz 46.6 kB Details

Built distributions (wheels)

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

Total release size: 4.7 MB

Release files / cpex_sql_sanitizer-0.1.3.tar.gz

Download URL cpex_sql_sanitizer-0.1.3.tar.gz
Size 46.6 kB
Tags Source
SHA-256 checksum
How to use checksums
cb0111bd5c12689dffac2b7f0663702135220efda5cf62441b82f5c495daef7e
BLAKE2b-256 checksum
How to use checksums
27efdbe5f9634d313c712fa3fdf77983d29c68568ea1384bc9663eb0278cecbd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 22, 2026.

Transparency log

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

Download URL cpex_sql_sanitizer-0.1.3-cp311-abi3-win_amd64.whl
Size 723.4 kB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
358ac03795508dede6664b4a5add4468a8d52036695a4432a02b2e80898e7e8b
BLAKE2b-256 checksum
How to use checksums
5f1f74ae4f1487fe1bea6e617c520458e0c58d3365faee3f09fbf20e19abf02e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 22, 2026.

Transparency log

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

Download URL cpex_sql_sanitizer-0.1.3-cp311-abi3-manylinux_2_34_x86_64.whl
Size 806.8 kB
Tags CPython 3.11 Linux glibc 2.34+ x86-64 abi3
SHA-256 checksum
How to use checksums
63414a44751e83edfbbc39c301e536c3be192a2fe30cabd4c355d257544e1062
BLAKE2b-256 checksum
How to use checksums
07d744850a3267d7d4952a184ecbf7506efc981906642f1eccf605524bf69ce2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 22, 2026.

Transparency log

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

Download URL cpex_sql_sanitizer-0.1.3-cp311-abi3-manylinux_2_34_s390x.whl
Size 842.9 kB
Tags CPython 3.11 Linux glibc 2.34+ IBM System/390x abi3
SHA-256 checksum
How to use checksums
167e240da72e755329b0e26a850f58d04b521425147aeae2d7fc597fd135e08a
BLAKE2b-256 checksum
How to use checksums
41d948b3ae0736fb80485787fca8e935c54077d772e911f1c906094ddc96a80f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 22, 2026.

Transparency log

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

Download URL cpex_sql_sanitizer-0.1.3-cp311-abi3-manylinux_2_34_ppc64le.whl
Size 830.9 kB
Tags CPython 3.11 Linux glibc 2.34+ PowerPC 64-le abi3
SHA-256 checksum
How to use checksums
0e2abfa628d8e52464affdca6f9e17a38552c5b226a884fb1c22325fcc92c1ab
BLAKE2b-256 checksum
How to use checksums
e2a3171d3371ec9ed09444e6312f50b0f0a487de77309cd3963aaa69a51a7947
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 22, 2026.

Transparency log

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

Download URL cpex_sql_sanitizer-0.1.3-cp311-abi3-manylinux_2_34_aarch64.whl
Size 757.6 kB
Tags CPython 3.11 Linux glibc 2.34+ ARM64 abi3
SHA-256 checksum
How to use checksums
d96cd5fa5b53cd7cfa9e5ea4c928f70e68e678685fb13375ff48a4649c101479
BLAKE2b-256 checksum
How to use checksums
60cb8cd5bb276ce1d2321547f5186a04a29146f74200c5db17442879a114cfa7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 22, 2026.

Transparency log

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

Download URL cpex_sql_sanitizer-0.1.3-cp311-abi3-macosx_11_0_arm64.whl
Size 703.5 kB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
68b19c76026246a91e95f093bca9cdbb66e4737baa783a7654bdce2fb2d8896f
BLAKE2b-256 checksum
How to use checksums
6005cd0f61c173b2c8bfeb069d860908e887521bf47ca324ee075bf84e1c3649
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 22, 2026.

Transparency log

Release history Release notifications | RSS feed

0.1.4

7 release files

This release

0.1.3 This release

7 release files

0.1.2

7 release files

0.1.1

7 release files

0.1.0

7 release files

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