Skip to content

Commit afc2cc6

Browse files
authored
docs: refresh plugin readmes (#122)
Signed-off-by: lucarlig <luca.carlig@ibm.com>
1 parent 9c32502 commit afc2cc6

7 files changed

Lines changed: 154 additions & 248 deletions

File tree

‎README.md‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Monorepo for managed CPEX plugins that are implemented in Rust and published as
44

55
## Runtime Requirements
66

7-
These packages target the CPEX release-candidate framework API and intentionally depend on `cpex>=0.1.0rc1,<0.2`. The RC dependency is the migration target for this repository; it is not an accidental pre-stable dependency.
7+
These packages target the CPEX 0.1 framework API and intentionally depend on `cpex>=0.1.0,<0.2`.
88

99
Rust plugin packages require their compiled PyO3 extension at import/runtime. They do not ship Python fallback implementations for missing Rust extensions.
1010

@@ -14,8 +14,14 @@ Managed plugins live under `plugins/rust/python-package/<slug>/`.
1414

1515
Current plugins:
1616

17-
- `rate_limiter`
18-
- `pii_filter`
17+
| Plugin | Package | Purpose |
18+
|---|---|---|
19+
| `encoded_exfil_detection` | `cpex-encoded-exfil-detection` | Detect suspicious encoded payload exfiltration patterns in prompt arguments, tool output, and resource content |
20+
| `pii_filter` | `cpex-pii-filter` | Detect and mask PII in nested payloads |
21+
| `rate_limiter` | `cpex-rate-limiter` | Enforce per-user, per-tenant, and per-tool rate limits |
22+
| `retry_with_backoff` | `cpex-retry-with-backoff` | Apply retry policy and exponential backoff metadata to transient failures |
23+
| `secrets_detection` | `cpex-secrets-detection` | Detect and redact likely credentials in prompt arguments, tool inputs and outputs, and resource content |
24+
| `url_reputation` | `cpex-url-reputation` | Apply static URL allowlist, blocklist, pattern, and heuristic checks before resource fetches |
1925

2026
Each managed plugin must include:
2127

‎plugins/rust/python-package/encoded_exfil_detection/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ make install
2525

2626
## Runtime Requirements
2727

28-
This plugin depends on `cpex>=0.1.0rc1,<0.2` and imports hook models from `cpex.framework`. The compiled Rust extension is mandatory; there is no Python fallback implementation.
28+
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.
2929

3030
## Usage
3131

‎plugins/rust/python-package/pii_filter/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ make install
2222

2323
## Runtime Requirements
2424

25-
This plugin depends on `cpex>=0.1.0rc1,<0.2` and imports hook models from `cpex.framework`. The compiled Rust extension is mandatory; there is no Python fallback implementation.
25+
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.
2626

2727
## Usage
2828

‎plugins/rust/python-package/rate_limiter/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Enforces rate limits per user, tenant, and tool across `tool_pre_invoke` and `pr
66

77
## Runtime Requirements
88

9-
This plugin depends on `cpex>=0.1.0rc1,<0.2` and imports hook models from `cpex.framework`. The compiled Rust extension is mandatory; there is no Python fallback implementation.
9+
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.
1010

1111
## Hooks
1212

‎plugins/rust/python-package/retry_with_backoff/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ make install
2020

2121
## Runtime Requirements
2222

23-
This plugin depends on `cpex>=0.1.0rc1,<0.2` and imports hook models from `cpex.framework`. The compiled Rust extension is mandatory; there is no Python fallback implementation.
23+
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.
2424

2525
## Usage
2626

Lines changed: 77 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,44 @@
1-
# cpex-secrets-detection
1+
# Secrets Detection (Rust)
22

3-
Rust-backed secrets detection plugin for MCP Gateway / CPEX.
3+
Rust-backed secrets detection and redaction for ContextForge and MCP Gateway.
44

5-
## Runtime Requirements
5+
## Features
6+
7+
- Detects likely credentials in prompt arguments, tool inputs, tool outputs, and resource content
8+
- Built-in detectors for AWS keys, Google API keys, GitHub tokens, Stripe keys, Slack tokens, and private key blocks
9+
- Optional broad detectors for generic API key assignments, JWT-like strings, long hex strings, and base64-like secrets
10+
- Blocking, redaction, or metadata-only reporting modes
11+
- Recursive scanning for nested dicts, lists, tuples, Pydantic-style objects, `__dict__`, and `__slots__`
12+
- Sanitized outward metadata that reports finding types and counts, not original secret values
613

7-
This plugin depends on `cpex>=0.1.0rc1,<0.2` and imports hook models from `cpex.framework`. The compiled Rust extension is mandatory; there is no Python fallback implementation.
14+
## Build
15+
16+
```bash
17+
make install
18+
```
819

9-
## What it does
20+
## Runtime Requirements
1021

11-
This plugin scans hook payloads for likely secrets and can either:
22+
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.
1223

13-
- block processing when a secret is found
14-
- redact matched values in the returned payload
15-
- attach findings metadata to the hook result
24+
## Usage
1625

17-
Supported hooks:
26+
The plugin scans these hooks:
1827

1928
- `prompt_pre_fetch`: scans `payload.args`
29+
- `tool_pre_invoke`: scans tool invocation payloads before execution
2030
- `tool_post_invoke`: scans `payload.result`
2131
- `resource_post_fetch`: scans `payload.content.text`
2232

23-
It walks nested values, not just top-level strings. Coverage includes:
33+
Typical uses:
2434

25-
- plain strings
26-
- `dict`
27-
- `list`
28-
- `tuple`
29-
- custom Python objects with `__dict__`
30-
- slot-based objects with `__slots__`
31-
- Pydantic-style objects that expose `model_dump()` and `model_copy()`
35+
- block requests that contain likely credentials before they reach tools or prompts
36+
- redact secrets from returned tool or resource payloads
37+
- surface sanitized findings metadata for observability and tuning
3238

33-
When redaction is enabled, the plugin preserves payload shape as much as possible instead of flattening everything to plain dicts.
39+
## Detection Coverage
3440

35-
## Exact detector coverage
36-
37-
The plugin ships these regex-based detectors:
41+
Enabled by default:
3842

3943
- `aws_access_key_id`
4044
- `aws_secret_access_key`
@@ -43,92 +47,72 @@ The plugin ships these regex-based detectors:
4347
- `stripe_secret_key`
4448
- `slack_token`
4549
- `private_key_block`
50+
51+
Disabled by default because they are broader and more false-positive-prone:
52+
4653
- `generic_api_key_assignment`
4754
- `jwt_like`
4855
- `hex_secret_32`
4956
- `base64_24`
5057

51-
Default behavior:
52-
53-
- enabled by default:
54-
- `aws_access_key_id`
55-
- `aws_secret_access_key`
56-
- `google_api_key`
57-
- `github_token`
58-
- `stripe_secret_key`
59-
- `slack_token`
60-
- `private_key_block`
61-
- disabled by default because they are broader and more false-positive-prone:
62-
- `generic_api_key_assignment`
63-
- `jwt_like`
64-
- `hex_secret_32`
65-
- `base64_24`
66-
67-
## What it does not do
68-
69-
This plugin is intentionally narrow. It does not:
70-
71-
- verify whether a matched credential is real, active, or revoked
72-
- call external services
73-
- decode or unpack data before scanning
74-
- no base64 decode pass
75-
- no hex decode pass
76-
- no gzip, zip, or archive inspection
77-
- scan binary resource bodies
78-
- `resource_post_fetch` only scans `content.text`
79-
- inspect arbitrary object internals unless they are exposed through supported Python state surfaces such as `model_dump()`, `__dict__`, or `__slots__`
80-
- guarantee detection of every secret format
81-
- coverage is limited to the listed regex patterns
82-
- use entropy scoring, ML classification, or semantic analysis
83-
- infer secret validity from surrounding prose
84-
85-
It also does not emit the original matched secret in outward-facing findings metadata or violation examples. Those surfaces contain secret types only.
86-
87-
## Config
88-
89-
Available config keys:
90-
91-
- `enabled`: map of detector name to `true` or `false`
92-
- `redact`: whether to replace matches in returned payloads
93-
- `redaction_text`: replacement text used when `redact=true`
94-
- `block_on_detection`: whether to stop processing on detection
95-
- `min_findings_to_block`: threshold for blocking
96-
97-
Defaults:
58+
The detectors are regex-based. They do not verify whether a credential is real, active, or revoked.
59+
60+
## Configuration
9861

9962
```yaml
100-
enabled:
101-
aws_access_key_id: true
102-
aws_secret_access_key: true
103-
google_api_key: true
104-
github_token: true
105-
stripe_secret_key: true
106-
generic_api_key_assignment: false
107-
slack_token: true
108-
private_key_block: true
109-
jwt_like: false
110-
hex_secret_32: false
111-
base64_24: false
112-
redact: false
113-
redaction_text: "***REDACTED***"
114-
block_on_detection: true
115-
min_findings_to_block: 1
63+
config:
64+
enabled:
65+
aws_access_key_id: true
66+
aws_secret_access_key: true
67+
google_api_key: true
68+
github_token: true
69+
stripe_secret_key: true
70+
slack_token: true
71+
private_key_block: true
72+
generic_api_key_assignment: false
73+
jwt_like: false
74+
hex_secret_32: false
75+
base64_24: false
76+
redact: false
77+
redaction_text: "***REDACTED***"
78+
block_on_detection: true
79+
min_findings_to_block: 1
11680
```
11781
118-
## Result shape
82+
| Field | Type | Default | Description |
83+
|---|---|---|---|
84+
| `enabled` | dict | built-in defaults | Per-detector enable flags; unspecified detectors inherit defaults |
85+
| `redact` | bool | `false` | Replace matched secret values in returned payloads |
86+
| `redaction_text` | string | `"***REDACTED***"` | Replacement text used when `redact=true` |
87+
| `block_on_detection` | bool | `true` | Return a violation when enough findings are present |
88+
| `min_findings_to_block` | integer | `1` | Minimum finding count required before blocking |
89+
90+
## Behavior Notes
91+
92+
- Redaction preserves payload shape where possible instead of flattening everything to plain dicts.
93+
- `base64_24` uses capture-group redaction so leading non-base64 boundary characters are preserved.
94+
- Broad detectors remain opt-in to reduce noisy matches on ordinary identifiers.
95+
- Binary resource bodies are not scanned; `resource_post_fetch` only scans text content exposed as `payload.content.text`.
96+
- The plugin does not decode archives, compressed data, or arbitrary encoded blobs before scanning.
97+
98+
## Returned Metadata
11999

120-
On detection, the plugin may return:
100+
When detections occur, the plugin can emit:
121101

122-
- `modified_payload` with redacted values when `redact=true`
123102
- `metadata.count`
124103
- `metadata.secrets_redacted=true` when redaction happened
125104
- `metadata.secrets_findings=[{"type": "..."}]` when reporting findings without redaction
126-
- a `PluginViolation` with `code="SECRETS_DETECTED"` when blocking
127105

128-
## Build
106+
Blocking responses use the `SECRETS_DETECTED` violation code.
107+
108+
## Security Notes
109+
110+
- Outward-facing findings metadata and violation examples do not include original matched secret values.
111+
- Enable broad detectors only after testing against representative payloads.
112+
- The detector is best-effort pattern matching and should complement, not replace, upstream secret management controls.
113+
114+
## Testing
129115

130116
```bash
131-
uv sync --dev
132-
make install
133-
make test-all
117+
make ci
134118
```

0 commit comments

Comments
 (0)