/** * Security module for filtering prompt injection attacks from solution content * before it gets injected into Claude's context. * * NOTE: This is a shared utility, NOT a standalone hook. * Used by: solution-injector.ts (via import) * Exported via: lib.ts (public API for programmatic use) * Not registered in hooks.json — intentional. */ type Severity = 'block' | 'warn'; type Category = 'injection' | 'exfiltration' | 'obfuscation'; interface SecurityPattern { id: string; pattern: RegExp; severity: Severity; category: Category; } export interface ScanFinding { patternId: string; severity: Severity; category: Category; matchedText: string; } export interface ScanResult { verdict: 'safe' | 'warn' | 'block'; findings: ScanFinding[]; sanitized: string; } /** Structured security patterns with severity and category metadata */ export declare const SECURITY_PATTERNS: SecurityPattern[]; /** * Legacy flat array for backwards-compatible exports. * Contains only the RegExp patterns from SECURITY_PATTERNS. */ export declare const PROMPT_INJECTION_PATTERNS: RegExp[]; /** Normalize text for injection detection: strip zero-width chars, NFKC normalize */ export declare function normalizeForInjectionCheck(text: string): string; /** * Escape ALL XML-like tags in text to prevent tag injection. */ export declare function escapeAllXmlTags(text: string): string; /** * Combined filter: checks for prompt injection and escapes XML tags. * - block 패턴 매칭 → verdict: 'block', sanitized: '' * - warn만 매칭 → verdict: 'warn', sanitized: XML 이스케이프된 텍스트 * - 매칭 없음 → verdict: 'safe', sanitized: XML 이스케이프된 텍스트 */ export declare function filterSolutionContent(text: string): ScanResult; /** * Check if text contains prompt injection patterns. * Normalizes Unicode before matching to prevent bypass via homoglyphs/zero-width chars. * * @returns true only when a 'block'-severity pattern matches (하위 호환 유지). */ export declare function containsPromptInjection(text: string): boolean; export {};