[Experimental]: Test integration of secrets detection plugin with rust bindings provided by cpex with the rust data plane - #70
Merged
Conversation
Signed-off-by: Pratik Gandhi <gandhipratik203@gmail.com>
Signed-off-by: Pratik Gandhi <gandhipratik203@gmail.com>
Signed-off-by: Pratik Gandhi <gandhipratik203@gmail.com>
Signed-off-by: Pratik Gandhi <gandhipratik203@gmail.com>
Signed-off-by: Pratik Gandhi <gandhipratik203@gmail.com>
Signed-off-by: Pratik Gandhi <gandhipratik203@gmail.com>
gandhipratik203
force-pushed
the
spike/secrets-detection-cpex-runtime
branch
from
July 31, 2026 12:30
5ac6f92 to
a3a33c8
Compare
gandhipratik203
marked this pull request as ready for review
July 31, 2026 12:35
Signed-off-by: Pratik Gandhi <gandhipratik203@gmail.com>
15 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This is an experimental spike to wire the Rust-native secrets detection plugin from IBM/cpex-plugins#148 into the data-plane runtime CPEX path.
It adds a feature-gated
secrets-detection-plugindependency, registersSecretsDetectionFactorydirectly withCpexRuntimeRegistry, and validates Redis-driven runtime activation. The spike only targets the currently supported data-plane hooks:cmf.tool_pre_invokeandcmf.tool_post_invoke.Validation
cargo +1.96 check -p contextforge-gateway-rs --features secrets-detection-plugincargo +1.96 test -p contextforge-gateway-rs-cpexcargo +1.96 test -p contextforge-gateway-rs-lib --test gateway_plugins -- --nocapturecargo +1.96 test -p contextforge-gateway-rs --features secrets-detection-plugin --test secrets_detection_e2e -- --ignored --nocaptureManual gateway smoke test result
Verified manually with:
gateway-onecmf.tool_pre_invoke,cmf.tool_post_invokeredact: trueblock_on_detection: falseManual flow:
gateway-one.ContextForgeGatewayRuntimePluginConfigin Redis.--features "secrets-detection-plugin contextforge-gateway-rs-lib/with_tools"and--runtime-plugins-enabled true.http://127.0.0.1:5555/mcp.tools/listexposesecho.echowith a synthetic secret-shaped test value in thecredentialargument.Observed sanitized response:
{ "jsonrpc": "2.0", "id": 3, "result": { "content": [ { "type": "text", "text": "{\"credential\":\"[redacted]\",\"message\":\"hello\"}" } ], "isError": false } }Manual assertions:
[redacted]Binary E2E test result
Ran:
cargo +1.96 test -p contextforge-gateway-rs \ --features secrets-detection-plugin \ --test secrets_detection_e2e \ -- --ignored --nocaptureResult:
This starts
redis-server, a test MCP backend, and the real gateway binary. It verifies both deny behavior before the backend receives the call and redact behavior through the client response.Manual commands used
Start Redis and the single sample backend:
Add the runtime plugin config before starting the gateway:
Start the gateway binary:
Then configure the user route to
http://127.0.0.1:5555/mcp, open an MCP session, calltools/list, and call theechotool with a synthetic secret-shaped value in thecredentialargument.Notes
redis-server, a test MCP backend, and the real gateway binary.6ff7af74587574fe6115ce87427519b63f6062da.