Rust-backed SQL sanitizer plugin for MCP Gateway
Project description
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: ...
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cpex_sql_sanitizer-0.1.0.tar.gz.
File metadata
- Download URL: cpex_sql_sanitizer-0.1.0.tar.gz
- Upload date:
- Size: 114.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c8d8272f8352dee76e5b852cbae9e0b52da26e376c1e51b12552758c7153e32a
|
|
| MD5 |
6ff87ac24ce5d1b346f08377039b8a04
|
|
| BLAKE2b-256 |
bd6064d15f14178fa6c7c352ea2332f499ef553a93eed936f72409e06691c5c2
|
Provenance
The following attestation bundles were made for cpex_sql_sanitizer-0.1.0.tar.gz:
Publisher:
release-rust-python-package.yaml on IBM/cpex-plugins
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cpex_sql_sanitizer-0.1.0.tar.gz -
Subject digest:
c8d8272f8352dee76e5b852cbae9e0b52da26e376c1e51b12552758c7153e32a - Sigstore transparency entry: 2212130952
- Sigstore integration time:
-
Permalink:
IBM/cpex-plugins@4fee8ce947df5a0624ed4c4d5d28929cc8758c50 -
Branch / Tag:
refs/tags/sql-sanitizer-v0.1.0 - Owner: https://github.com/IBM
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-rust-python-package.yaml@4fee8ce947df5a0624ed4c4d5d28929cc8758c50 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cpex_sql_sanitizer-0.1.0-cp311-abi3-win_amd64.whl.
File metadata
- Download URL: cpex_sql_sanitizer-0.1.0-cp311-abi3-win_amd64.whl
- Upload date:
- Size: 707.0 kB
- Tags: CPython 3.11+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7aa0c086091622a658d1d9b276224a5a74954544800963baee54cfe7487afbef
|
|
| MD5 |
72dff3a4a64b8521733d9f416cc71314
|
|
| BLAKE2b-256 |
f4f757e489606d808708dd5f2284662fdfaaeef23d433f40b6981ad03de4c0f8
|
Provenance
The following attestation bundles were made for cpex_sql_sanitizer-0.1.0-cp311-abi3-win_amd64.whl:
Publisher:
release-rust-python-package.yaml on IBM/cpex-plugins
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cpex_sql_sanitizer-0.1.0-cp311-abi3-win_amd64.whl -
Subject digest:
7aa0c086091622a658d1d9b276224a5a74954544800963baee54cfe7487afbef - Sigstore transparency entry: 2212131060
- Sigstore integration time:
-
Permalink:
IBM/cpex-plugins@4fee8ce947df5a0624ed4c4d5d28929cc8758c50 -
Branch / Tag:
refs/tags/sql-sanitizer-v0.1.0 - Owner: https://github.com/IBM
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-rust-python-package.yaml@4fee8ce947df5a0624ed4c4d5d28929cc8758c50 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cpex_sql_sanitizer-0.1.0-cp311-abi3-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: cpex_sql_sanitizer-0.1.0-cp311-abi3-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 784.6 kB
- Tags: CPython 3.11+, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a8b9cd39fec82f1df09af76aaadebaf391d6fa91e4b10694e7013f179edddac3
|
|
| MD5 |
0c080c8cb5e1a15419978d05d0f701a3
|
|
| BLAKE2b-256 |
c79e47941e2f2af925d3655e4e24aaaa98e813ca870f960c957ed40b0dabda8a
|
Provenance
The following attestation bundles were made for cpex_sql_sanitizer-0.1.0-cp311-abi3-manylinux_2_34_x86_64.whl:
Publisher:
release-rust-python-package.yaml on IBM/cpex-plugins
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cpex_sql_sanitizer-0.1.0-cp311-abi3-manylinux_2_34_x86_64.whl -
Subject digest:
a8b9cd39fec82f1df09af76aaadebaf391d6fa91e4b10694e7013f179edddac3 - Sigstore transparency entry: 2212131087
- Sigstore integration time:
-
Permalink:
IBM/cpex-plugins@4fee8ce947df5a0624ed4c4d5d28929cc8758c50 -
Branch / Tag:
refs/tags/sql-sanitizer-v0.1.0 - Owner: https://github.com/IBM
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-rust-python-package.yaml@4fee8ce947df5a0624ed4c4d5d28929cc8758c50 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cpex_sql_sanitizer-0.1.0-cp311-abi3-manylinux_2_34_s390x.whl.
File metadata
- Download URL: cpex_sql_sanitizer-0.1.0-cp311-abi3-manylinux_2_34_s390x.whl
- Upload date:
- Size: 819.3 kB
- Tags: CPython 3.11+, manylinux: glibc 2.34+ s390x
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
10319a4715a48bc90f36b2ff8ce4f24dfa282801b693c886e53e83b1d4da9745
|
|
| MD5 |
b514a8bf81e653e3e6e6f14b337b2459
|
|
| BLAKE2b-256 |
195081917715d6ae9d7ff0c28630bbb3d28ca1e5f67d49cc5bc2de1e9b48118c
|
Provenance
The following attestation bundles were made for cpex_sql_sanitizer-0.1.0-cp311-abi3-manylinux_2_34_s390x.whl:
Publisher:
release-rust-python-package.yaml on IBM/cpex-plugins
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cpex_sql_sanitizer-0.1.0-cp311-abi3-manylinux_2_34_s390x.whl -
Subject digest:
10319a4715a48bc90f36b2ff8ce4f24dfa282801b693c886e53e83b1d4da9745 - Sigstore transparency entry: 2212130995
- Sigstore integration time:
-
Permalink:
IBM/cpex-plugins@4fee8ce947df5a0624ed4c4d5d28929cc8758c50 -
Branch / Tag:
refs/tags/sql-sanitizer-v0.1.0 - Owner: https://github.com/IBM
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-rust-python-package.yaml@4fee8ce947df5a0624ed4c4d5d28929cc8758c50 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cpex_sql_sanitizer-0.1.0-cp311-abi3-manylinux_2_34_ppc64le.whl.
File metadata
- Download URL: cpex_sql_sanitizer-0.1.0-cp311-abi3-manylinux_2_34_ppc64le.whl
- Upload date:
- Size: 806.3 kB
- Tags: CPython 3.11+, manylinux: glibc 2.34+ ppc64le
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c96cb5b9938dfabf3ae582f6141d0f82be4908d01c403f3406b7757d5057d8d
|
|
| MD5 |
fc53f20137dd05ffee3bc4c84f3e3467
|
|
| BLAKE2b-256 |
00dd3f4fc23ef061302975ebc558eb5372a5c2ec983d4767093b7a299140d368
|
Provenance
The following attestation bundles were made for cpex_sql_sanitizer-0.1.0-cp311-abi3-manylinux_2_34_ppc64le.whl:
Publisher:
release-rust-python-package.yaml on IBM/cpex-plugins
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cpex_sql_sanitizer-0.1.0-cp311-abi3-manylinux_2_34_ppc64le.whl -
Subject digest:
9c96cb5b9938dfabf3ae582f6141d0f82be4908d01c403f3406b7757d5057d8d - Sigstore transparency entry: 2212131016
- Sigstore integration time:
-
Permalink:
IBM/cpex-plugins@4fee8ce947df5a0624ed4c4d5d28929cc8758c50 -
Branch / Tag:
refs/tags/sql-sanitizer-v0.1.0 - Owner: https://github.com/IBM
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-rust-python-package.yaml@4fee8ce947df5a0624ed4c4d5d28929cc8758c50 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cpex_sql_sanitizer-0.1.0-cp311-abi3-manylinux_2_34_aarch64.whl.
File metadata
- Download URL: cpex_sql_sanitizer-0.1.0-cp311-abi3-manylinux_2_34_aarch64.whl
- Upload date:
- Size: 738.4 kB
- Tags: CPython 3.11+, manylinux: glibc 2.34+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
849187585f9f023bce5536445c9ffc37c1d2ba410ff714afac6e0d9e8a359cac
|
|
| MD5 |
18b1eb0c9bf4af87c268de9eaedfb9e5
|
|
| BLAKE2b-256 |
9a44a57c1557a6df750905ea580a5f7de7563a7c2dde7e77bfb0f7497be291f5
|
Provenance
The following attestation bundles were made for cpex_sql_sanitizer-0.1.0-cp311-abi3-manylinux_2_34_aarch64.whl:
Publisher:
release-rust-python-package.yaml on IBM/cpex-plugins
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cpex_sql_sanitizer-0.1.0-cp311-abi3-manylinux_2_34_aarch64.whl -
Subject digest:
849187585f9f023bce5536445c9ffc37c1d2ba410ff714afac6e0d9e8a359cac - Sigstore transparency entry: 2212131036
- Sigstore integration time:
-
Permalink:
IBM/cpex-plugins@4fee8ce947df5a0624ed4c4d5d28929cc8758c50 -
Branch / Tag:
refs/tags/sql-sanitizer-v0.1.0 - Owner: https://github.com/IBM
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-rust-python-package.yaml@4fee8ce947df5a0624ed4c4d5d28929cc8758c50 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cpex_sql_sanitizer-0.1.0-cp311-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: cpex_sql_sanitizer-0.1.0-cp311-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 693.1 kB
- Tags: CPython 3.11+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b152579754ed659bbc0432716e2882a95f9b666a8fca5729f8ed73a4011ebcd
|
|
| MD5 |
44759454956bc3b27a4f7fd81bfb5fc6
|
|
| BLAKE2b-256 |
0f7142163410b3526be992c2bf6413aaa413b0aaee3131f5700e9c4ccb838634
|
Provenance
The following attestation bundles were made for cpex_sql_sanitizer-0.1.0-cp311-abi3-macosx_11_0_arm64.whl:
Publisher:
release-rust-python-package.yaml on IBM/cpex-plugins
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cpex_sql_sanitizer-0.1.0-cp311-abi3-macosx_11_0_arm64.whl -
Subject digest:
4b152579754ed659bbc0432716e2882a95f9b666a8fca5729f8ed73a4011ebcd - Sigstore transparency entry: 2212130975
- Sigstore integration time:
-
Permalink:
IBM/cpex-plugins@4fee8ce947df5a0624ed4c4d5d28929cc8758c50 -
Branch / Tag:
refs/tags/sql-sanitizer-v0.1.0 - Owner: https://github.com/IBM
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-rust-python-package.yaml@4fee8ce947df5a0624ed4c4d5d28929cc8758c50 -
Trigger Event:
push
-
Statement type: