Rust-backed secrets detection plugin for MCP Gateway
Project description
cpex-secrets-detection
Rust-backed secrets detection plugin for MCP Gateway / CPEX.
What it does
This plugin scans hook payloads for likely secrets and can either:
- block processing when a secret is found
- redact matched values in the returned payload
- attach findings metadata to the hook result
Supported hooks:
prompt_pre_fetch: scanspayload.argstool_post_invoke: scanspayload.resultresource_post_fetch: scanspayload.content.text
It walks nested values, not just top-level strings. Coverage includes:
- plain strings
dictlisttuple- custom Python objects with
__dict__ - slot-based objects with
__slots__ - Pydantic-style objects that expose
model_dump()andmodel_copy()
When redaction is enabled, the plugin preserves payload shape as much as possible instead of flattening everything to plain dicts.
Exact detector coverage
The plugin ships these regex-based detectors:
aws_access_key_idaws_secret_access_keygoogle_api_keygithub_tokenstripe_secret_keyslack_tokenprivate_key_blockgeneric_api_key_assignmentjwt_likehex_secret_32base64_24
Default behavior:
- enabled by default:
aws_access_key_idaws_secret_access_keygoogle_api_keygithub_tokenstripe_secret_keyslack_tokenprivate_key_block
- disabled by default because they are broader and more false-positive-prone:
generic_api_key_assignmentjwt_likehex_secret_32base64_24
What it does not do
This plugin is intentionally narrow. It does not:
- verify whether a matched credential is real, active, or revoked
- call external services
- decode or unpack data before scanning
- no base64 decode pass
- no hex decode pass
- no gzip, zip, or archive inspection
- scan binary resource bodies
resource_post_fetchonly scanscontent.text
- inspect arbitrary object internals unless they are exposed through supported Python state surfaces such as
model_dump(),__dict__, or__slots__ - guarantee detection of every secret format
- coverage is limited to the listed regex patterns
- use entropy scoring, ML classification, or semantic analysis
- infer secret validity from surrounding prose
It also does not emit the original matched secret in outward-facing findings metadata or violation examples. Those surfaces contain secret types only.
Config
Available config keys:
enabled: map of detector name totrueorfalseredact: whether to replace matches in returned payloadsredaction_text: replacement text used whenredact=trueblock_on_detection: whether to stop processing on detectionmin_findings_to_block: threshold for blocking
Defaults:
enabled:
aws_access_key_id: true
aws_secret_access_key: true
google_api_key: true
github_token: true
stripe_secret_key: true
generic_api_key_assignment: false
slack_token: true
private_key_block: true
jwt_like: false
hex_secret_32: false
base64_24: false
redact: false
redaction_text: "***REDACTED***"
block_on_detection: true
min_findings_to_block: 1
Result shape
On detection, the plugin may return:
modified_payloadwith redacted values whenredact=truemetadata.countmetadata.secrets_redacted=truewhen redaction happenedmetadata.secrets_findings=[{"type": "..."}]when reporting findings without redaction- a
PluginViolationwithcode="SECRETS_DETECTED"when blocking
Build
uv sync --dev
make install
make test-all
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_secrets_detection-0.2.0.tar.gz.
File metadata
- Download URL: cpex_secrets_detection-0.2.0.tar.gz
- Upload date:
- Size: 149.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
419599e29688bfd7edd55a9244d3786ed4a646186482bae789395690b6dbc9c9
|
|
| MD5 |
1697620a228a74119cfc52bda398f94d
|
|
| BLAKE2b-256 |
ea3b7d00ea04379123492826d14de806addc1dfdb089b138a11924dbe2397601
|
Provenance
The following attestation bundles were made for cpex_secrets_detection-0.2.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_secrets_detection-0.2.0.tar.gz -
Subject digest:
419599e29688bfd7edd55a9244d3786ed4a646186482bae789395690b6dbc9c9 - Sigstore transparency entry: 1342321881
- Sigstore integration time:
-
Permalink:
IBM/cpex-plugins@0f75b05539d2106e6fdf7790b3c1136377204c5c -
Branch / Tag:
refs/tags/secrets-detection-v0.2.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@0f75b05539d2106e6fdf7790b3c1136377204c5c -
Trigger Event:
push
-
Statement type:
File details
Details for the file cpex_secrets_detection-0.2.0-cp311-abi3-win_amd64.whl.
File metadata
- Download URL: cpex_secrets_detection-0.2.0-cp311-abi3-win_amd64.whl
- Upload date:
- Size: 762.7 kB
- Tags: CPython 3.11+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8bf99b5f18697521e91a487bf85018df6628e3b3b2835b3db8a83a461b9b9d9f
|
|
| MD5 |
c6469b700250daedd40c1b9560d297e3
|
|
| BLAKE2b-256 |
fd4f4b6606235b3565072bf9995018836db6308df653e544579e63fb85e3b452
|
Provenance
The following attestation bundles were made for cpex_secrets_detection-0.2.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_secrets_detection-0.2.0-cp311-abi3-win_amd64.whl -
Subject digest:
8bf99b5f18697521e91a487bf85018df6628e3b3b2835b3db8a83a461b9b9d9f - Sigstore transparency entry: 1342321921
- Sigstore integration time:
-
Permalink:
IBM/cpex-plugins@0f75b05539d2106e6fdf7790b3c1136377204c5c -
Branch / Tag:
refs/tags/secrets-detection-v0.2.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@0f75b05539d2106e6fdf7790b3c1136377204c5c -
Trigger Event:
push
-
Statement type:
File details
Details for the file cpex_secrets_detection-0.2.0-cp311-abi3-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: cpex_secrets_detection-0.2.0-cp311-abi3-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 839.7 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.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ea4a5828b26614ff03348d442233b3547d6aff543dd123adc4b07af6ab5f3d4
|
|
| MD5 |
995090105f4111dc5b6d8e872b47d793
|
|
| BLAKE2b-256 |
6bd6587cf20c1a3eec2839e094bcafb79b762b7a0be15411ee8154184310e880
|
Provenance
The following attestation bundles were made for cpex_secrets_detection-0.2.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_secrets_detection-0.2.0-cp311-abi3-manylinux_2_34_x86_64.whl -
Subject digest:
7ea4a5828b26614ff03348d442233b3547d6aff543dd123adc4b07af6ab5f3d4 - Sigstore transparency entry: 1342321926
- Sigstore integration time:
-
Permalink:
IBM/cpex-plugins@0f75b05539d2106e6fdf7790b3c1136377204c5c -
Branch / Tag:
refs/tags/secrets-detection-v0.2.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@0f75b05539d2106e6fdf7790b3c1136377204c5c -
Trigger Event:
push
-
Statement type:
File details
Details for the file cpex_secrets_detection-0.2.0-cp311-abi3-manylinux_2_34_s390x.whl.
File metadata
- Download URL: cpex_secrets_detection-0.2.0-cp311-abi3-manylinux_2_34_s390x.whl
- Upload date:
- Size: 880.9 kB
- Tags: CPython 3.11+, manylinux: glibc 2.34+ s390x
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e7af8fb3ac2fdd28a17263c9a89f548c6d27d5b4c2e8ec378cee7da4eb17f956
|
|
| MD5 |
8d67412b6914c2cb2f1718f4b797b90f
|
|
| BLAKE2b-256 |
b8be276d3b6bea355292f082c4a9d23410c1127d6744c8bcef75aa4e393eae8a
|
Provenance
The following attestation bundles were made for cpex_secrets_detection-0.2.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_secrets_detection-0.2.0-cp311-abi3-manylinux_2_34_s390x.whl -
Subject digest:
e7af8fb3ac2fdd28a17263c9a89f548c6d27d5b4c2e8ec378cee7da4eb17f956 - Sigstore transparency entry: 1342321901
- Sigstore integration time:
-
Permalink:
IBM/cpex-plugins@0f75b05539d2106e6fdf7790b3c1136377204c5c -
Branch / Tag:
refs/tags/secrets-detection-v0.2.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@0f75b05539d2106e6fdf7790b3c1136377204c5c -
Trigger Event:
push
-
Statement type:
File details
Details for the file cpex_secrets_detection-0.2.0-cp311-abi3-manylinux_2_34_ppc64le.whl.
File metadata
- Download URL: cpex_secrets_detection-0.2.0-cp311-abi3-manylinux_2_34_ppc64le.whl
- Upload date:
- Size: 863.7 kB
- Tags: CPython 3.11+, manylinux: glibc 2.34+ ppc64le
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa3fcdd5bbcf3bcaea7a4758a7fa5f24c46e568e05654b4d770ee14bf0ca625f
|
|
| MD5 |
54f9a7ae0a2b99808dc2d0cb85b1b72c
|
|
| BLAKE2b-256 |
f5826bbec7d1e65ad5d16f986c653771e12ba8503018d6961eb3236ab1bf8e57
|
Provenance
The following attestation bundles were made for cpex_secrets_detection-0.2.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_secrets_detection-0.2.0-cp311-abi3-manylinux_2_34_ppc64le.whl -
Subject digest:
fa3fcdd5bbcf3bcaea7a4758a7fa5f24c46e568e05654b4d770ee14bf0ca625f - Sigstore transparency entry: 1342321932
- Sigstore integration time:
-
Permalink:
IBM/cpex-plugins@0f75b05539d2106e6fdf7790b3c1136377204c5c -
Branch / Tag:
refs/tags/secrets-detection-v0.2.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@0f75b05539d2106e6fdf7790b3c1136377204c5c -
Trigger Event:
push
-
Statement type:
File details
Details for the file cpex_secrets_detection-0.2.0-cp311-abi3-manylinux_2_34_aarch64.whl.
File metadata
- Download URL: cpex_secrets_detection-0.2.0-cp311-abi3-manylinux_2_34_aarch64.whl
- Upload date:
- Size: 781.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.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c80a1f4e609d2531fea040e219aacdf2b7eaf57cb043bdba4f19b5f8e6cdbe8c
|
|
| MD5 |
3258e177ad6d4000526a7c19fcd90a13
|
|
| BLAKE2b-256 |
e3e9bd2c4367b6130e8fef04444328b3c51b23877a52aa046ee783cd59c67c65
|
Provenance
The following attestation bundles were made for cpex_secrets_detection-0.2.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_secrets_detection-0.2.0-cp311-abi3-manylinux_2_34_aarch64.whl -
Subject digest:
c80a1f4e609d2531fea040e219aacdf2b7eaf57cb043bdba4f19b5f8e6cdbe8c - Sigstore transparency entry: 1342321911
- Sigstore integration time:
-
Permalink:
IBM/cpex-plugins@0f75b05539d2106e6fdf7790b3c1136377204c5c -
Branch / Tag:
refs/tags/secrets-detection-v0.2.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@0f75b05539d2106e6fdf7790b3c1136377204c5c -
Trigger Event:
push
-
Statement type:
File details
Details for the file cpex_secrets_detection-0.2.0-cp311-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: cpex_secrets_detection-0.2.0-cp311-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 738.6 kB
- Tags: CPython 3.11+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
990ad5e352322013ae0c16a0f1d7bd5398b00eb1bb4ddcb825481bd5d535ff99
|
|
| MD5 |
220dbb7f1a9bd7ae252ec065b86e4d1d
|
|
| BLAKE2b-256 |
79c851b05aa5a6d195cd920e8f52f98c2ff6990dc41f156748b1ca1b08310385
|
Provenance
The following attestation bundles were made for cpex_secrets_detection-0.2.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_secrets_detection-0.2.0-cp311-abi3-macosx_11_0_arm64.whl -
Subject digest:
990ad5e352322013ae0c16a0f1d7bd5398b00eb1bb4ddcb825481bd5d535ff99 - Sigstore transparency entry: 1342321894
- Sigstore integration time:
-
Permalink:
IBM/cpex-plugins@0f75b05539d2106e6fdf7790b3c1136377204c5c -
Branch / Tag:
refs/tags/secrets-detection-v0.2.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@0f75b05539d2106e6fdf7790b3c1136377204c5c -
Trigger Event:
push
-
Statement type: