@sun-asterisk/sunlint 1.3.0 → 1.3.1
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.
- package/CHANGELOG.md +68 -1
- package/CONTRIBUTING.md +1179 -54
- package/README.md +3 -4
- package/config/ci-cd.json +54 -0
- package/config/development.json +56 -0
- package/config/large-project.json +143 -0
- package/config/presets/all.json +0 -1
- package/config/release.json +70 -0
- package/config/rule-analysis-strategies.js +23 -4
- package/config/rules/S027-categories.json +122 -0
- package/config/rules/enhanced-rules-registry.json +136 -75
- package/config/rules/rules-registry-generated.json +2 -2
- package/config/rules/rules-registry.json +13 -1
- package/core/cli-action-handler.js +24 -30
- package/core/cli-program.js +11 -3
- package/core/config-merger.js +29 -2
- package/core/enhanced-rules-registry.js +3 -3
- package/core/semantic-engine.js +117 -19
- package/core/unified-rule-registry.js +1 -1
- package/docs/COMMAND-EXAMPLES.md +134 -0
- package/docs/LARGE-PROJECT-GUIDE.md +324 -0
- package/engines/heuristic-engine.js +71 -13
- package/integrations/eslint/plugin/index.js +0 -2
- package/origin-rules/common-en.md +8 -8
- package/package.json +1 -1
- package/rules/common/C017_constructor_logic/analyzer.js +254 -17
- package/rules/common/C017_constructor_logic/semantic-analyzer.js +340 -0
- package/rules/common/C033_separate_service_repository/README.md +78 -0
- package/rules/common/C033_separate_service_repository/analyzer.js +160 -0
- package/rules/common/C033_separate_service_repository/config.json +50 -0
- package/rules/common/C033_separate_service_repository/regex-based-analyzer.js +585 -0
- package/rules/common/C033_separate_service_repository/symbol-based-analyzer.js +368 -0
- package/rules/common/C035_error_logging_context/STRATEGY.md +99 -0
- package/rules/common/C035_error_logging_context/analyzer.js +230 -0
- package/rules/common/C035_error_logging_context/config.json +54 -0
- package/rules/common/C035_error_logging_context/regex-based-analyzer.js +299 -0
- package/rules/common/C035_error_logging_context/symbol-based-analyzer.js +454 -0
- package/rules/common/C040_centralized_validation/analyzer.js +165 -0
- package/rules/common/C040_centralized_validation/config.json +46 -0
- package/rules/common/C040_centralized_validation/regex-based-analyzer.js +243 -0
- package/rules/common/C040_centralized_validation/symbol-based-analyzer.js +416 -0
- package/rules/common/{C076_single_test_behavior → C072_single_test_behavior}/analyzer.js +6 -6
- package/rules/common/C076_explicit_function_types/README.md +30 -0
- package/rules/common/C076_explicit_function_types/analyzer.js +172 -0
- package/rules/common/C076_explicit_function_types/config.json +15 -0
- package/rules/common/C076_explicit_function_types/semantic-analyzer.js +341 -0
- package/rules/index.js +1 -0
- package/rules/parser/rule-parser.js +13 -2
- package/rules/security/S005_no_origin_auth/README.md +226 -0
- package/rules/security/S005_no_origin_auth/analyzer.js +184 -0
- package/rules/security/S005_no_origin_auth/ast-analyzer.js +406 -0
- package/rules/security/S005_no_origin_auth/config.json +85 -0
- package/rules/security/S006_no_plaintext_recovery_codes/README.md +139 -0
- package/rules/security/S006_no_plaintext_recovery_codes/analyzer.js +306 -0
- package/rules/security/S006_no_plaintext_recovery_codes/config.json +48 -0
- package/rules/security/S007_no_plaintext_otp/README.md +198 -0
- package/rules/security/S007_no_plaintext_otp/analyzer.js +406 -0
- package/rules/security/S007_no_plaintext_otp/config.json +79 -0
- package/rules/security/S007_no_plaintext_otp/semantic-analyzer.js +609 -0
- package/rules/security/S007_no_plaintext_otp/semantic-config.json +195 -0
- package/rules/security/S007_no_plaintext_otp/semantic-wrapper.js +280 -0
- package/rules/security/S027_no_hardcoded_secrets/analyzer.js +180 -366
- package/rules/security/S027_no_hardcoded_secrets/categories.json +153 -0
- package/rules/security/S027_no_hardcoded_secrets/categorized-analyzer.js +250 -0
- package/scripts/prepare-release.sh +1 -1
- package/docs/ESLINT-INTEGRATION-STRATEGY.md +0 -392
- package/docs/FUTURE_PACKAGES.md +0 -83
- package/docs/HEURISTIC_VS_AI.md +0 -113
- package/docs/PRODUCTION_DEPLOYMENT_ANALYSIS.md +0 -112
- package/docs/PRODUCTION_SIZE_IMPACT.md +0 -183
- package/docs/RELEASE_GUIDE.md +0 -230
- package/docs/STANDARDIZED-CATEGORY-FILTERING.md +0 -156
- package/integrations/eslint/plugin/rules/common/c076-single-behavior-per-test.js +0 -254
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@ SunLint uses a unified adapter pattern ensuring consistency between CLI and VSCo
|
|
|
33
33
|
│ • Origin Rules (markdown) │
|
|
34
34
|
│ • Heuristic Engine (244 rules) │
|
|
35
35
|
│ • ESLint Engine (17 rules) │
|
|
36
|
-
│ •
|
|
36
|
+
│ • OpenAI Engine (256 rules) │
|
|
37
37
|
└───────────────────────────────────┘
|
|
38
38
|
```
|
|
39
39
|
|
|
@@ -166,13 +166,13 @@ sunlint --show-engines --rules=C010,R001,S005
|
|
|
166
166
|
# Use specific engine
|
|
167
167
|
sunlint --engine=heuristic --rules=C010,C020 --input=src
|
|
168
168
|
sunlint --engine=eslint --rules=R001,R006 --input=src
|
|
169
|
-
sunlint --engine=
|
|
169
|
+
sunlint --engine=openai --rules=C010,S001 --input=src
|
|
170
170
|
```
|
|
171
171
|
|
|
172
172
|
**Engine Stats:**
|
|
173
173
|
- **Heuristic Engine**: 244/256 rules (95.3%) - Fast, universal
|
|
174
174
|
- **ESLint Engine**: 17/256 rules (6.6%) - JavaScript/TypeScript focused
|
|
175
|
-
- **
|
|
175
|
+
- **OpenAI Engine**: 256/256 rules (100%) - Context-aware analysis
|
|
176
176
|
|
|
177
177
|
### **ESLint Integration**
|
|
178
178
|
Seamlessly integrate with existing ESLint configurations:
|
|
@@ -261,7 +261,6 @@ sunlint --all --only-source --input=src
|
|
|
261
261
|
| **C043** | No Console or Print | ✅ Stable |
|
|
262
262
|
| **C047** | No Duplicate Retry Logic | ✅ Stable |
|
|
263
263
|
| **C075** | Explicit Function Return Types | ✅ Stable |
|
|
264
|
-
| **C076** | Single Test Behavior | ✅ Stable |
|
|
265
264
|
| **T002-T021** | TypeScript-specific rules | ✅ Stable |
|
|
266
265
|
|
|
267
266
|
### **Security Rules** 🔒 (47 rules)
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "CI/CD Optimized Configuration",
|
|
3
|
+
"description": "Fast analysis for CI/CD pipelines",
|
|
4
|
+
|
|
5
|
+
"performance": {
|
|
6
|
+
"maxSemanticFiles": 300,
|
|
7
|
+
"maxConcurrentRules": 3,
|
|
8
|
+
"timeoutMs": 30000
|
|
9
|
+
},
|
|
10
|
+
|
|
11
|
+
"input": ["."],
|
|
12
|
+
|
|
13
|
+
"include": [
|
|
14
|
+
"src/**/*.ts",
|
|
15
|
+
"src/**/*.js"
|
|
16
|
+
],
|
|
17
|
+
|
|
18
|
+
"exclude": [
|
|
19
|
+
"**/*.test.*",
|
|
20
|
+
"**/*.d.ts",
|
|
21
|
+
"node_modules/**",
|
|
22
|
+
"dist/**",
|
|
23
|
+
"build/**"
|
|
24
|
+
],
|
|
25
|
+
|
|
26
|
+
"rules": {
|
|
27
|
+
"categories": {
|
|
28
|
+
"security": true,
|
|
29
|
+
"quality": true,
|
|
30
|
+
"logging": false
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
"output": {
|
|
35
|
+
"format": "github",
|
|
36
|
+
"console": true,
|
|
37
|
+
"summary": false
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
"engines": {
|
|
41
|
+
"semantic": {
|
|
42
|
+
"enabled": true,
|
|
43
|
+
"fileLimit": 300
|
|
44
|
+
},
|
|
45
|
+
"ai": {
|
|
46
|
+
"enabled": false
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
"reporting": {
|
|
51
|
+
"exitOnError": true,
|
|
52
|
+
"showProgress": false
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Development Configuration",
|
|
3
|
+
"description": "Fast feedback for daily development",
|
|
4
|
+
|
|
5
|
+
"performance": {
|
|
6
|
+
"maxSemanticFiles": 500,
|
|
7
|
+
"maxConcurrentRules": 4,
|
|
8
|
+
"timeoutMs": 15000
|
|
9
|
+
},
|
|
10
|
+
|
|
11
|
+
"input": ["."],
|
|
12
|
+
|
|
13
|
+
"include": [
|
|
14
|
+
"src/**/*.ts",
|
|
15
|
+
"src/**/*.js",
|
|
16
|
+
"lib/**/*.ts"
|
|
17
|
+
],
|
|
18
|
+
|
|
19
|
+
"exclude": [
|
|
20
|
+
"**/*.test.*",
|
|
21
|
+
"**/*.spec.*",
|
|
22
|
+
"**/*.d.ts",
|
|
23
|
+
"node_modules/**",
|
|
24
|
+
"dist/**"
|
|
25
|
+
],
|
|
26
|
+
|
|
27
|
+
"rules": {
|
|
28
|
+
"C006": "error",
|
|
29
|
+
"C019": "error",
|
|
30
|
+
"C029": "error",
|
|
31
|
+
"S001": "error",
|
|
32
|
+
"S005": "error"
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
"output": {
|
|
36
|
+
"format": "summary",
|
|
37
|
+
"console": true,
|
|
38
|
+
"summary": true,
|
|
39
|
+
"verbose": false
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
"engines": {
|
|
43
|
+
"semantic": {
|
|
44
|
+
"enabled": true,
|
|
45
|
+
"fileLimit": 500
|
|
46
|
+
},
|
|
47
|
+
"ai": {
|
|
48
|
+
"enabled": false
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
"git": {
|
|
53
|
+
"changedFiles": true,
|
|
54
|
+
"diffBase": "origin/main"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./sunlint-schema.json",
|
|
3
|
+
"name": "Large Project Configuration",
|
|
4
|
+
"description": "Optimized configuration for projects with 1000+ files",
|
|
5
|
+
|
|
6
|
+
"performance": {
|
|
7
|
+
"maxSemanticFiles": 1000,
|
|
8
|
+
"maxConcurrentRules": 5,
|
|
9
|
+
"timeoutMs": 60000,
|
|
10
|
+
"cacheEnabled": true,
|
|
11
|
+
"cacheLocation": ".sunlint-cache/"
|
|
12
|
+
},
|
|
13
|
+
|
|
14
|
+
"input": [
|
|
15
|
+
"src",
|
|
16
|
+
"lib",
|
|
17
|
+
"app",
|
|
18
|
+
"packages"
|
|
19
|
+
],
|
|
20
|
+
|
|
21
|
+
"include": [
|
|
22
|
+
"src/**/*.ts",
|
|
23
|
+
"src/**/*.js",
|
|
24
|
+
"lib/**/*.ts",
|
|
25
|
+
"app/**/*.ts",
|
|
26
|
+
"packages/*/src/**/*.ts"
|
|
27
|
+
],
|
|
28
|
+
|
|
29
|
+
"exclude": [
|
|
30
|
+
"node_modules/**",
|
|
31
|
+
"dist/**",
|
|
32
|
+
"build/**",
|
|
33
|
+
"coverage/**",
|
|
34
|
+
"**/*.test.*",
|
|
35
|
+
"**/*.spec.*",
|
|
36
|
+
"**/*.d.ts",
|
|
37
|
+
"**/*.generated.*",
|
|
38
|
+
"**/generated/**",
|
|
39
|
+
"**/*.min.*",
|
|
40
|
+
"**/*.bundle.*"
|
|
41
|
+
],
|
|
42
|
+
|
|
43
|
+
"rules": {
|
|
44
|
+
"enabled": [
|
|
45
|
+
"C006", "C019", "C029", "C047",
|
|
46
|
+
"S001", "S005", "S010"
|
|
47
|
+
],
|
|
48
|
+
"categories": {
|
|
49
|
+
"quality": true,
|
|
50
|
+
"security": true,
|
|
51
|
+
"performance": false,
|
|
52
|
+
"logging": true
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
"output": {
|
|
57
|
+
"format": "summary",
|
|
58
|
+
"console": true,
|
|
59
|
+
"summary": true,
|
|
60
|
+
"includeContext": true,
|
|
61
|
+
"showFixSuggestions": true,
|
|
62
|
+
"groupByFile": true,
|
|
63
|
+
"sortBy": "severity"
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
"engines": {
|
|
67
|
+
"semantic": {
|
|
68
|
+
"enabled": true,
|
|
69
|
+
"fileLimit": 1000,
|
|
70
|
+
"enableCaching": true,
|
|
71
|
+
"crossFileAnalysis": true
|
|
72
|
+
},
|
|
73
|
+
"heuristic": {
|
|
74
|
+
"enabled": true,
|
|
75
|
+
"fastMode": false
|
|
76
|
+
},
|
|
77
|
+
"ai": {
|
|
78
|
+
"enabled": false,
|
|
79
|
+
"fallbackToPattern": true
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
"ci": {
|
|
84
|
+
"changedFiles": {
|
|
85
|
+
"maxSemanticFiles": 300,
|
|
86
|
+
"format": "github",
|
|
87
|
+
"failOnError": true
|
|
88
|
+
},
|
|
89
|
+
"fullScan": {
|
|
90
|
+
"maxSemanticFiles": 1000,
|
|
91
|
+
"format": "json",
|
|
92
|
+
"output": "sunlint-report.json"
|
|
93
|
+
},
|
|
94
|
+
"nightly": {
|
|
95
|
+
"maxSemanticFiles": 2000,
|
|
96
|
+
"format": "detailed",
|
|
97
|
+
"output": "nightly-report.json"
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
"overrides": [
|
|
102
|
+
{
|
|
103
|
+
"files": ["src/critical/**/*.ts"],
|
|
104
|
+
"performance": {
|
|
105
|
+
"maxSemanticFiles": 2000
|
|
106
|
+
},
|
|
107
|
+
"rules": {
|
|
108
|
+
"enabled": "all"
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"files": ["**/*.test.*", "**/*.spec.*"],
|
|
113
|
+
"performance": {
|
|
114
|
+
"maxSemanticFiles": 500
|
|
115
|
+
},
|
|
116
|
+
"rules": {
|
|
117
|
+
"categories": {
|
|
118
|
+
"testing": true,
|
|
119
|
+
"security": false
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"files": ["packages/*/src/**"],
|
|
125
|
+
"performance": {
|
|
126
|
+
"maxSemanticFiles": 1500
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
],
|
|
130
|
+
|
|
131
|
+
"reporting": {
|
|
132
|
+
"baseline": {
|
|
133
|
+
"enabled": true,
|
|
134
|
+
"file": "baseline.json",
|
|
135
|
+
"updateOnClean": true
|
|
136
|
+
},
|
|
137
|
+
"trends": {
|
|
138
|
+
"enabled": true,
|
|
139
|
+
"historyFile": "trends.json",
|
|
140
|
+
"trackMetrics": ["violations", "files", "performance"]
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
package/config/presets/all.json
CHANGED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Release Validation Configuration",
|
|
3
|
+
"description": "Comprehensive analysis for release validation",
|
|
4
|
+
|
|
5
|
+
"performance": {
|
|
6
|
+
"maxSemanticFiles": -1,
|
|
7
|
+
"maxConcurrentRules": 8,
|
|
8
|
+
"timeoutMs": 300000
|
|
9
|
+
},
|
|
10
|
+
|
|
11
|
+
"input": ["."],
|
|
12
|
+
|
|
13
|
+
"include": [
|
|
14
|
+
"src/**/*.ts",
|
|
15
|
+
"src/**/*.js",
|
|
16
|
+
"lib/**/*.ts",
|
|
17
|
+
"app/**/*.ts",
|
|
18
|
+
"packages/*/src/**/*.ts"
|
|
19
|
+
],
|
|
20
|
+
|
|
21
|
+
"exclude": [
|
|
22
|
+
"node_modules/**",
|
|
23
|
+
"dist/**",
|
|
24
|
+
"build/**",
|
|
25
|
+
"coverage/**",
|
|
26
|
+
"**/*.min.*",
|
|
27
|
+
"**/*.bundle.*"
|
|
28
|
+
],
|
|
29
|
+
|
|
30
|
+
"rules": {
|
|
31
|
+
"enabled": "all"
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
"output": {
|
|
35
|
+
"format": "detailed",
|
|
36
|
+
"console": true,
|
|
37
|
+
"summary": true,
|
|
38
|
+
"includeContext": true,
|
|
39
|
+
"showFixSuggestions": true,
|
|
40
|
+
"output": "release-validation-report.json"
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
"engines": {
|
|
44
|
+
"semantic": {
|
|
45
|
+
"enabled": true,
|
|
46
|
+
"fileLimit": -1,
|
|
47
|
+
"enableCaching": true,
|
|
48
|
+
"crossFileAnalysis": true
|
|
49
|
+
},
|
|
50
|
+
"ai": {
|
|
51
|
+
"enabled": true,
|
|
52
|
+
"provider": "openai",
|
|
53
|
+
"model": "gpt-4o-mini"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
"reporting": {
|
|
58
|
+
"baseline": {
|
|
59
|
+
"enabled": true,
|
|
60
|
+
"file": "release-baseline.json",
|
|
61
|
+
"compareWithPrevious": true
|
|
62
|
+
},
|
|
63
|
+
"trends": {
|
|
64
|
+
"enabled": true,
|
|
65
|
+
"historyFile": "release-trends.json"
|
|
66
|
+
},
|
|
67
|
+
"failOnNewViolations": true,
|
|
68
|
+
"exitOnError": true
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -22,9 +22,10 @@ module.exports = {
|
|
|
22
22
|
accuracy: { ast: 95, regex: 85 }
|
|
23
23
|
},
|
|
24
24
|
'C017': {
|
|
25
|
-
reason: 'Constructor logic analysis needs
|
|
26
|
-
methods: ['ast', 'regex'],
|
|
27
|
-
accuracy: { ast:
|
|
25
|
+
reason: 'Constructor logic analysis needs semantic context - Phase 2 with symbol-based analysis',
|
|
26
|
+
methods: ['semantic', 'ast', 'regex'],
|
|
27
|
+
accuracy: { semantic: 95, ast: 85, regex: 70 },
|
|
28
|
+
strategy: 'semantic-primary'
|
|
28
29
|
},
|
|
29
30
|
'S015': {
|
|
30
31
|
reason: 'TLS certificate validation requires AST context analysis',
|
|
@@ -65,6 +66,24 @@ module.exports = {
|
|
|
65
66
|
strategy: 'ast-primary-regex-fallback',
|
|
66
67
|
accuracy: { ast: 90, regex: 75, combined: 95 }
|
|
67
68
|
},
|
|
69
|
+
'C035': {
|
|
70
|
+
reason: 'Error logging context requires symbol-based + regex analysis',
|
|
71
|
+
methods: ['semantic', 'regex'],
|
|
72
|
+
strategy: 'semantic-primary-regex-fallback',
|
|
73
|
+
accuracy: { semantic: 90, regex: 70, combined: 95 }
|
|
74
|
+
},
|
|
75
|
+
'C040': {
|
|
76
|
+
reason: 'Validation centralization requires project-wide symbol analysis + data flow tracking',
|
|
77
|
+
methods: ['semantic', 'regex'],
|
|
78
|
+
strategy: 'semantic-primary-regex-fallback',
|
|
79
|
+
accuracy: { semantic: 95, regex: 75, combined: 97 }
|
|
80
|
+
},
|
|
81
|
+
'C076': {
|
|
82
|
+
reason: 'Public API type enforcement requires symbol-based analysis for export boundaries',
|
|
83
|
+
methods: ['semantic'],
|
|
84
|
+
strategy: 'semantic-primary',
|
|
85
|
+
accuracy: { semantic: 95 }
|
|
86
|
+
},
|
|
68
87
|
'C041': {
|
|
69
88
|
reason: 'Hardcoded secrets need AST literal analysis like ESLint',
|
|
70
89
|
methods: ['ast', 'regex'],
|
|
@@ -87,4 +106,4 @@ module.exports = {
|
|
|
87
106
|
strategy: 'progressive-enhancement'
|
|
88
107
|
}
|
|
89
108
|
}
|
|
90
|
-
};
|
|
109
|
+
};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
{
|
|
2
|
+
"S027": {
|
|
3
|
+
"categories": [
|
|
4
|
+
{
|
|
5
|
+
"name": "AWS Credentials",
|
|
6
|
+
"severity": "critical",
|
|
7
|
+
"description": "AWS access keys, secret keys, and session tokens",
|
|
8
|
+
"patterns": [
|
|
9
|
+
"AKIA[0-9A-Z]{16}",
|
|
10
|
+
"(?i)aws[-_]?(secret[-_]?access[-_]?key|access[-_]?key[-_]?id)[\\s:=]+[\"']?[A-Za-z0-9\\/+=]{20,40}[\"']?",
|
|
11
|
+
"(?i)aws[-_]?session[-_]?token[\\s:=]+[\"']?[A-Za-z0-9\\/+=]{100,}[\"']?"
|
|
12
|
+
],
|
|
13
|
+
"exclude_patterns": [
|
|
14
|
+
"(?i)(test|mock|fake|example|demo)[-_]?aws",
|
|
15
|
+
"AWS_REGION|AWS_DEFAULT_REGION"
|
|
16
|
+
]
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"name": "JWT & Authentication Tokens",
|
|
20
|
+
"severity": "critical",
|
|
21
|
+
"description": "JWT tokens and authentication credentials",
|
|
22
|
+
"patterns": [
|
|
23
|
+
"eyJ[A-Za-z0-9\\-_=]+\\.[A-Za-z0-9\\-_=]+\\.?[A-Za-z0-9\\-_.+/=]*",
|
|
24
|
+
"(?i)(jwt|bearer|auth)[-_]?(token|secret)[\\s:=]+[\"']?[a-zA-Z0-9\\-_=]{20,}[\"']?",
|
|
25
|
+
"(?i)authorization[\\s:=]+[\"']?(bearer|basic)[\\s]+[a-zA-Z0-9\\-_=]{10,}[\"']?"
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"name": "API Keys & Secrets",
|
|
30
|
+
"severity": "high",
|
|
31
|
+
"description": "Generic API keys and secret tokens",
|
|
32
|
+
"patterns": [
|
|
33
|
+
"(?i)(api[-_]?key|secret[-_]?key|access[-_]?token)[\\s:=]+[\"']?[a-zA-Z0-9\\-_=]{16,}[\"']?",
|
|
34
|
+
"(?i)(client[-_]?secret|app[-_]?secret)[\\s:=]+[\"']?[a-zA-Z0-9\\-_=]{20,}[\"']?",
|
|
35
|
+
"(?i)(private[-_]?key|encryption[-_]?key)[\\s:=]+[\"']?[a-zA-Z0-9\\-_=]{20,}[\"']?"
|
|
36
|
+
],
|
|
37
|
+
"exclude_patterns": [
|
|
38
|
+
"(?i)(display|row|sort|primary|foreign)[-_]?key",
|
|
39
|
+
"(?i)key(value|path|name|code|id|index)",
|
|
40
|
+
"^key$"
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"name": "Database Credentials",
|
|
45
|
+
"severity": "high",
|
|
46
|
+
"description": "Database connection strings and passwords",
|
|
47
|
+
"patterns": [
|
|
48
|
+
"(mongodb|mysql|postgres|redis):\\/\\/[^\\/\\s'\"]+:[^\\/\\s'\"]+@[^\\/\\s'\"]+",
|
|
49
|
+
"(?i)(db|database)[-_]?(password|pass|pwd|secret)[\\s:=]+[\"']?[a-zA-Z0-9\\-_=]{6,}[\"']?",
|
|
50
|
+
"(?i)connection[-_]?string[\\s:=]+[\"']?[^\"'\\s]{20,}[\"']?"
|
|
51
|
+
]
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"name": "Third-party Service Keys",
|
|
55
|
+
"severity": "high",
|
|
56
|
+
"description": "GitHub, Slack, Stripe and other service tokens",
|
|
57
|
+
"patterns": [
|
|
58
|
+
"gh[pousr]_[A-Za-z0-9_]{36}",
|
|
59
|
+
"xox[baprs]-[A-Za-z0-9-]+",
|
|
60
|
+
"sk_live_[A-Za-z0-9]{24,}",
|
|
61
|
+
"(?i)(github|slack|stripe|paypal)[-_]?(token|key|secret)[\\s:=]+[\"']?[a-zA-Z0-9\\-_=]{16,}[\"']?"
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"name": "Suspicious Variable Names",
|
|
66
|
+
"severity": "medium",
|
|
67
|
+
"description": "Variables with sensitive naming patterns",
|
|
68
|
+
"patterns": [
|
|
69
|
+
"(?i)(client|app|service)[-_]?(id|key|token|secret)[\"']?\\s*[:=]\\s*[\"'][A-Za-z0-9\\-_=]{12,}[\"']?",
|
|
70
|
+
"(?i)(oauth|openid)[-_]?(client[-_]?id|secret)[\\s:=]+[\"']?[a-zA-Z0-9\\-_=]{10,}[\"']?"
|
|
71
|
+
],
|
|
72
|
+
"exclude_patterns": [
|
|
73
|
+
"(?i)(send|verify|update|register|reset).*password",
|
|
74
|
+
"(?i)password.*(reset|verify|update|first|time)"
|
|
75
|
+
]
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"name": "Base64 Encoded Secrets",
|
|
79
|
+
"severity": "medium",
|
|
80
|
+
"description": "Potentially encoded sensitive data",
|
|
81
|
+
"patterns": [
|
|
82
|
+
"[A-Za-z0-9+\\/]{64,}={0,2}"
|
|
83
|
+
],
|
|
84
|
+
"exclude_patterns": [
|
|
85
|
+
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
|
|
86
|
+
"(?i)(test|demo|example|sample)"
|
|
87
|
+
]
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"name": "Environment Variables",
|
|
91
|
+
"severity": "low",
|
|
92
|
+
"description": "Public environment variables that might leak info",
|
|
93
|
+
"patterns": [
|
|
94
|
+
"NEXT_PUBLIC_[A-Z0-9_]+[\\s:=]+[\"'][^\"']+[\"']",
|
|
95
|
+
"(?i)react_app_[A-Z0-9_]+[\\s:=]+[\"'][^\"']+[\"']"
|
|
96
|
+
],
|
|
97
|
+
"exclude_patterns": [
|
|
98
|
+
"NODE_ENV|ENV|ENVIRONMENT|MODE|DEBUG"
|
|
99
|
+
]
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"name": "File Path Leaks",
|
|
103
|
+
"severity": "low",
|
|
104
|
+
"description": "Sensitive file patterns",
|
|
105
|
+
"patterns": [
|
|
106
|
+
"\\.env(\\..+)?$",
|
|
107
|
+
"(secrets?|credentials?|private[-_]?keys?)\\.(json|ya?ml|ts|js)$",
|
|
108
|
+
"id_rsa|id_dsa|\\.pem|\\.p12|\\.pfx$"
|
|
109
|
+
]
|
|
110
|
+
}
|
|
111
|
+
],
|
|
112
|
+
"global_exclude_patterns": [
|
|
113
|
+
"(?i)(test|mock|fake|dummy|example|demo|sample|placeholder)",
|
|
114
|
+
"(?i)(localhost|127\\.0\\.0\\.1|development|dev|staging)",
|
|
115
|
+
"^(true|false|null|undefined|none|empty)$",
|
|
116
|
+
"\\.(test|spec|mock)\\.",
|
|
117
|
+
"__tests__|\\/tests?\\/|\\/spec\\/"
|
|
118
|
+
],
|
|
119
|
+
"min_length": 8,
|
|
120
|
+
"max_length": 1000
|
|
121
|
+
}
|
|
122
|
+
}
|