@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.
46 lines • 1.45 kB
TypeScript
/**
* Secure YAML Parser for DollhouseMCP
*
* Provides safe YAML parsing that prevents deserialization attacks
* by using a restricted schema and pre-validation.
*
* Security: SEC-003 - YAML parsing vulnerability protection
*/
import matter from 'gray-matter';
export interface SecureParseOptions {
maxYamlSize?: number;
maxContentSize?: number;
allowedKeys?: string[];
validateContent?: boolean;
}
export interface ParsedContent {
data: Record<string, any>;
content: string;
excerpt?: string;
}
export declare class SecureYamlParser {
private static readonly DEFAULT_OPTIONS;
private static readonly SAFE_SCHEMA;
private static readonly FIELD_VALIDATORS;
/**
* Securely parse content with YAML frontmatter
*/
static parse(input: string, options?: SecureParseOptions): ParsedContent;
/**
* Create a secure gray-matter compatible parser
*/
static createSecureMatterParser(): {
parse: (input: string) => {
data: Record<string, any>;
content: string;
excerpt: string | undefined;
orig: string;
};
stringify: (content: string, data: any) => string;
};
/**
* Safe wrapper for gray-matter with security validations
*/
static safeMatter(input: string, options?: matter.GrayMatterOption<string, any>): matter.GrayMatterFile<string>;
}
//# sourceMappingURL=secureYamlParser.d.ts.map