-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathextension.neon
More file actions
107 lines (99 loc) · 3.99 KB
/
extension.neon
File metadata and controls
107 lines (99 loc) · 3.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
parametersSchema:
regexParser: structure([
# Whether to ignore regex parsing errors (e.g., missing delimiters)
ignoreParseErrors: bool(),
# Preferred: configure checks in one place
checks: structure([
redos: structure([
enabled: bool(),
# ReDoS reporting mode: 'off', 'theoretical', 'confirmed'
mode: string(),
# Minimum severity level to report: 'low', 'medium', 'high', 'critical'
threshold: string(),
noJit: bool()
]),
optimizations: structure([
enabled: bool(),
minSavings: int(),
options: structure([
digits: bool(),
word: bool(),
ranges: bool(),
canonicalizeCharClasses: bool(),
possessive: bool(),
factorize: bool(),
minQuantifierCount: int(),
verifyWithAutomata: bool()
])
])
]),
# Deprecated: use checks.* instead
# Enable/disable ReDoS risk detection
reportRedos: bool(),
# ReDoS reporting mode: 'off', 'theoretical', 'confirmed'
redosMode: string(),
# Minimum severity level to report: 'low', 'medium', 'high', 'critical'
redosThreshold: string(),
# Enable/disable regex optimization suggestions
suggestOptimizations: bool(),
# Configuration for specific optimizations
optimizationConfig: structure([
digits: bool(),
word: bool(),
ranges: bool(),
canonicalizeCharClasses: bool()
])
])
parameters:
regexParser:
# Ignore parsing errors like missing delimiters (common in dynamic regex)
ignoreParseErrors: true
# Deprecated: use checks.* instead
# Enable comprehensive ReDoS risk detection
reportRedos: true
# Report only critical ReDoS issues by default (conservative)
# Options: 'low' (most sensitive), 'medium', 'high', 'critical' (least sensitive)
redosThreshold: 'critical'
# ReDoS reporting mode (theoretical by default)
redosMode: 'theoretical'
# Enable regex optimization suggestions
suggestOptimizations: false
# Configuration for specific optimizations (both default to true for BC)
optimizationConfig:
digits: true
word: true
ranges: true
canonicalizeCharClasses: true
# Preferred configuration (kept in sync with legacy defaults)
checks:
redos:
enabled: %regexParser.reportRedos%
mode: %regexParser.redosMode%
threshold: %regexParser.redosThreshold%
noJit: false
optimizations:
enabled: %regexParser.suggestOptimizations%
minSavings: 1
options:
digits: %regexParser.optimizationConfig.digits%
word: %regexParser.optimizationConfig.word%
ranges: %regexParser.optimizationConfig.ranges%
canonicalizeCharClasses: %regexParser.optimizationConfig.canonicalizeCharClasses%
possessive: false
factorize: false
minQuantifierCount: 4
verifyWithAutomata: true
services:
# Main regex validation rule for PHPStan
-
class: RegexParser\Bridge\PHPStan\RegexParserRule
arguments:
ignoreParseErrors: %regexParser.ignoreParseErrors%
reportRedos: %regexParser.reportRedos%
redosThreshold: %regexParser.redosThreshold%
redosMode: %regexParser.redosMode%
suggestOptimizations: %regexParser.suggestOptimizations%
optimizationConfig: %regexParser.optimizationConfig%
config: %regexParser%
tags:
- phpstan.rules.rule