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 aWHEREclause in one statement cannot suppress a violation in another - Blocked statement patterns:
DROP,TRUNCATE,ALTER,GRANT,REVOKE(configurable) DELETE FROMandUPDATEwithout aWHEREclause detection- Comment stripping:
--line comments and/* */block comments are removed before analysis - Field filtering: scan only named argument keys, or all string values when
fieldsis unset - Monitoring mode: pass through with
metadata.sql_issuespopulated 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.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cpex_sql_sanitizer-0.1.4.tar.gz | 50.2 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| cpex_sql_sanitizer-0.1.4-cp311-abi3-win_amd64.whl | CPython 3.11 | abi3 | Windows x86-64 | Details |
| cpex_sql_sanitizer-0.1.4-cp311-abi3-manylinux_2_34_x86_64.whl | CPython 3.11 | abi3 | Linux glibc 2.34+ x86-64 | Details |
| cpex_sql_sanitizer-0.1.4-cp311-abi3-manylinux_2_34_s390x.whl | CPython 3.11 | abi3 | Linux glibc 2.34+ IBM System/390x | Details |
| cpex_sql_sanitizer-0.1.4-cp311-abi3-manylinux_2_34_ppc64le.whl | CPython 3.11 | abi3 | Linux glibc 2.34+ PowerPC 64-le | Details |
| cpex_sql_sanitizer-0.1.4-cp311-abi3-manylinux_2_34_aarch64.whl | CPython 3.11 | abi3 | Linux glibc 2.34+ ARM64 | Details |
| cpex_sql_sanitizer-0.1.4-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.4.tar.gz
| Download URL | cpex_sql_sanitizer-0.1.4.tar.gz |
|---|---|
| Size | 50.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3783108b7d4f8b4380f6b5afb9e85f4aa60895a853acd94070317cd4739d47a9
|
|
BLAKE2b-256 checksum How to use checksums |
0aa98b799e020c2549d8c7386a717b0935d7b36c55927fb15f2db14384732fec
|
| 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 Oct 5, 2026.
Transparency logRelease files / cpex_sql_sanitizer-0.1.4-cp311-abi3-win_amd64.whl
| Download URL | cpex_sql_sanitizer-0.1.4-cp311-abi3-win_amd64.whl |
|---|---|
| Size | 725.8 kB |
| Tags | CPython 3.11 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
3d9c0715bf12869d874d9db212f0317c71e1db26ffd07b2d93cf2f9df5f7d9c1
|
|
BLAKE2b-256 checksum How to use checksums |
55d177411a8a35c14fb6555bb061595b8ee479d6b51b8e71d2110c128a8d2669
|
| 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 Oct 5, 2026.
Transparency logRelease files / cpex_sql_sanitizer-0.1.4-cp311-abi3-manylinux_2_34_x86_64.whl
| Download URL | cpex_sql_sanitizer-0.1.4-cp311-abi3-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 810.6 kB |
| Tags | CPython 3.11 Linux glibc 2.34+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
74957a0b8170efc4aa03a89987cd89cabfe5826ac198e17952a5bd1fed7b17e0
|
|
BLAKE2b-256 checksum How to use checksums |
0ef6d3784a066549fcdd7028518f9a12f54330ee461d156ed36e1494e248a50d
|
| 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 Oct 5, 2026.
Transparency logRelease files / cpex_sql_sanitizer-0.1.4-cp311-abi3-manylinux_2_34_s390x.whl
| Download URL | cpex_sql_sanitizer-0.1.4-cp311-abi3-manylinux_2_34_s390x.whl |
|---|---|
| Size | 845.6 kB |
| Tags | CPython 3.11 Linux glibc 2.34+ IBM System/390x abi3 |
|
SHA-256 checksum How to use checksums |
d47edb126cfb5d50d453fea62a1cdb97aa7efec7d2c0e674ef835f601b78dd7a
|
|
BLAKE2b-256 checksum How to use checksums |
d56a14355ebda1bcdf78631805dbacaad593dea3e7d5b6759d5e420869f4eaea
|
| 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 Oct 5, 2026.
Transparency logRelease files / cpex_sql_sanitizer-0.1.4-cp311-abi3-manylinux_2_34_ppc64le.whl
| Download URL | cpex_sql_sanitizer-0.1.4-cp311-abi3-manylinux_2_34_ppc64le.whl |
|---|---|
| Size | 837.7 kB |
| Tags | CPython 3.11 Linux glibc 2.34+ PowerPC 64-le abi3 |
|
SHA-256 checksum How to use checksums |
e9f9987e4aa318dbb53d0ab6db7eee39d5895345d2fc0f6a89f5c145341cfbe3
|
|
BLAKE2b-256 checksum How to use checksums |
c146767448d680a4ea004806a8e77ee1fab9fc69fd88386c3cffe1901e5a6466
|
| 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 Oct 5, 2026.
Transparency logRelease files / cpex_sql_sanitizer-0.1.4-cp311-abi3-manylinux_2_34_aarch64.whl
| Download URL | cpex_sql_sanitizer-0.1.4-cp311-abi3-manylinux_2_34_aarch64.whl |
|---|---|
| Size | 760.3 kB |
| Tags | CPython 3.11 Linux glibc 2.34+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
5118b3e9294d11fb13475a40048f739deb8526f667c6783b0fbe101d769c2f99
|
|
BLAKE2b-256 checksum How to use checksums |
0200e1420a1c5d92e4561866ff6d14f4414ba29a028993f019bfc95c148ede9a
|
| 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 Oct 5, 2026.
Transparency logRelease files / cpex_sql_sanitizer-0.1.4-cp311-abi3-macosx_11_0_arm64.whl
| Download URL | cpex_sql_sanitizer-0.1.4-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 |
8ce6f1351339848b4119b17bb9045e0d9f44ec4aea96fc3be803fb477c9f1797
|
|
BLAKE2b-256 checksum How to use checksums |
10d6c844cc6bceb410493d89f4877682f9b80a1c0ece37a603145f427b6c98ff
|
| 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 Oct 5, 2026.
Transparency log