@mickdarling/dollhousemcp
Version:
DollhouseMCP - A Model Context Protocol (MCP) server that enables dynamic AI persona management from markdown files, allowing Claude and other compatible AI assistants to activate and switch between different behavioral personas.
47 lines • 1.68 kB
TypeScript
/**
* Content Validator for DollhouseMCP
*
* Protects against prompt injection attacks in marketplace personas
* by detecting and sanitizing malicious content patterns.
*
* Security: SEC-001 - Critical vulnerability protection
*/
export interface ValidationResult {
isValid: boolean;
sanitizedContent?: string;
detectedPatterns?: string[];
severity?: 'low' | 'medium' | 'high' | 'critical';
}
export declare class ContentValidator {
/**
* Pattern-based detection system for prompt injection attacks.
*
* This approach was chosen over AI-based detection because:
* 1. Pattern matching cannot be socially engineered or confused
* 2. Deterministic results ensure consistent security
* 3. No additional API calls or latency
* 4. Can't be bypassed by clever prompt engineering
*
* The patterns below represent known attack vectors from security research
* and real-world exploit attempts against AI systems.
*/
private static readonly INJECTION_PATTERNS;
private static readonly MALICIOUS_YAML_PATTERNS;
/**
* Validates and sanitizes persona content for security threats
*/
static validateAndSanitize(content: string): ValidationResult;
/**
* Validates YAML frontmatter for malicious content
*/
static validateYamlContent(yamlContent: string): boolean;
/**
* Validates persona metadata fields
*/
static validateMetadata(metadata: any): ValidationResult;
/**
* Sanitizes a complete persona file (frontmatter + content)
*/
static sanitizePersonaContent(content: string): string;
}
//# sourceMappingURL=contentValidator.d.ts.map