feat(security): source-specific sanitization boundaries (Phase 2, #1195)#1234
Merged
feat(security): source-specific sanitization boundaries (Phase 2, #1195)#1234
Conversation
Refine ContentSanitizer integration to differentiate trust levels at each untrusted data boundary: - Tool results: MCP tools (`:` in name) -> McpResponse (ExternalUntrusted), web-scrape/fetch -> WebScrape (ExternalUntrusted), others -> ToolResult (LocalUntrusted) - A2A inbound: sanitize external agent messages in AgentTaskProcessor before agent loop; add Message::all_text_content() for multi-part message support - Code RAG: sanitize indexed code text before context injection with metrics tracking and injection flag logging - Error paths: sanitize tool error messages before self_reflection context as ExternalUntrusted Closes #1200, closes #1201, closes #1202, closes #1203
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
Phase 2 of Untrusted Content Isolation epic (#1195). Refines
ContentSanitizerintegration to differentiate trust levels at each untrusted data boundary.contains(':')) useMcpResponse(ExternalUntrusted), web-scrape/fetch useWebScrape(ExternalUntrusted), others remainToolResult(LocalUntrusted)AgentTaskProcessorwithA2aMessage(ExternalUntrusted) before entering agent loop; addMessage::all_text_content()for multi-part message supportself_reflectioncontext as ExternalUntrusted (conservative default)Files changed (6 files, +299/-5):
crates/zeph-a2a/src/types.rs—all_text_content()+ 4 testscrates/zeph-core/src/agent/context.rs— code RAG sanitization with metricscrates/zeph-core/src/agent/tool_execution.rs— source kind differentiation + error sanitization + 7 testscrates/zeph-core/src/sanitizer.rs—#[derive(Clone)]src/daemon.rs— A2A inbound sanitization inAgentTaskProcessorsrc/tests.rs— fixsanitizerfield in daemon test structTests: 3795 passed (+13 from Phase 1 baseline of 3782)
Closes #1200, closes #1201, closes #1202, closes #1203
Test plan
cargo +nightly fmt --checkcargo clippy --workspace -- -D warningscargo nextest run --workspace --lib --bins(3795 pass)cargo check --features "daemon,a2a"