UNPKG

@ai-capabilities-suite/mcp-debugger-core

Version:

Core debugging engine for Node.js and TypeScript applications. Provides Inspector Protocol integration, breakpoint management, variable inspection, execution control, profiling, hang detection, and source map support.

128 lines (127 loc) 3.57 kB
/** * Masking rule definition */ export interface MaskingRule { name: string; pattern: RegExp; replacement: string; enabled: boolean; } /** * Data masking configuration */ export interface DataMaskingConfig { enabled: boolean; customRules?: MaskingRule[]; maskEmails?: boolean; maskPhones?: boolean; maskCreditCards?: boolean; maskSSNs?: boolean; maskApiKeys?: boolean; maskPasswords?: boolean; } /** * Manages sensitive data masking for variable inspection * Detects and masks common PII patterns */ export declare class DataMasker { private config; private rules; private static readonly EMAIL_PATTERN; private static readonly PHONE_PATTERN; private static readonly CREDIT_CARD_PATTERN; private static readonly SSN_PATTERN; private static readonly API_KEY_PATTERN; private static readonly PASSWORD_PATTERN; constructor(config?: DataMaskingConfig); /** * Initialize masking rules based on configuration * Rules are ordered by specificity to avoid conflicts */ private initializeRules; /** * Mask sensitive data in a string * @param value The string to mask * @returns The masked string */ maskString(value: string): string; /** * Mask sensitive data (works with both strings and objects) * @param data The data to mask (string or object) * @param maxDepth Maximum recursion depth for objects (default: 10) * @returns The masked data */ maskData(data: any, maxDepth?: number): any; /** * Mask sensitive data in an object * Recursively masks all string values in the object * @param obj The object to mask * @param maxDepth Maximum recursion depth (default: 10) * @returns The masked object */ maskObject(obj: any, maxDepth?: number): any; /** * Recursively mask an object * @param obj The object to mask * @param maxDepth Maximum recursion depth * @param currentDepth Current recursion depth * @returns The masked object */ private maskObjectRecursive; /** * Add a custom masking rule * @param rule The masking rule to add */ addRule(rule: MaskingRule): void; /** * Remove a masking rule by name * @param name The name of the rule to remove * @returns True if the rule was found and removed */ removeRule(name: string): boolean; /** * Enable a masking rule by name * @param name The name of the rule to enable * @returns True if the rule was found */ enableRule(name: string): boolean; /** * Disable a masking rule by name * @param name The name of the rule to disable * @returns True if the rule was found */ disableRule(name: string): boolean; /** * Get all masking rules * @returns Array of all masking rules */ getRules(): MaskingRule[]; /** * Get a masking rule by name * @param name The name of the rule * @returns The masking rule or undefined if not found */ getRule(name: string): MaskingRule | undefined; /** * Check if masking is enabled * @returns True if masking is enabled */ isEnabled(): boolean; /** * Enable masking */ enable(): void; /** * Disable masking */ disable(): void; /** * Clear all custom rules */ clearCustomRules(): void; /** * Get the current configuration * @returns The current configuration */ getConfig(): DataMaskingConfig; }