feat(security): OWASP AI Agent Security 2026 gap analysis (#1650)#1796
Merged
feat(security): OWASP AI Agent Security 2026 gap analysis (#1650)#1796
Conversation
Three security controls from the OWASP AI Agent Security Cheat Sheet: - PiiFilter: regex scrubber (email, phone, SSN, credit card) applied to tool outputs before LLM context and debug dumps. Custom patterns compiled with size/DFA limits to prevent ReDoS. Opt-in via [security.pii_filter] config. - MemoryWriteValidator: validates content size, forbidden patterns, and entity name PII before memory_save writes and graph extraction. Uses a PostExtractValidator callback in the async spawn closure to keep zeph-memory free of security policy. Enabled by default. - ToolRateLimiter: sliding-window per-category rate limiter (Shell, Web, Memory, Mcp, Other) with circuit breaker. check_batch() atomically reserves slots for parallel tool dispatch to prevent batch bypass. Opt-in via [security.rate_limit] config. Integration: native.rs wires all three into the tool execution pipeline. --init wizard adds step_security() for pii_filter and rate_limiter. --migrate-config auto-adds new sections from embedded default.toml. memory_validation_failures metric incremented on rejection. 31 new unit tests across all three modules (5650 -> 5681 total).
- Keep PostExtractValidator using ExtractorResult alias for graph::extractor::ExtractionResult (pre-upsert type for validation) - Update extract_and_store return type to semantic::graph::ExtractionResult (main's change adding entity_ids for A-MEM note linking) - Fix validation-failure early return to ExtractionResult::default() - Merge CHANGELOG entries from both branches
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
Closes #1650. Implements three security controls from the OWASP AI Agent Security Cheat Sheet (2026 edition):
size_limit/dfa_size_limitto prevent ReDoS. Opt-in via[security.pii_filter].memory_savewrites and graph extraction. Uses aPostExtractValidatorcallback inside the async spawn closure sozeph-memoryremains free of security policy coupling. Enabled by default.check_batch()atomically reserves slots for parallel dispatch to prevent batch-bypass. Opt-in via[security.rate_limit].Changes
crates/zeph-core/src/sanitizer/pii.rs— new PiiFiltercrates/zeph-core/src/sanitizer/memory_validation.rs— new MemoryWriteValidatorcrates/zeph-core/src/agent/rate_limiter.rs— new ToolRateLimiternative.rs— wires all three into tool execution pipeline; incrementsmemory_validation_failuresmetricinit.rs—step_security()wizard step for pii_filter and rate_limiterconfig/default.toml—[security.pii_filter],[security.memory_validation],[security.rate_limit]sectionsmetrics.rs—memory_validation_failurescounterKnown Limitations (documented)
Test Plan
cargo +nightly fmt --check— cleancargo clippy --workspace --features full -- -D warnings— cleancargo nextest run --config-file .github/nextest.toml --workspace --features full --lib --bins— 5681/5681 passed (31 new tests)