/** * Safe Response Detector * Detects safe (non-vulnerable) response patterns * * Extracted from SecurityResponseAnalyzer.ts (Issue #53) * Handles: MCP validation, HTTP errors, reflection detection, validation rejection */ import { CompatibilityCallToolResult } from "@modelcontextprotocol/sdk/types.js"; /** * Error info extracted from response */ export interface ErrorInfo { code?: string | number; message?: string; } /** * Result of safe response check */ export interface SafeResponseResult { isSafe: boolean; reason?: string; } /** * Detects safe response patterns indicating proper tool behavior */ export declare class SafeResponseDetector { private executionDetector; constructor(); /** * Check if response is an MCP validation error (safe rejection) */ isMCPValidationError(errorInfo: ErrorInfo, responseText: string): boolean; /** * Check if response is an HTTP error (Issue #26) */ isHttpErrorResponse(responseText: string): boolean; /** * Check if response is an AppleScript syntax error (Issue #175) * These errors should not be flagged as XXE vulnerabilities even when * the XXE payload is echoed back in the error message. */ isAppleScriptSyntaxError(responseText: string): boolean; /** * Check if response shows AppleScript injection SUCCESS (Issue #177) * This indicates the injection payload reached execution context. * Takes precedence over syntax error detection for injection payloads. * * @param responseText Response text to analyze * @param payload Optional - the injection payload that was sent (for context) * @returns true if injection appears to have succeeded (vulnerability EXISTS) */ isAppleScriptInjectionSuccess(responseText: string, payload?: string): boolean; /** * Check if response is just reflection (safe) * Two-layer defense: Match reflection patterns, verify NO execution evidence * * Issue #110, Challenge #8: Also checks for LLM injection markers and * output injection vulnerability metadata before declaring response safe. */ isReflectionResponse(responseText: string): boolean; /** * Check if response is returning search results */ isSearchResultResponse(responseText: string): boolean; /** * Check if response is from a creation/modification operation */ isCreationResponse(responseText: string): boolean; /** * Check if tool explicitly rejected input with validation error (SAFE) */ isValidationRejection(response: CompatibilityCallToolResult): boolean; /** * Extract response content from MCP response */ extractResponseContent(response: CompatibilityCallToolResult): string; } //# sourceMappingURL=SafeResponseDetector.d.ts.map