High-performance URL reputation and phishing detection for MCP Gateway
Project description
URL Reputation (Rust)
Static URL policy checks for ContextForge and MCP Gateway resource fetches.
Features
- Blocks resource fetches before execution with the
resource_pre_fetchhook - Allows trusted domains or URL regex patterns to bypass later checks
- Blocks configured domains, subdomains, or URL regex patterns
- Blocks non-HTTPS URLs by default
- Optional domain heuristics for high entropy, static IANA TLD validity, and Unicode security
- Case-insensitive domain normalization for allowlist and blocklist entries
- Pure static policy checks; no external reputation provider or threat-intel feed calls
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
The plugin runs on resource_pre_fetch before a resource URI is fetched.
Typical uses:
- block known bad domains and subdomains
- allow trusted internal URL patterns before enforcing HTTPS
- reject insecure
http://resource fetches - enable lightweight domain heuristics for suspicious generated or Unicode domains
Configuration
config:
whitelist_domains:
- "example.com"
allowed_patterns:
- "^https://trusted\\.internal/.*"
blocked_domains:
- "malicious.example.com"
blocked_patterns:
- "casino"
- "crypto"
use_heuristic_check: false
entropy_threshold: 3.65
block_non_secure_http: true
| Field | Type | Default | Description |
|---|---|---|---|
whitelist_domains |
set | [] |
Domains and subdomains that bypass remaining checks |
allowed_patterns |
list | [] |
Regexes matched against the full trimmed URL; a match bypasses remaining checks |
blocked_domains |
set | [] |
Domains and subdomains that are always blocked unless allowlisted first |
blocked_patterns |
list | [] |
Regexes matched against the full trimmed URL; a match blocks the request |
use_heuristic_check |
bool | false |
Enable entropy, TLD, and Unicode domain checks for non-IP hosts |
entropy_threshold |
float | 3.65 |
Maximum allowed Shannon entropy for the domain |
block_non_secure_http |
bool | true |
Block URLs whose scheme is not https |
Logic Workflow
- Trim and parse the URL.
- Extract the host/domain.
- Detect IPv4 or IPv6 hosts so domain heuristics can be skipped.
- Allow exact or parent-domain matches in
whitelist_domains. - Allow matches in
allowed_patterns; this also bypasses HTTPS enforcement. - Block non-HTTPS schemes when
block_non_secure_http=true. - Block exact or parent-domain matches in
blocked_domains. - Block matches in
blocked_patterns. - If heuristics are enabled for a non-IP host, block high-entropy domains, illegal static TLDs, or unsafe Unicode domains.
Returned Metadata
Allowed URLs return continue_processing=true.
Blocked URLs return continue_processing=false with a PluginViolation using code URL_REPUTATION_BLOCK. Violation details include the URL or domain involved in the decision.
Limitations
- Reputation data is static configuration only; there are no external provider lookups.
- The IANA TLD list is compiled into the plugin and can lag newly delegated TLDs.
allowed_patternsintentionally runs before HTTPS enforcement, so trusted patterns can allowhttp://URLs.- IP addresses skip domain heuristics.
Testing
make ci
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_url_reputation-0.3.4.tar.gz.
File metadata
- Download URL: cpex_url_reputation-0.3.4.tar.gz
- Upload date:
- Size: 42.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
58fe361c4b925c2b7373c7c97b40ed9879c873b09318cad202961328feeb53aa
|
|
| MD5 |
de25ae89e6303814655629e1d08918f6
|
|
| BLAKE2b-256 |
49bdd70782815a66ddc8696afc0a951f216148c388809abaa5b5c857bf036812
|
Provenance
The following attestation bundles were made for cpex_url_reputation-0.3.4.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_url_reputation-0.3.4.tar.gz -
Subject digest:
58fe361c4b925c2b7373c7c97b40ed9879c873b09318cad202961328feeb53aa - Sigstore transparency entry: 1936059210
- Sigstore integration time:
-
Permalink:
IBM/cpex-plugins@a925837ddcca879467b81f0001464ac58609d442 -
Branch / Tag:
refs/tags/url-reputation-v0.3.4 - 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@a925837ddcca879467b81f0001464ac58609d442 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cpex_url_reputation-0.3.4-cp311-abi3-win_amd64.whl.
File metadata
- Download URL: cpex_url_reputation-0.3.4-cp311-abi3-win_amd64.whl
- Upload date:
- Size: 844.6 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 |
d059fbd921ddd20f941a06e18ddad8aa49bc8a0b79d19f340e65706847ea084f
|
|
| MD5 |
77d8cb4c293332c86a4b05624ee6011e
|
|
| BLAKE2b-256 |
e1b1daaec8558ae6d569449e8e471176700f681fbfcb04443fd2b8e313eb3e05
|
Provenance
The following attestation bundles were made for cpex_url_reputation-0.3.4-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_url_reputation-0.3.4-cp311-abi3-win_amd64.whl -
Subject digest:
d059fbd921ddd20f941a06e18ddad8aa49bc8a0b79d19f340e65706847ea084f - Sigstore transparency entry: 1936059315
- Sigstore integration time:
-
Permalink:
IBM/cpex-plugins@a925837ddcca879467b81f0001464ac58609d442 -
Branch / Tag:
refs/tags/url-reputation-v0.3.4 - 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@a925837ddcca879467b81f0001464ac58609d442 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cpex_url_reputation-0.3.4-cp311-abi3-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: cpex_url_reputation-0.3.4-cp311-abi3-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 925.9 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 |
b91db67405dc00e93d147cc4fb6688ac8983c6935d8b41709db33f3c0c249313
|
|
| MD5 |
04169f97148bf89e926bab09482dc186
|
|
| BLAKE2b-256 |
8be4f25c6e9208094d22434a89192f10cb5ae27f081773afa08eb72378474bf8
|
Provenance
The following attestation bundles were made for cpex_url_reputation-0.3.4-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_url_reputation-0.3.4-cp311-abi3-manylinux_2_34_x86_64.whl -
Subject digest:
b91db67405dc00e93d147cc4fb6688ac8983c6935d8b41709db33f3c0c249313 - Sigstore transparency entry: 1936059397
- Sigstore integration time:
-
Permalink:
IBM/cpex-plugins@a925837ddcca879467b81f0001464ac58609d442 -
Branch / Tag:
refs/tags/url-reputation-v0.3.4 - 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@a925837ddcca879467b81f0001464ac58609d442 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cpex_url_reputation-0.3.4-cp311-abi3-manylinux_2_34_s390x.whl.
File metadata
- Download URL: cpex_url_reputation-0.3.4-cp311-abi3-manylinux_2_34_s390x.whl
- Upload date:
- Size: 981.1 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 |
e97bf605d931d8a478236cbc34e6170a07189fd3670fda9bb2cc3c03ae054ea7
|
|
| MD5 |
bda97b08a581ad8aaa99abc8d166d9fb
|
|
| BLAKE2b-256 |
9d2d13eaea84a0a818b93807d7ad6c020642e46dd16f08654376bf33e81d27f6
|
Provenance
The following attestation bundles were made for cpex_url_reputation-0.3.4-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_url_reputation-0.3.4-cp311-abi3-manylinux_2_34_s390x.whl -
Subject digest:
e97bf605d931d8a478236cbc34e6170a07189fd3670fda9bb2cc3c03ae054ea7 - Sigstore transparency entry: 1936059238
- Sigstore integration time:
-
Permalink:
IBM/cpex-plugins@a925837ddcca879467b81f0001464ac58609d442 -
Branch / Tag:
refs/tags/url-reputation-v0.3.4 - 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@a925837ddcca879467b81f0001464ac58609d442 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cpex_url_reputation-0.3.4-cp311-abi3-manylinux_2_34_ppc64le.whl.
File metadata
- Download URL: cpex_url_reputation-0.3.4-cp311-abi3-manylinux_2_34_ppc64le.whl
- Upload date:
- Size: 959.9 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 |
1501ec97bf746dbb6fba9127c4b73a0b9ef7c39ac8131475348e98bc8d88e46b
|
|
| MD5 |
f2329a25d7f4f98bc7bfcda1a7ff6ffd
|
|
| BLAKE2b-256 |
10a3260fff66ad84c20b6492d4e2fcd00fdc0606ec10817ddd5e6afbb7e61cf6
|
Provenance
The following attestation bundles were made for cpex_url_reputation-0.3.4-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_url_reputation-0.3.4-cp311-abi3-manylinux_2_34_ppc64le.whl -
Subject digest:
1501ec97bf746dbb6fba9127c4b73a0b9ef7c39ac8131475348e98bc8d88e46b - Sigstore transparency entry: 1936059357
- Sigstore integration time:
-
Permalink:
IBM/cpex-plugins@a925837ddcca879467b81f0001464ac58609d442 -
Branch / Tag:
refs/tags/url-reputation-v0.3.4 - 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@a925837ddcca879467b81f0001464ac58609d442 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cpex_url_reputation-0.3.4-cp311-abi3-manylinux_2_34_aarch64.whl.
File metadata
- Download URL: cpex_url_reputation-0.3.4-cp311-abi3-manylinux_2_34_aarch64.whl
- Upload date:
- Size: 876.5 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 |
7504ac0916e6fea7f3221a78079a479bfb28e3eb3eb842d3f26c4ee330d0310e
|
|
| MD5 |
177e570337edefdde56351e510bc5521
|
|
| BLAKE2b-256 |
4b0db4586f59fbcfacff5cd7da5950197f74b149282773c732b64296a013d1b2
|
Provenance
The following attestation bundles were made for cpex_url_reputation-0.3.4-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_url_reputation-0.3.4-cp311-abi3-manylinux_2_34_aarch64.whl -
Subject digest:
7504ac0916e6fea7f3221a78079a479bfb28e3eb3eb842d3f26c4ee330d0310e - Sigstore transparency entry: 1936059433
- Sigstore integration time:
-
Permalink:
IBM/cpex-plugins@a925837ddcca879467b81f0001464ac58609d442 -
Branch / Tag:
refs/tags/url-reputation-v0.3.4 - 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@a925837ddcca879467b81f0001464ac58609d442 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cpex_url_reputation-0.3.4-cp311-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: cpex_url_reputation-0.3.4-cp311-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 828.2 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 |
6f17f62d285309fc0bb17a8cfba462534a2a19b9968a8929d13461527d8c7587
|
|
| MD5 |
5b150a2bb044b895d2b02e5af91a3601
|
|
| BLAKE2b-256 |
658132dfa8f90205c6c66315996c6fd41e2ce6ae63b6865b4eaee86869bbc5ee
|
Provenance
The following attestation bundles were made for cpex_url_reputation-0.3.4-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_url_reputation-0.3.4-cp311-abi3-macosx_11_0_arm64.whl -
Subject digest:
6f17f62d285309fc0bb17a8cfba462534a2a19b9968a8929d13461527d8c7587 - Sigstore transparency entry: 1936059269
- Sigstore integration time:
-
Permalink:
IBM/cpex-plugins@a925837ddcca879467b81f0001464ac58609d442 -
Branch / Tag:
refs/tags/url-reputation-v0.3.4 - 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@a925837ddcca879467b81f0001464ac58609d442 -
Trigger Event:
push
-
Statement type: