flutter-security-analyzer 1.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- flutter_security_analyzer/__init__.py +12 -0
- flutter_security_analyzer/__main__.py +8 -0
- flutter_security_analyzer/core/__init__.py +15 -0
- flutter_security_analyzer/core/config.py +128 -0
- flutter_security_analyzer/core/scanner.py +543 -0
- flutter_security_analyzer/main.py +150 -0
- flutter_security_analyzer/mappers/__init__.py +9 -0
- flutter_security_analyzer/mappers/masvs_mapper.py +308 -0
- flutter_security_analyzer/patterns/__init__.py +32 -0
- flutter_security_analyzer/patterns/auth_patterns.py +95 -0
- flutter_security_analyzer/patterns/base_pattern.py +514 -0
- flutter_security_analyzer/patterns/code_patterns.py +103 -0
- flutter_security_analyzer/patterns/crypto_patterns.py +78 -0
- flutter_security_analyzer/patterns/network_patterns.py +61 -0
- flutter_security_analyzer/patterns/pattern_registry.py +164 -0
- flutter_security_analyzer/patterns/platform_patterns.py +97 -0
- flutter_security_analyzer/patterns/privacy_patterns.py +64 -0
- flutter_security_analyzer/patterns/resilience_patterns.py +68 -0
- flutter_security_analyzer/patterns/storage_patterns.py +111 -0
- flutter_security_analyzer/reporters/__init__.py +11 -0
- flutter_security_analyzer/reporters/console_reporter.py +165 -0
- flutter_security_analyzer/reporters/html_reporter.py +230 -0
- flutter_security_analyzer/reporters/json_reporter.py +107 -0
- flutter_security_analyzer/utils/__init__.py +7 -0
- flutter_security_analyzer-1.0.1.dist-info/METADATA +239 -0
- flutter_security_analyzer-1.0.1.dist-info/RECORD +30 -0
- flutter_security_analyzer-1.0.1.dist-info/WHEEL +5 -0
- flutter_security_analyzer-1.0.1.dist-info/entry_points.txt +2 -0
- flutter_security_analyzer-1.0.1.dist-info/licenses/LICENSE +21 -0
- flutter_security_analyzer-1.0.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
"""
|
|
2
|
+
MASVS Mapper Module
|
|
3
|
+
|
|
4
|
+
Maps vulnerabilities to OWASP MASVS v2.1.0 compliance categories and controls.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from typing import Dict, List, Optional
|
|
8
|
+
from dataclasses import dataclass
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass
|
|
12
|
+
class MasvsControl:
|
|
13
|
+
"""Represents an OWASP MASVS control."""
|
|
14
|
+
control_id: str
|
|
15
|
+
title: str
|
|
16
|
+
description: str
|
|
17
|
+
level: int # L1 or L2
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@dataclass
|
|
21
|
+
class MasvsCategory:
|
|
22
|
+
"""Represents an OWASP MASVS category."""
|
|
23
|
+
category_id: str
|
|
24
|
+
name: str
|
|
25
|
+
description: str
|
|
26
|
+
controls: List[MasvsControl]
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class MasvsMapper:
|
|
30
|
+
"""
|
|
31
|
+
Maps findings to OWASP MASVS v2.1.0 compliance framework.
|
|
32
|
+
|
|
33
|
+
This class provides mapping between detected vulnerabilities and
|
|
34
|
+
the MASVS standard, enabling compliance reporting.
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
def __init__(self):
|
|
38
|
+
"""Initialize the mapper with MASVS v2.1.0 definitions."""
|
|
39
|
+
self.categories = self._load_masvs_definitions()
|
|
40
|
+
|
|
41
|
+
def _load_masvs_definitions(self) -> Dict[str, MasvsCategory]:
|
|
42
|
+
"""Load MASVS v2.1.0 category and control definitions."""
|
|
43
|
+
return {
|
|
44
|
+
'STORAGE': MasvsCategory(
|
|
45
|
+
category_id='MASVS-STORAGE',
|
|
46
|
+
name='Data Storage',
|
|
47
|
+
description='Secure storage of sensitive data on the device.',
|
|
48
|
+
controls=[
|
|
49
|
+
MasvsControl(
|
|
50
|
+
control_id='MASVS-STORAGE-1',
|
|
51
|
+
title='Secure Storage of Sensitive Data',
|
|
52
|
+
description='The app securely stores sensitive data.',
|
|
53
|
+
level=1
|
|
54
|
+
),
|
|
55
|
+
MasvsControl(
|
|
56
|
+
control_id='MASVS-STORAGE-2',
|
|
57
|
+
title='Prevention of Data Leakage',
|
|
58
|
+
description='The app prevents leakage of sensitive data.',
|
|
59
|
+
level=1
|
|
60
|
+
),
|
|
61
|
+
]
|
|
62
|
+
),
|
|
63
|
+
'CRYPTO': MasvsCategory(
|
|
64
|
+
category_id='MASVS-CRYPTO',
|
|
65
|
+
name='Cryptography',
|
|
66
|
+
description='Use of cryptography to protect sensitive data.',
|
|
67
|
+
controls=[
|
|
68
|
+
MasvsControl(
|
|
69
|
+
control_id='MASVS-CRYPTO-1',
|
|
70
|
+
title='Use of Strong Cryptography',
|
|
71
|
+
description='The app employs current strong cryptography and uses it according to industry best practices.',
|
|
72
|
+
level=1
|
|
73
|
+
),
|
|
74
|
+
MasvsControl(
|
|
75
|
+
control_id='MASVS-CRYPTO-2',
|
|
76
|
+
title='Secure Key Management',
|
|
77
|
+
description='The app performs key management according to industry best practices.',
|
|
78
|
+
level=1
|
|
79
|
+
),
|
|
80
|
+
]
|
|
81
|
+
),
|
|
82
|
+
'AUTH': MasvsCategory(
|
|
83
|
+
category_id='MASVS-AUTH',
|
|
84
|
+
name='Authentication and Authorization',
|
|
85
|
+
description='Authentication and session management mechanisms.',
|
|
86
|
+
controls=[
|
|
87
|
+
MasvsControl(
|
|
88
|
+
control_id='MASVS-AUTH-1',
|
|
89
|
+
title='Secure Authentication',
|
|
90
|
+
description='The app uses secure authentication and authorization protocols.',
|
|
91
|
+
level=1
|
|
92
|
+
),
|
|
93
|
+
MasvsControl(
|
|
94
|
+
control_id='MASVS-AUTH-2',
|
|
95
|
+
title='Local Authentication',
|
|
96
|
+
description='The app securely implements local authentication.',
|
|
97
|
+
level=1
|
|
98
|
+
),
|
|
99
|
+
MasvsControl(
|
|
100
|
+
control_id='MASVS-AUTH-3',
|
|
101
|
+
title='Session Management',
|
|
102
|
+
description='The app securely manages user sessions.',
|
|
103
|
+
level=1
|
|
104
|
+
),
|
|
105
|
+
]
|
|
106
|
+
),
|
|
107
|
+
'NETWORK': MasvsCategory(
|
|
108
|
+
category_id='MASVS-NETWORK',
|
|
109
|
+
name='Network Communication',
|
|
110
|
+
description='Secure network communication.',
|
|
111
|
+
controls=[
|
|
112
|
+
MasvsControl(
|
|
113
|
+
control_id='MASVS-NETWORK-1',
|
|
114
|
+
title='Secure Network Communication',
|
|
115
|
+
description='The app secures all network traffic according to current best practices.',
|
|
116
|
+
level=1
|
|
117
|
+
),
|
|
118
|
+
MasvsControl(
|
|
119
|
+
control_id='MASVS-NETWORK-2',
|
|
120
|
+
title='TLS Configuration',
|
|
121
|
+
description='The app performs identity pinning for all remote endpoints under the developers control.',
|
|
122
|
+
level=2
|
|
123
|
+
),
|
|
124
|
+
]
|
|
125
|
+
),
|
|
126
|
+
'PLATFORM': MasvsCategory(
|
|
127
|
+
category_id='MASVS-PLATFORM',
|
|
128
|
+
name='Platform Interaction',
|
|
129
|
+
description='Secure use of platform APIs and components.',
|
|
130
|
+
controls=[
|
|
131
|
+
MasvsControl(
|
|
132
|
+
control_id='MASVS-PLATFORM-1',
|
|
133
|
+
title='Secure IPC',
|
|
134
|
+
description='The app uses IPC mechanisms securely.',
|
|
135
|
+
level=1
|
|
136
|
+
),
|
|
137
|
+
MasvsControl(
|
|
138
|
+
control_id='MASVS-PLATFORM-2',
|
|
139
|
+
title='WebView Security',
|
|
140
|
+
description='The app uses WebViews securely.',
|
|
141
|
+
level=1
|
|
142
|
+
),
|
|
143
|
+
MasvsControl(
|
|
144
|
+
control_id='MASVS-PLATFORM-3',
|
|
145
|
+
title='Permission Management',
|
|
146
|
+
description='The app uses the principle of least privilege for permissions.',
|
|
147
|
+
level=1
|
|
148
|
+
),
|
|
149
|
+
]
|
|
150
|
+
),
|
|
151
|
+
'CODE': MasvsCategory(
|
|
152
|
+
category_id='MASVS-CODE',
|
|
153
|
+
name='Code Quality',
|
|
154
|
+
description='Security best practices for code quality.',
|
|
155
|
+
controls=[
|
|
156
|
+
MasvsControl(
|
|
157
|
+
control_id='MASVS-CODE-1',
|
|
158
|
+
title='Input Validation',
|
|
159
|
+
description='The app validates and sanitizes all untrusted inputs.',
|
|
160
|
+
level=1
|
|
161
|
+
),
|
|
162
|
+
MasvsControl(
|
|
163
|
+
control_id='MASVS-CODE-2',
|
|
164
|
+
title='Secure Data Handling',
|
|
165
|
+
description='The app handles data securely.',
|
|
166
|
+
level=1
|
|
167
|
+
),
|
|
168
|
+
MasvsControl(
|
|
169
|
+
control_id='MASVS-CODE-3',
|
|
170
|
+
title='Secure Coding Practices',
|
|
171
|
+
description='The app follows secure coding practices.',
|
|
172
|
+
level=1
|
|
173
|
+
),
|
|
174
|
+
MasvsControl(
|
|
175
|
+
control_id='MASVS-CODE-4',
|
|
176
|
+
title='Testing and Debugging',
|
|
177
|
+
description='The app does not expose testing/debugging functionality in production.',
|
|
178
|
+
level=1
|
|
179
|
+
),
|
|
180
|
+
]
|
|
181
|
+
),
|
|
182
|
+
'RESILIENCE': MasvsCategory(
|
|
183
|
+
category_id='MASVS-RESILIENCE',
|
|
184
|
+
name='Resilience Against Reverse Engineering',
|
|
185
|
+
description='Defense-in-depth measures against reverse engineering.',
|
|
186
|
+
controls=[
|
|
187
|
+
MasvsControl(
|
|
188
|
+
control_id='MASVS-RESILIENCE-1',
|
|
189
|
+
title='Root/Jailbreak Detection',
|
|
190
|
+
description='The app detects and responds to running on a rooted or jailbroken device.',
|
|
191
|
+
level=2
|
|
192
|
+
),
|
|
193
|
+
MasvsControl(
|
|
194
|
+
control_id='MASVS-RESILIENCE-2',
|
|
195
|
+
title='Anti-Debugging',
|
|
196
|
+
description='The app implements anti-debugging techniques.',
|
|
197
|
+
level=2
|
|
198
|
+
),
|
|
199
|
+
MasvsControl(
|
|
200
|
+
control_id='MASVS-RESILIENCE-3',
|
|
201
|
+
title='Code Obfuscation',
|
|
202
|
+
description='The app implements code obfuscation.',
|
|
203
|
+
level=2
|
|
204
|
+
),
|
|
205
|
+
MasvsControl(
|
|
206
|
+
control_id='MASVS-RESILIENCE-4',
|
|
207
|
+
title='Integrity Verification',
|
|
208
|
+
description='The app implements integrity verification.',
|
|
209
|
+
level=2
|
|
210
|
+
),
|
|
211
|
+
]
|
|
212
|
+
),
|
|
213
|
+
'PRIVACY': MasvsCategory(
|
|
214
|
+
category_id='MASVS-PRIVACY',
|
|
215
|
+
name='Privacy',
|
|
216
|
+
description='Protection of user privacy.',
|
|
217
|
+
controls=[
|
|
218
|
+
MasvsControl(
|
|
219
|
+
control_id='MASVS-PRIVACY-1',
|
|
220
|
+
title='Data Minimization',
|
|
221
|
+
description='The app minimizes access to sensitive data and resources.',
|
|
222
|
+
level=1
|
|
223
|
+
),
|
|
224
|
+
MasvsControl(
|
|
225
|
+
control_id='MASVS-PRIVACY-2',
|
|
226
|
+
title='Data Collection Transparency',
|
|
227
|
+
description='The app is transparent about data collection.',
|
|
228
|
+
level=1
|
|
229
|
+
),
|
|
230
|
+
MasvsControl(
|
|
231
|
+
control_id='MASVS-PRIVACY-3',
|
|
232
|
+
title='User Consent',
|
|
233
|
+
description='The app obtains proper user consent for data collection.',
|
|
234
|
+
level=1
|
|
235
|
+
),
|
|
236
|
+
MasvsControl(
|
|
237
|
+
control_id='MASVS-PRIVACY-4',
|
|
238
|
+
title='Privacy Controls',
|
|
239
|
+
description='The app provides privacy controls to users.',
|
|
240
|
+
level=1
|
|
241
|
+
),
|
|
242
|
+
]
|
|
243
|
+
),
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
def get_category(self, category_id: str) -> Optional[MasvsCategory]:
|
|
247
|
+
"""Get a MASVS category by ID."""
|
|
248
|
+
return self.categories.get(category_id)
|
|
249
|
+
|
|
250
|
+
def get_control(self, control_id: str) -> Optional[MasvsControl]:
|
|
251
|
+
"""Get a MASVS control by full control ID (e.g., 'MASVS-STORAGE-1')."""
|
|
252
|
+
parts = control_id.split('-')
|
|
253
|
+
if len(parts) < 3:
|
|
254
|
+
return None
|
|
255
|
+
|
|
256
|
+
category_id = parts[1]
|
|
257
|
+
category = self.categories.get(category_id)
|
|
258
|
+
|
|
259
|
+
if not category:
|
|
260
|
+
return None
|
|
261
|
+
|
|
262
|
+
for control in category.controls:
|
|
263
|
+
if control.control_id == control_id:
|
|
264
|
+
return control
|
|
265
|
+
|
|
266
|
+
return None
|
|
267
|
+
|
|
268
|
+
def get_compliance_summary(self, findings: list) -> Dict:
|
|
269
|
+
"""
|
|
270
|
+
Generate a compliance summary based on findings.
|
|
271
|
+
|
|
272
|
+
Args:
|
|
273
|
+
findings: List of Finding objects
|
|
274
|
+
|
|
275
|
+
Returns:
|
|
276
|
+
Dictionary with compliance status by category and control
|
|
277
|
+
"""
|
|
278
|
+
summary = {}
|
|
279
|
+
|
|
280
|
+
for category_id, category in self.categories.items():
|
|
281
|
+
category_findings = [f for f in findings if f.masvs_category == category_id]
|
|
282
|
+
|
|
283
|
+
control_status = {}
|
|
284
|
+
for control in category.controls:
|
|
285
|
+
control_findings = [f for f in category_findings if f.masvs_control == control.control_id]
|
|
286
|
+
control_status[control.control_id] = {
|
|
287
|
+
'title': control.title,
|
|
288
|
+
'level': control.level,
|
|
289
|
+
'findings_count': len(control_findings),
|
|
290
|
+
'status': 'FAIL' if control_findings else 'PASS',
|
|
291
|
+
'severity_breakdown': {
|
|
292
|
+
'critical': sum(1 for f in control_findings if f.severity == 'critical'),
|
|
293
|
+
'high': sum(1 for f in control_findings if f.severity == 'high'),
|
|
294
|
+
'medium': sum(1 for f in control_findings if f.severity == 'medium'),
|
|
295
|
+
'low': sum(1 for f in control_findings if f.severity == 'low'),
|
|
296
|
+
'info': sum(1 for f in control_findings if f.severity == 'info'),
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
summary[category_id] = {
|
|
301
|
+
'name': category.name,
|
|
302
|
+
'description': category.description,
|
|
303
|
+
'findings_count': len(category_findings),
|
|
304
|
+
'status': 'FAIL' if category_findings else 'PASS',
|
|
305
|
+
'controls': control_status
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
return summary
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Patterns Module
|
|
3
|
+
|
|
4
|
+
Contains all vulnerability detection patterns organized by MASVS category.
|
|
5
|
+
Matches Flutter Vulnerability Catalog v2.0 (26 vulnerabilities).
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from .base_pattern import BasePattern, RegexPattern, PatternMatch
|
|
9
|
+
from .pattern_registry import PatternRegistry
|
|
10
|
+
from .storage_patterns import STORAGE_PATTERNS
|
|
11
|
+
from .crypto_patterns import CRYPTO_PATTERNS
|
|
12
|
+
from .auth_patterns import AUTH_PATTERNS
|
|
13
|
+
from .network_patterns import NETWORK_PATTERNS
|
|
14
|
+
from .platform_patterns import PLATFORM_PATTERNS
|
|
15
|
+
from .code_patterns import CODE_PATTERNS
|
|
16
|
+
from .resilience_patterns import RESILIENCE_PATTERNS
|
|
17
|
+
from .privacy_patterns import PRIVACY_PATTERNS
|
|
18
|
+
|
|
19
|
+
__all__ = [
|
|
20
|
+
'BasePattern',
|
|
21
|
+
'RegexPattern',
|
|
22
|
+
'PatternMatch',
|
|
23
|
+
'PatternRegistry',
|
|
24
|
+
'STORAGE_PATTERNS',
|
|
25
|
+
'CRYPTO_PATTERNS',
|
|
26
|
+
'AUTH_PATTERNS',
|
|
27
|
+
'NETWORK_PATTERNS',
|
|
28
|
+
'PLATFORM_PATTERNS',
|
|
29
|
+
'CODE_PATTERNS',
|
|
30
|
+
'RESILIENCE_PATTERNS',
|
|
31
|
+
'PRIVACY_PATTERNS'
|
|
32
|
+
]
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"""
|
|
2
|
+
MASVS-AUTH Vulnerability Patterns
|
|
3
|
+
|
|
4
|
+
Patterns for detecting authentication and session management vulnerabilities.
|
|
5
|
+
Maps to OWASP MASVS v2.1.0 AUTH category.
|
|
6
|
+
|
|
7
|
+
Catalog Reference: V008-V010
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
AUTH_PATTERNS = [
|
|
11
|
+
{
|
|
12
|
+
'vulnerability_id': 'V008',
|
|
13
|
+
'title': 'Insecure Biometric Authentication',
|
|
14
|
+
'description': 'Biometric authentication that only checks a boolean result without cryptographic binding. Attackers can bypass this with function hooking on rooted devices.',
|
|
15
|
+
'severity': 'high',
|
|
16
|
+
'masvs_category': 'AUTH',
|
|
17
|
+
'masvs_control': 'MASVS-AUTH-2',
|
|
18
|
+
'cwe_id': 'CWE-287',
|
|
19
|
+
'remediation': 'Use biometrics with cryptographic binding. Store sensitive keys in the Keystore/Keychain and require biometric authentication to access them.',
|
|
20
|
+
'patterns': [
|
|
21
|
+
r'localAuth\.authenticate(?!.*biometricOnly)',
|
|
22
|
+
r'LocalAuthentication.*authenticate.*\(\s*\)',
|
|
23
|
+
r'authenticate\s*\([^)]*localizedReason[^)]*\)(?!.*useErrorDialogs)',
|
|
24
|
+
r'canCheckBiometrics(?!.*isDeviceSupported)',
|
|
25
|
+
],
|
|
26
|
+
'false_positive_patterns': [
|
|
27
|
+
r'cryptographic',
|
|
28
|
+
r'Keystore',
|
|
29
|
+
r'Keychain',
|
|
30
|
+
r'biometricOnly\s*:\s*true',
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
'vulnerability_id': 'V009',
|
|
35
|
+
'title': 'Missing Session Timeout',
|
|
36
|
+
'description': 'App does not implement session timeout, allowing indefinite session validity. Compromised tokens remain valid indefinitely.',
|
|
37
|
+
'severity': 'medium',
|
|
38
|
+
'masvs_category': 'AUTH',
|
|
39
|
+
'masvs_control': 'MASVS-AUTH-1',
|
|
40
|
+
'cwe_id': 'CWE-613',
|
|
41
|
+
'remediation': 'Implement session timeout with automatic logout. Use token expiration and refresh tokens. Consider idle timeout based on user inactivity.',
|
|
42
|
+
'patterns': [
|
|
43
|
+
r'(?:token|session).*(?:save|store|persist)(?!.*expir)',
|
|
44
|
+
r'setString\s*\(\s*["\'](?:token|session|jwt)["\']',
|
|
45
|
+
r'jwt_decode(?!.*exp)',
|
|
46
|
+
r'JwtDecoder\.decode(?!.*isExpired)',
|
|
47
|
+
],
|
|
48
|
+
'false_positive_patterns': [
|
|
49
|
+
r'isExpired',
|
|
50
|
+
r'expiresAt',
|
|
51
|
+
r'tokenExpiry',
|
|
52
|
+
r'sessionTimeout',
|
|
53
|
+
r'refreshToken',
|
|
54
|
+
# NOTE: kOption/kWindow/kEvent constants, code-generated model fields,
|
|
55
|
+
# and function declarations/calls with session/token in names are now
|
|
56
|
+
# handled by the shared Dart/Flutter whitelist in base_pattern.py.
|
|
57
|
+
# V009-specific FP filters:
|
|
58
|
+
# UI labels and display strings mentioning sessions
|
|
59
|
+
r"""['"]\s*(?:Keep|Restore|Save|Active|Display)\s+.*[Ss]ession""",
|
|
60
|
+
# Terminal/connection session management (not auth sessions)
|
|
61
|
+
r'(?:terminal|persistent|restore|close|cleanup)\w*[Ss]ession',
|
|
62
|
+
# Variables named *TokenKey or *token used for non-auth purposes
|
|
63
|
+
r'(?:restore|wayland|tab)\w*[Tt]oken',
|
|
64
|
+
# Sorted/filtered session lists (data processing, not session storage)
|
|
65
|
+
r'(?:sorted|filtered|persistent)[Ss]essions',
|
|
66
|
+
# ReceiveSession data models (file transfer sessions, not auth sessions)
|
|
67
|
+
r'Receive[Ss]ession',
|
|
68
|
+
# Display/show tokens (UI tokens, not auth tokens)
|
|
69
|
+
r'[Ss]how[Tt]oken',
|
|
70
|
+
]
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
'vulnerability_id': 'V010',
|
|
74
|
+
'title': 'Weak Local PIN/Password Policy',
|
|
75
|
+
'description': 'App allows weak PINs (e.g., 4 digits, no complexity requirements) or passwords without enforcing strength requirements.',
|
|
76
|
+
'severity': 'medium',
|
|
77
|
+
'masvs_category': 'AUTH',
|
|
78
|
+
'masvs_control': 'MASVS-AUTH-2',
|
|
79
|
+
'cwe_id': 'CWE-521',
|
|
80
|
+
'remediation': 'Enforce strong PIN/password policy: minimum 6 digits for PIN, 8+ characters with complexity for passwords. Block common PINs (1234, 0000) and weak passwords.',
|
|
81
|
+
'patterns': [
|
|
82
|
+
r'pin\.length\s*[=<>!]+\s*[1-5]\b',
|
|
83
|
+
r'password\.length\s*[<>=!]+\s*[1-7]\b',
|
|
84
|
+
# Removed: if (pin != null) — standard null check, not weak validation
|
|
85
|
+
# Only flag isNotEmpty when it's the SOLE validation before using the password
|
|
86
|
+
# password.isNotEmpty as a null check before storage/transmission is normal
|
|
87
|
+
],
|
|
88
|
+
'false_positive_patterns': [
|
|
89
|
+
r'pin\.length\s*>=?\s*[6-9]',
|
|
90
|
+
r'password\.length\s*>=?\s*(?:[8-9]|[1-9]\d)',
|
|
91
|
+
r'RegExp.*(?:uppercase|lowercase|digit|special)',
|
|
92
|
+
r'passwordStrength',
|
|
93
|
+
]
|
|
94
|
+
},
|
|
95
|
+
]
|