@felixgeelhaar/cclint
Version:
A comprehensive linter for CLAUDE.md files with multi-language code block validation
83 lines • 2.58 kB
TypeScript
import type { Plugin } from '../../domain/CustomRule.js';
import { ContextFile } from '../../domain/ContextFile.js';
import type { Violation } from '../../domain/Violation.js';
/**
* Security configuration for plugin execution
*/
export interface PluginSecurityConfig {
/** Maximum execution time in milliseconds */
timeout: number;
/** Maximum memory usage in MB */
maxMemory: number;
/** Allow network access */
allowNetwork: boolean;
/** Allow file system access */
allowFileSystem: boolean;
/** Allowed module imports */
allowedModules: string[];
}
/**
* Result from sandboxed plugin execution
*/
export interface SandboxResult {
success: boolean;
violations?: Violation[];
error?: string;
executionTime: number;
memoryUsed: number;
}
/**
* Provides secure, sandboxed execution environment for plugins
*/
export declare class PluginSandbox {
private readonly defaultConfig;
private config;
constructor(config?: Partial<PluginSecurityConfig>);
/**
* Execute a plugin in a sandboxed environment
* @param plugin The plugin to execute
* @param file The file to lint
* @returns Sandbox execution result
*/
executePlugin(plugin: Plugin, file: ContextFile): Promise<SandboxResult>;
/**
* Run plugin rules with basic isolation
* @param plugin The plugin to run
* @param file The file to lint
* @returns Array of violations
*/
private runPluginRules;
/**
* Execute a function with a timeout
* @param fn The function to execute
* @param timeout Timeout in milliseconds
* @returns The function result
*/
private executeWithTimeout;
/**
* Create a safe, immutable copy of a ContextFile
* @param file The original file
* @returns A safe copy
*/
private createSafeFileCopy;
/**
* Validate that a violation object is properly formed
* @param violation The violation to validate
* @returns True if valid
*/
private isValidViolation;
/**
* Validate plugin signature (for future implementation)
* @param plugin The plugin to validate
* @param signature The plugin signature
* @returns True if signature is valid
*/
validatePluginSignature(plugin: Plugin, signature?: string): boolean;
/**
* Check if a module is allowed to be imported
* @param moduleName The module name to check
* @returns True if allowed
*/
isModuleAllowed(moduleName: string): boolean;
}
//# sourceMappingURL=PluginSandbox.d.ts.map