nullvoid
Version:
Detect malicious code
163 lines • 5.75 kB
TypeScript
/**
* Configuration Constants for NullVoid
* Centralizes all configuration values and magic numbers
*/
import { ScanConfig, SecurityConfig, PerformanceConfig } from '../types';
/**
* Cache configuration
*/
export declare const CACHE_CONFIG: {
readonly TTL: number;
readonly MAX_SIZE: 1000;
readonly CLEANUP_INTERVAL: number;
};
/**
* Network configuration
*/
export declare const NETWORK_CONFIG: {
readonly TIMEOUT: 5000;
readonly MAX_RETRIES: 3;
readonly RETRY_DELAY: 1000;
readonly RATE_LIMIT: {
readonly MAX_REQUESTS: 100;
readonly WINDOW_SIZE: number;
};
};
/**
* Parallel processing configuration
*/
export declare const PARALLEL_CONFIG: {
readonly MAX_WORKERS: 8;
readonly CHUNK_SIZE: 10;
readonly TIMEOUT: 30000;
readonly RETRY_ATTEMPTS: 2;
readonly MIN_CHUNK_SIZE: 5;
readonly MAX_CHUNK_SIZE: 20;
};
/**
* File processing configuration
*/
export declare const FILE_CONFIG: {
readonly MAX_FILE_SIZE: number;
readonly MAX_FILES_PER_PACKAGE: 1000;
readonly SCAN_TIMEOUT: 30000;
};
/**
* Entropy thresholds for different content types
*/
export declare const ENTROPY_THRESHOLDS: {
readonly JAVASCRIPT: 4.5;
readonly JSON: 3;
readonly TEXT: 2.5;
readonly BINARY: 6;
readonly DEFAULT: 4;
};
/**
* Security patterns and configurations
*/
export declare const SECURITY_PATTERNS: {
readonly SUSPICIOUS_PATTERNS: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp];
readonly DANGEROUS_FUNCTIONS: readonly ["eval", "Function", "setTimeout", "setInterval", "setImmediate", "process.nextTick", "require", "import", "exec", "spawn", "execFile"];
readonly NETWORK_PATTERNS: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp];
readonly FILE_SYSTEM_PATTERNS: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp];
};
/**
* Validation configuration
*/
export declare const VALIDATION_CONFIG: {
readonly PACKAGE_NAME_PATTERN: RegExp;
readonly PACKAGE_NAME_MAX_LENGTH: 214;
readonly PACKAGE_NAME_MIN_LENGTH: 1;
readonly VALID_FORMATS: readonly ["json", "table", "yaml", "sarif"];
readonly SEMVER_PATTERN: RegExp;
readonly ALLOWED_EXTENSIONS: readonly [".js", ".mjs", ".ts", ".jsx", ".tsx", ".json"];
readonly SUSPICIOUS_PATTERNS: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp];
readonly VALID_PACKAGE_NAME: RegExp;
readonly VALID_LOCAL_PATH: RegExp;
readonly TRAVERSAL_PATTERNS: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp];
readonly DANGEROUS_PATTERNS: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp];
readonly MALICIOUS_PATTERNS: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp];
readonly DANGEROUS_FILES: readonly ["malware.js", "virus.js", "trojan.js", "backdoor.js", "keylogger.js", "spyware.js", "rootkit.js", "botnet.js"];
readonly SUSPICIOUS_SCRIPTS: readonly ["curl http", "wget http", "rm -rf", "chmod 777", "chown root", "sudo", "su -", "passwd", "useradd", "userdel"];
};
/**
* Test patterns configuration
*/
export declare const TEST_PATTERNS_CONFIG: {
readonly JEST_OUTPUT_PATTERNS: {
readonly PASSED: RegExp;
readonly FAILED: RegExp;
readonly SKIPPED: RegExp;
readonly TOTAL: RegExp;
readonly SUMMARY: RegExp;
};
readonly BADGE_REGEX: RegExp;
};
/**
* Dependency confusion configuration
*/
export declare const DEPENDENCY_CONFUSION_CONFIG: {
readonly TIMELINE_THRESHOLDS: {
readonly SUSPICIOUS_AGE_DAYS: 7;
readonly RAPID_PUBLISHING_HOURS: 24;
readonly VERSION_GAP_DAYS: 30;
};
readonly SIMILARITY_THRESHOLDS: {
readonly HIGH_SIMILARITY: 0.8;
readonly MEDIUM_SIMILARITY: 0.6;
readonly LOW_SIMILARITY: 0.4;
};
readonly SCOPE_PATTERNS: readonly [RegExp, RegExp, RegExp];
readonly SUSPICIOUS_NAME_PATTERNS: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp];
readonly REGISTRY_ENDPOINTS: {
readonly npm: "https://registry.npmjs.org";
readonly yarn: "https://registry.yarnpkg.com";
readonly github: "https://npm.pkg.github.com";
};
readonly ANALYSIS_SETTINGS: {
readonly MAX_GIT_COMMITS: 100;
readonly MAX_PACKAGE_VERSIONS: 50;
readonly TIMEOUT_MS: 10000;
readonly RETRY_ATTEMPTS: 3;
};
};
/**
* Popular frameworks and libraries
*/
export declare const POPULAR_FRAMEWORKS: readonly ["react", "vue", "angular", "express", "koa", "fastify", "next", "nuxt", "gatsby", "webpack", "rollup", "vite", "parcel", "babel", "typescript", "eslint", "prettier", "jest", "mocha", "cypress", "playwright", "puppeteer"];
/**
* Main configuration objects
*/
export declare const SCAN_CONFIG: ScanConfig;
export declare const SECURITY_CONFIG: SecurityConfig;
export declare const PERFORMANCE_CONFIG: PerformanceConfig;
/**
* Update configuration from environment variables
*/
export declare function updateConfigFromEnv(): void;
export declare const DETECTION_CONFIG: {
LEGITIMATE_PATTERNS: RegExp[];
MALWARE_PATTERNS: {
variableMangling: RegExp[];
obfuscation: RegExp[];
suspiciousFunctions: RegExp[];
dynamicRequires: RegExp[];
walletHijacking: RegExp[];
};
OBFUSCATION_PATTERNS: {
VARIABLE_MANGLING: RegExp;
MASSIVE_BLOB: RegExp;
HEX_ARRAYS: RegExp;
MODULE_APPEND: RegExp;
};
IOC_PATTERNS: {
URLS: RegExp;
IPS: RegExp;
DOMAINS: RegExp;
};
DYNAMIC_REQUIRE_PATTERNS: {
REQUIRE: RegExp;
IMPORT: RegExp;
};
};
//# sourceMappingURL=config.d.ts.map