feat(security): add data flow security with agent hook integration (Spec 027)#293
Open
feat(security): add data flow security with agent hook integration (Spec 027)#293
Conversation
…pec 027) Detect and prevent data exfiltration by tracking how data flows between internal tools (Read, databases) and external tools (WebFetch, Slack). Operates in two modes: proxy-only (universal, any agent) and full mode with agent hook integration for intercepting agent-internal tool calls. Key components: - Tool/server classifier with internal/external/hybrid/unknown categories - Content hasher using SHA256 per-field extraction for flow matching - Flow tracker with session-scoped origin recording and edge detection - Policy evaluator with configurable actions (allow/warn/ask/deny) - Session correlator linking agent hook sessions to MCP proxy sessions - Hook CLI commands (install/uninstall/status/evaluate) for Claude Code - POST /api/v1/hooks/evaluate REST endpoint - Activity logging for hook_evaluation and flow_summary event types - Web UI nudge system for hook installation when in proxy-only mode - E2E tests for both proxy-only and hook-enhanced flow detection Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Deploying mcpproxy-docs with
|
| Latest commit: |
ec787a4
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://8f408303.mcpproxy-docs.pages.dev |
| Branch Preview URL: | https://027-data-flow-security.mcpproxy-docs.pages.dev |
…ints Add proper swag annotations to hooks.go and activity.go query params, then regenerate oas/swagger.yaml via make swagger instead of manual edits. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
📦 Build ArtifactsWorkflow Run: View Run Available Artifacts
How to DownloadOption 1: GitHub Web UI (easiest)
Option 2: GitHub CLI gh run download 21685803329 --repo smart-mcp-proxy/mcpproxy-go
|
- Remove unused extractNormalizedArgHashes/extractNormalizedStrings funcs - Use tagged switch instead of if/else chain on decision string - Skip ProxyOnlyDetection test under race detector (pre-existing supervisor race in AddServer/SetConfig path) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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
mcpproxy hook install/uninstall/status/evaluate) for Claude Code integrationKey Components
internal/security/flow/classifier.go): Categorizes tools/servers as internal, external, hybrid, or unknown using name heuristics and config overridesinternal/security/flow/hasher.go): SHA256 per-field extraction from JSON for content flow matching without storing raw datainternal/security/flow/tracker.go): Session-scoped origin recording and flow edge detection with configurable policiesinternal/security/flow/policy.go): Configurable actions (allow/warn/ask/deny) with graceful degradation in proxy-only mode (ask→warn)internal/security/flow/correlator.go): Links agent hook sessions to MCP proxy sessions via argument hash matchingcmd/mcpproxy/hook_cmd.go): Install/uninstall/status/evaluate commands for Claude Code agent hooksinternal/httpapi/hooks.go):POST /api/v1/hooks/evaluateendpoint for hook event processinghook_evaluationandflow_summaryactivity types with full metadatamcpproxy doctoroutputArchitecture
Test plan
internal/security/flow/...(25 tests),internal/httpapi/...,internal/runtime/...go test -race ./internal/security/flow/...passes cleanlyTestE2E_FlowSecurity_ProxyOnlyDetection)TestE2E_FlowSecurity_HookEnhancedDetection) — verifies deny decision withflow_type=internal_to_external,risk_level=hightest-api-e2e.sh— no regressions (61/71 pass, 10 failures pre-existing)verify-oas-coverage.sh— new endpoint documentedvue-tsc --noEmitpasses cleanly🤖 Generated with Claude Code