Documentation
¶
Overview ¶
Package detector implements pattern detection logic for identifying dangerous regex patterns.
Package detector implements NFA-based analysis for detecting EDA and IDA.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Detector ¶
type Detector struct {
// contains filtered or unexported fields
}
Detector performs pattern detection based on configured options.
func NewDetector ¶
NewDetector creates a new detector with the given options.
type Issue ¶
type Issue struct {
Type string
Severity string
Position Position
Pattern string
Message string
Example string
Suggestion string
Complexity int
}
Issue represents a detected problem.
type NFAAnalyzer ¶
type NFAAnalyzer struct {
// contains filtered or unexported fields
}
NFAAnalyzer performs NFA-based analysis for EDA/IDA detection.
func (*NFAAnalyzer) AnalyzePattern ¶
AnalyzePattern analyzes a regex pattern using NFA-based methods.
func (*NFAAnalyzer) ComputeAmbiguityDegree ¶
func (a *NFAAnalyzer) ComputeAmbiguityDegree(re *syntax.Regexp) (int, bool)
ComputeAmbiguityDegree estimates the degree of ambiguity for a pattern. Returns (degree, isExponential).
type Options ¶
type Options struct {
Mode ValidationMode
Checks uint32
}
Options contains configuration for detection.
type ValidationMode ¶
type ValidationMode int
ValidationMode represents the depth of analysis.
const ( Fast ValidationMode = iota Balanced Thorough )