-
Notifications
You must be signed in to change notification settings - Fork 2
[SEC-1.2] ContentSanitizer with injection pattern detection #1197
Copy link
Copy link
Closed
Labels
corezeph-core cratezeph-core cratepriority/highHigh priorityHigh prioritysecuritySecurity-related issueSecurity-related issuesize/MMedium PR (51-200 lines)Medium PR (51-200 lines)
Description
Part of #1195 — Phase 1
Implement content sanitizer that detects injection patterns and wraps untrusted content with spotlighting delimiters.
Crates: zeph-core
Depends on: SEC-1.1
Tasks:
-
ContentSanitizerstruct with configurable max size, pattern list, markup stripping - Injection pattern detection (flag-based, not blocking):
ignore (all|any|previous|prior)?instructionsyou are now,new (instructions|directive|role|persona)developer mode,system promptreveal|show|display your (instructions|prompt|rules)- Base64-encoded variants
- Homoglyph/unicode substitution attempts
- Spotlighting wrapper:
<external-data source="..." trust="...">with explicit "treat as data" preamble - Size truncation, null byte stripping, control character removal
-
InjectionFlagstruct: pattern matched, confidence, location in content - Unit tests with OWASP injection payload corpus (20+ test cases)
Files: crates/zeph-core/src/sanitizer.rs, crates/zeph-core/src/sanitizer/patterns.rs (new)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
corezeph-core cratezeph-core cratepriority/highHigh priorityHigh prioritysecuritySecurity-related issueSecurity-related issuesize/MMedium PR (51-200 lines)Medium PR (51-200 lines)