its-compiler-js
Version:
JavaScript/TypeScript implementation of the Instruction Template Specification (ITS) compiler
61 lines (60 loc) • 1.5 kB
TypeScript
/**
* Security validation and protection for ITS Compiler
*/
import { SecurityConfig } from './types.js';
export declare class SecurityValidator {
private config;
constructor(config: SecurityConfig);
/**
* Validate template content for security issues
*/
validateTemplate(template: any): void;
/**
* Validate content elements recursively
*/
private validateContent;
/**
* Validate text content for malicious patterns
*/
private validateTextContent;
/**
* Validate conditional expressions
*/
private validateConditionalExpression;
/**
* Validate placeholder configuration
*/
private validatePlaceholderConfig;
/**
* Validate variables object
*/
private validateVariables;
/**
* Check if variable name is dangerous
*/
private isDangerousVariableName;
/**
* Validate schema URL for SSRF protection
*/
validateSchemaUrl(url: string): void;
/**
* Validate hostname for SSRF protection
*/
private validateHostname;
/**
* Check if hostname is in private network range
*/
private isPrivateNetwork;
/**
* Check if domain is allowed
*/
private isDomainAllowed;
}
/**
* Default security configuration
*/
export declare const DEFAULT_SECURITY_CONFIG: SecurityConfig;
/**
* Development security configuration (more permissive)
*/
export declare const DEVELOPMENT_SECURITY_CONFIG: SecurityConfig;