UNPKG

@dollhousemcp/mcp-server

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.

89 lines 2.97 kB
/** * SkillManager - Implementation of IElementManager for Skill elements * Handles CRUD operations and lifecycle management for skills implementing IElement * * SECURITY FIXES IMPLEMENTED (Following PR #319 patterns): * 1. CRITICAL: Fixed race conditions in file operations by using FileLockManager for atomic reads/writes * 2. CRITICAL: Fixed dynamic require() statements by using static imports * 3. HIGH: Fixed unvalidated YAML parsing vulnerability by using SecureYamlParser * 4. MEDIUM: All user inputs are now validated and sanitized * 5. MEDIUM: Audit logging added for security operations * 6. MEDIUM: Path traversal prevention for all file operations */ import { IElementManager } from '../../types/elements/IElementManager.js'; import { ElementValidationResult } from '../../types/elements/IElement.js'; import { Skill, SkillMetadata } from './Skill.js'; import { ElementType } from '../../portfolio/types.js'; export declare class SkillManager implements IElementManager<Skill> { private portfolioManager; private skillsDir; private skills; constructor(); /** * Load a skill from file * SECURITY FIX #1: Uses FileLockManager.atomicReadFile() instead of fs.readFile() * to prevent race conditions and ensure atomic file operations */ load(filePath: string): Promise<Skill>; /** * Save a skill to file * SECURITY FIX #1: Uses FileLockManager.atomicWriteFile() for atomic operations */ save(element: Skill, filePath: string): Promise<void>; /** * List all available skills */ list(): Promise<Skill[]>; /** * Find a skill by predicate */ find(predicate: (element: Skill) => boolean): Promise<Skill | undefined>; /** * Validate a skill */ validate(element: Skill): ElementValidationResult; /** * Create a new skill */ create(data: Partial<SkillMetadata> & { content?: string; }): Promise<Skill>; /** * Delete a skill */ delete(filePath: string): Promise<void>; /** * Import a skill from YAML/JSON * SECURITY FIX #3: Uses SecureYamlParser to prevent YAML injection */ importElement(data: string, format: 'yaml' | 'json'): Promise<Skill>; /** * Export a skill to YAML/JSON */ exportElement(element: Skill, format: 'yaml' | 'json'): Promise<string>; /** * Clear all cached skills */ clearCache(): void; /** * Check if a skill exists */ exists(filePath: string): Promise<boolean>; /** * Find multiple skills by predicate */ findMany(predicate: (element: Skill) => boolean): Promise<Skill[]>; /** * Validate a file path */ validatePath(filePath: string): boolean; /** * Get the element type */ getElementType(): ElementType; /** * Get the file extension for skills */ getFileExtension(): string; } //# sourceMappingURL=SkillManager.d.ts.map