tradingview-screener-ts
Version:
TypeScript port of TradingView Screener with 100% Python parity - Based on the original Python library by shner-elmo (https://github.com/shner-elmo/TradingView-Screener)
116 lines • 2.96 kB
TypeScript
/**
* Advanced security utilities and validation
*
* This module provides enterprise-grade security features including
* input validation, sanitization, and secure request handling.
*/
/**
* Input validation utilities
*/
export declare class InputValidator {
/**
* Validate market codes against whitelist
*/
static validateMarkets(markets: string[]): string[];
/**
* Validate column names against injection attacks
*/
static validateColumns(columns: string[]): string[];
/**
* Validate numeric values
*/
static validateNumber(value: any, min?: number, max?: number): number;
/**
* Validate and sanitize filter operations
*/
static validateFilterOperation(operation: string): string;
/**
* Validate URL for security
*/
static validateUrl(url: string): string;
}
/**
* Request sanitizer for secure HTTP requests
*/
export declare class RequestSanitizer {
/**
* Sanitize request headers
*/
static sanitizeHeaders(headers: Record<string, string>): Record<string, string>;
/**
* Sanitize cookies
*/
static sanitizeCookies(cookies: string): string;
/**
* Generate secure request configuration
*/
static createSecureConfig(config?: any): any;
}
/**
* Error sanitizer to prevent information leakage
*/
export declare class ErrorSanitizer {
/**
* Sanitize error messages for public consumption
*/
static sanitizeError(error: any): Error;
/**
* Create safe error response
*/
static createSafeErrorResponse(error: any): {
success: false;
error: string;
code?: string;
timestamp: string;
};
/**
* Get safe error code
*/
private static getErrorCode;
}
/**
* Security audit utilities
*/
export declare class SecurityAuditor {
/**
* Audit query for potential security issues
*/
static auditQuery(query: any): {
isSecure: boolean;
warnings: string[];
recommendations: string[];
};
/**
* Generate security report
*/
static generateSecurityReport(): {
version: string;
securityFeatures: string[];
compliance: string[];
lastAudit: string;
};
}
/**
* Crypto utilities for secure operations
*/
export declare class CryptoUtils {
/**
* Generate secure random string
*/
static generateSecureId(length?: number): string;
/**
* Hash string for comparison (simple implementation)
*/
static simpleHash(str: string): string;
}
/**
* Export all security utilities
*/
export declare const Security: {
readonly InputValidator: typeof InputValidator;
readonly RequestSanitizer: typeof RequestSanitizer;
readonly ErrorSanitizer: typeof ErrorSanitizer;
readonly SecurityAuditor: typeof SecurityAuditor;
readonly CryptoUtils: typeof CryptoUtils;
};
//# sourceMappingURL=security.d.ts.map