/** * Security Utilities for NotebookLM MCP Server * * Provides input validation, sanitization, and security hardening. * Added by Pantheon Security for hardened fork. */ /** * Validate and sanitize a NotebookLM URL * Prevents URL injection, javascript: URLs, and other attacks * * @param url - The URL to validate * @returns Validated URL or throws error */ export declare function validateNotebookUrl(url: string): string; /** * Validate a user-supplied source URL (content inputs, not notebook navigation). * Enforces HTTPS and blocks dangerous schemes without restricting domain. */ export declare function validateSourceUrl(url: string): string; /** * Validate notebook ID format * NotebookLM IDs are typically alphanumeric with dashes */ export declare function validateNotebookId(id: string): string; /** * Validate session ID format */ export declare function validateSessionId(id: string): string; /** * Validate question input * Prevents extremely long inputs that could cause DoS */ export declare function validateQuestion(question: string): string; /** * Sanitize a string for safe logging * Masks sensitive information like passwords, tokens, etc. */ export declare function sanitizeForLogging(value: string): string; /** * Mask an email for logging (more aggressive than general sanitization) */ export declare function maskEmail(email: string): string; /** * Validate file path to prevent path traversal */ export declare function validateFilePath(basePath: string, filePath: string): string; export declare class RateLimiter { private requests; private readonly maxRequests; private readonly windowMs; constructor(maxRequests?: number, windowMs?: number); /** * Check if a request should be allowed * @param key - Identifier for the rate limit (e.g., session ID, IP) * @returns true if allowed, false if rate limited */ isAllowed(key: string): boolean; /** * Get remaining requests for a key */ getRemaining(key: string): number; /** * Return number of distinct tracked keys */ size(): number; /** * Clear all rate limit data */ clear(): void; } /** * Custom security error class */ export declare class SecurityError extends Error { constructor(message: string); } /** * Environment variable validator * Ensures sensitive env vars are not logged */ export declare function getSecureEnvVar(name: string, defaultValue?: string): string; /** * Check if running in a secure context */ export declare function checkSecurityContext(): { secure: boolean; warnings: string[]; };