UNPKG

sicua

Version:

A tool for analyzing project structure and dependencies

49 lines (48 loc) 1.59 kB
/** * Pattern matching utilities for security vulnerability detection */ import { DetectionPattern, PatternMatch, PatternMatchResult, PatternDefinition } from "../types/pattern.types"; export declare class PatternMatcher { private static readonly DEFAULT_CONTEXT_LINES; private static readonly MAX_MATCHES_PER_PATTERN; /** * Find all matches for a given pattern in content */ static findMatches(pattern: DetectionPattern, content: string): PatternMatch[]; /** * Find regex pattern matches */ private static findRegexMatches; /** * Find string pattern matches */ private static findStringMatches; /** * Find context-based pattern matches */ private static findContextMatches; /** * Check if a string match represents a whole word */ private static isWholeWordMatch; /** * Get line and column from character index */ private static getLocationFromIndex; /** * Extract surrounding context for a match */ private static extractContext; /** * Apply a pattern definition to content and return results */ static applyPattern(patternDef: PatternDefinition, content: string, filePath: string): PatternMatchResult; /** * Calculate entropy of a string (useful for secret detection) */ static calculateEntropy(str: string): number; /** * Check if a string looks like a potential secret based on entropy and patterns */ static isPotentialSecret(str: string, minEntropy?: number, minLength?: number): boolean; }