[Experimental] Prototype Rust CPEX secrets detection integration - #74
Conversation
Signed-off-by: Pratik Gandhi <gandhipratik203@gmail.com>
Signed-off-by: Pratik Gandhi <gandhipratik203@gmail.com>
|
I would name the crate |
|
@gandhipratik203, we need a follow-up PR to remove the two existing test plugins. They are now obsolete and have been completely superseded by this plugin. |
Signed-off-by: Pratik Gandhi <gandhipratik203@gmail.com>
Signed-off-by: Pratik Gandhi <gandhipratik203@gmail.com>
lucarlig
left a comment
There was a problem hiding this comment.
Please complete the dataplane integration by shipping the feature, covering it in CI, and documenting its activation.
Signed-off-by: Pratik Gandhi <gandhipratik203@gmail.com>
|
a bit late here, but yeah, keeping plugins in a different folder under crates sounds like a valid approach. |
|
This smells wrong: binary_e2e_redacts_tool_arguments_and_results
In the long run as part of the CI this is going to be very slow and error prone. The code is good but it really should be used as part of the integration tests. For contextforge-dataplane it is more advisable to use tokio and not rely on Command, Command will fork the process which is very expensive. |
Signed-off-by: Pratik Gandhi <gandhipratik203@gmail.com>
Signed-off-by: Pratik Gandhi <gandhipratik203@gmail.com>
|
Agreed, binary_e2e_redacts_tool_arguments_and_results is not the right long-term CI shape for the dataplane. I removed it from CI. The plugin behavior is covered through the existing in-process gateway integration tests, which avoid shelling out to Redis or forking the gateway binary. |
Summary
Adds the Rust-native secrets detection CPEX plugin as a first-class dataplane workspace crate and wires it behind the existing
pluginsfeature.This supersedes the earlier local-path spike by keeping the plugin source inside the dataplane repo, so CI and reviewers do not need a sibling
cpex-pluginscheckout.What Changed
cpex-secrets-detectionas a workspace crate.pluginsis enabled.contextforge-gateway-rs/plugins.PluginManagercoverage for redaction, blocking, clean no-op, field filters, and supported CMF hook stages.plugins, start with--runtime-plugins-enabled true, and provide Redis config.Explanatory Diagrams
Request/response flow:
Integration summary:
Component Layout
Project Layout And Test Boundaries
Validation
CI runs:
Local validation run here:
cargo +1.96 test --locked --workspace --all-features cargo +1.96 build --locked --workspace --all-featurescargo-nextestwas not installed locally, socargo testwas used as the local fallback. The binary E2E remains ignored/manual.Manual Reviewer Verification
The script below drives the real gateway over MCP and uses synthetic secret-shaped values generated at runtime. The expected output is sanitized here and does not include the generated values.
Detailed Manual Steps
Terminal 1: start Redis and one backend MCP server.
cd /Users/pratik/Desktop/work/new_mcf/contextforge-data-plane docker compose -f docker/docker-compose-local.yaml up -d redis gateway-one docker compose -f docker/docker-compose-local.yaml ps redis gateway-oneTerminal 3: create the local reviewer script from the collapsible below, then start it.
cd /Users/pratik/Desktop/work/new_mcf/contextforge-data-plane chmod +x ./secrets_detection_demo.sh ./secrets_detection_demo.shThe script writes the Redis runtime plugin config and then pauses.
Terminal 2: when the script asks, start or restart the real gateway binary.
Return to Terminal 3 and press Enter. The script should run four checks:
cmf.tool_pre_invokeredaction.cmf.tool_pre_invokeblocking.cmf.tool_post_invokeredaction.Reviewer Script Contents
Create this as
secrets_detection_demo.shat the repo root. It is a local reviewer helper and is not committed in this PR.Expected Manual Result
Expected high-level result:
Sanitized representative responses:
{"jsonrpc":"2.0","id":2,"result":{"content":[{"type":"text","text":"{\"message\":\"hello\",\"token\":\"[redacted]\"}"}],"isError":false}} {"jsonrpc":"2.0","id":3,"error":{"code":-32600,"message":"Plugin denied tool call"}} {"jsonrpc":"2.0","id":4,"result":{"content":[{"type":"text","text":"{\"credential\":\"[redacted]\",\"message\":\"post hook only\"}"}],"isError":false}}Notes
This PR keeps the crate unpublished and feature-gated. Redis runtime config can activate the plugin only after the gateway binary is built with
plugins.The secrets detection binary E2E is intentionally ignored and not run by CI.