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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cpex_sql_sanitizer-0.1.2.tar.gz (46.5 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

cpex_sql_sanitizer-0.1.2-cp311-abi3-win_amd64.whl (723.4 kB view details)

Uploaded CPython 3.11+Windows x86-64

cpex_sql_sanitizer-0.1.2-cp311-abi3-manylinux_2_34_x86_64.whl (807.0 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.34+ x86-64

cpex_sql_sanitizer-0.1.2-cp311-abi3-manylinux_2_34_s390x.whl (842.9 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.34+ s390x

cpex_sql_sanitizer-0.1.2-cp311-abi3-manylinux_2_34_ppc64le.whl (830.8 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.34+ ppc64le

cpex_sql_sanitizer-0.1.2-cp311-abi3-manylinux_2_34_aarch64.whl (757.8 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.34+ ARM64

cpex_sql_sanitizer-0.1.2-cp311-abi3-macosx_11_0_arm64.whl (703.7 kB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

File details

Details for the file cpex_sql_sanitizer-0.1.2.tar.gz.

File metadata

  • Download URL: cpex_sql_sanitizer-0.1.2.tar.gz
  • Upload date:
  • Size: 46.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for cpex_sql_sanitizer-0.1.2.tar.gz
Algorithm Hash digest
SHA256 da3b2d5ad547a33a2d9b8294a353748066b92bc8eabcb04e43844631a0b975e2
MD5 801b879577327413b391accd04fea62a
BLAKE2b-256 7fd78b295c1918917e738ebb92f88a5ee455150e46f2c4110dbbfd28bf89a037

See more details on using hashes here.

Provenance

The following attestation bundles were made for cpex_sql_sanitizer-0.1.2.tar.gz:

Publisher: release-rust-python-package.yaml on IBM/cpex-plugins

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cpex_sql_sanitizer-0.1.2-cp311-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for cpex_sql_sanitizer-0.1.2-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 d7079d1fe4a523e01453ddf3e793122106dec304c670a92a94cc7fac67314447
MD5 341ffc3fcb7f5aba9819c55d055ab20b
BLAKE2b-256 2aaab287e3d21cdecc4282ebaec8dbc6ba9d482abad2434c29c88ceb4c104095

See more details on using hashes here.

Provenance

The following attestation bundles were made for cpex_sql_sanitizer-0.1.2-cp311-abi3-win_amd64.whl:

Publisher: release-rust-python-package.yaml on IBM/cpex-plugins

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cpex_sql_sanitizer-0.1.2-cp311-abi3-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for cpex_sql_sanitizer-0.1.2-cp311-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 28e6478e714e24ae7deda74c2070270d2425b60142554a3d7c1ef570de37be0c
MD5 8ab0f90f1a1863714e9c6c274d61578a
BLAKE2b-256 719f164fc92684efca1eacb395b47f0bce0b4be6ab1a23e5cad4606ad478a995

See more details on using hashes here.

Provenance

The following attestation bundles were made for cpex_sql_sanitizer-0.1.2-cp311-abi3-manylinux_2_34_x86_64.whl:

Publisher: release-rust-python-package.yaml on IBM/cpex-plugins

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cpex_sql_sanitizer-0.1.2-cp311-abi3-manylinux_2_34_s390x.whl.

File metadata

File hashes

Hashes for cpex_sql_sanitizer-0.1.2-cp311-abi3-manylinux_2_34_s390x.whl
Algorithm Hash digest
SHA256 86e561e812a5dea90c93867d6a5e94b064dc4d4ec5504b1460a91da0580e7b63
MD5 60ba2cc2ff60b4bbd52c5be18c97237a
BLAKE2b-256 fdb05d50ef8ae4376d9868f5b307cceba49c06252a6efb2da724addff06fb016

See more details on using hashes here.

Provenance

The following attestation bundles were made for cpex_sql_sanitizer-0.1.2-cp311-abi3-manylinux_2_34_s390x.whl:

Publisher: release-rust-python-package.yaml on IBM/cpex-plugins

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cpex_sql_sanitizer-0.1.2-cp311-abi3-manylinux_2_34_ppc64le.whl.

File metadata

File hashes

Hashes for cpex_sql_sanitizer-0.1.2-cp311-abi3-manylinux_2_34_ppc64le.whl
Algorithm Hash digest
SHA256 1009b14b4d5756c1c142baea6cc6aefb9896ca08eb873021f2764844195b98f4
MD5 428494675e2031bb3ecd5a67a170c338
BLAKE2b-256 8405138a598d7ad0ac0bb51dcc4549dd7e2fea20bf6f92cae9261edf3acb9f2c

See more details on using hashes here.

Provenance

The following attestation bundles were made for cpex_sql_sanitizer-0.1.2-cp311-abi3-manylinux_2_34_ppc64le.whl:

Publisher: release-rust-python-package.yaml on IBM/cpex-plugins

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cpex_sql_sanitizer-0.1.2-cp311-abi3-manylinux_2_34_aarch64.whl.

File metadata

File hashes

Hashes for cpex_sql_sanitizer-0.1.2-cp311-abi3-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 f5dcc0657ee739de30e26a13c154382aac6f70ba3a5c159cf0dc8b3275793d32
MD5 6709cf5226a39af43b621ba4f11d9396
BLAKE2b-256 9c0a8387a0e8d1967903eb37e74541bfb697b3f8b2fbd514b5aea1dffefaa9a8

See more details on using hashes here.

Provenance

The following attestation bundles were made for cpex_sql_sanitizer-0.1.2-cp311-abi3-manylinux_2_34_aarch64.whl:

Publisher: release-rust-python-package.yaml on IBM/cpex-plugins

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cpex_sql_sanitizer-0.1.2-cp311-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cpex_sql_sanitizer-0.1.2-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b50fb5abda47f5cb64fc07c76e42821d841278c019575e559f6736ca9a8525e4
MD5 ad397bf61af2ae5bf83b41ec963af343
BLAKE2b-256 9558ebce3ff01d2ac428a96e6b2c8a2d89a50fb1dcdc1422c14784b51273886c

See more details on using hashes here.

Provenance

The following attestation bundles were made for cpex_sql_sanitizer-0.1.2-cp311-abi3-macosx_11_0_arm64.whl:

Publisher: release-rust-python-package.yaml on IBM/cpex-plugins

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.2 This release

7 files

0.1.1

7 files

0.1.0

7 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