@sun-asterisk/sunlint 1.2.2 → 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 +107 -1
- package/CONTRIBUTING.md +1654 -66
- package/README.md +19 -6
- package/config/ci-cd.json +54 -0
- package/config/development.json +56 -0
- package/config/engines/engines-enhanced.json +86 -0
- package/config/engines/semantic-config.json +114 -0
- package/config/eslint-rule-mapping.json +50 -38
- 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 +2564 -0
- package/config/rules/rules-registry-generated.json +785 -837
- package/config/rules/rules-registry.json +13 -1
- package/core/adapters/sunlint-rule-adapter.js +25 -30
- package/core/analysis-orchestrator.js +42 -2
- package/core/categories.js +52 -0
- package/core/category-constants.js +39 -0
- package/core/cli-action-handler.js +53 -32
- package/core/cli-program.js +11 -3
- package/core/config-manager.js +111 -0
- package/core/config-merger.js +88 -0
- package/core/constants/categories.js +168 -0
- package/core/constants/defaults.js +165 -0
- package/core/constants/engines.js +185 -0
- package/core/constants/index.js +30 -0
- package/core/constants/rules.js +215 -0
- package/core/enhanced-rules-registry.js +3 -3
- package/core/file-targeting-service.js +128 -7
- package/core/interfaces/rule-plugin.interface.js +207 -0
- package/core/plugin-manager.js +448 -0
- package/core/rule-selection-service.js +42 -15
- package/core/semantic-engine.js +658 -0
- package/core/semantic-rule-base.js +433 -0
- package/core/unified-rule-registry.js +484 -0
- package/docs/COMMAND-EXAMPLES.md +134 -0
- package/docs/CONSTANTS-ARCHITECTURE.md +288 -0
- package/docs/LARGE-PROJECT-GUIDE.md +324 -0
- package/engines/core/base-engine.js +249 -0
- package/engines/engine-factory.js +275 -0
- package/engines/eslint-engine.js +171 -19
- package/engines/heuristic-engine.js +569 -78
- package/integrations/eslint/plugin/index.js +26 -28
- package/origin-rules/common-en.md +8 -8
- package/package.json +10 -6
- package/rules/common/C003_no_vague_abbreviations/analyzer.js +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/C029_catch_block_logging/analyzer.js +17 -5
- 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/C047_no_duplicate_retry_logic/c047-semantic-rule.js +278 -0
- package/rules/common/C047_no_duplicate_retry_logic/symbol-analyzer-enhanced.js +968 -0
- package/rules/common/C047_no_duplicate_retry_logic/symbol-config.json +71 -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 +8 -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/category-manager.js +150 -0
- package/scripts/generate-rules-registry.js +88 -0
- package/scripts/migrate-rule-registry.js +157 -0
- package/scripts/prepare-release.sh +1 -1
- package/scripts/validate-system.js +48 -0
- package/.sunlint.json +0 -35
- package/config/README.md +0 -88
- package/config/engines/eslint-rule-mapping.json +0 -74
- package/config/schemas/sunlint-schema.json +0 -0
- package/config/testing/test-s005-working.ts +0 -22
- package/core/multi-rule-runner.js +0 -0
- 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/engines/tree-sitter-parser.js +0 -0
- package/engines/universal-ast-engine.js +0 -0
- package/integrations/eslint/plugin/rules/common/c076-single-behavior-per-test.js +0 -254
- package/rules/common/C029_catch_block_logging/analyzer-backup.js +0 -426
- package/rules/common/C029_catch_block_logging/analyzer-fixed.js +0 -130
- package/rules/common/C029_catch_block_logging/analyzer-multi-tech.js +0 -487
- package/rules/common/C029_catch_block_logging/analyzer-simple.js +0 -110
- package/rules/common/C029_catch_block_logging/ast-analyzer-backup.js +0 -441
- package/rules/common/C029_catch_block_logging/ast-analyzer-new.js +0 -127
- package/rules/common/C029_catch_block_logging/ast-analyzer.js +0 -133
- package/rules/common/C029_catch_block_logging/cfg-analyzer.js +0 -408
- package/rules/common/C029_catch_block_logging/dataflow-analyzer.js +0 -454
- package/rules/common/C029_catch_block_logging/multi-language-ast-engine.js +0 -700
- package/rules/common/C029_catch_block_logging/pattern-learning-analyzer.js +0 -568
- package/rules/common/C029_catch_block_logging/semantic-analyzer.js +0 -459
|
@@ -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
|
+
}
|