@sfdxy/mule-lint 1.16.2 → 1.16.3
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/dist/package.json +1 -1
- package/dist/src/rules/documentation/DisplayNameRule.d.ts +17 -0
- package/dist/src/rules/documentation/DisplayNameRule.d.ts.map +1 -0
- package/dist/src/rules/documentation/DisplayNameRule.js +46 -0
- package/dist/src/rules/documentation/DisplayNameRule.js.map +1 -0
- package/dist/src/rules/index.d.ts.map +1 -1
- package/dist/src/rules/index.js +21 -12
- package/dist/src/rules/index.js.map +1 -1
- package/dist/src/rules/logging/ExcessiveLoggersRule.d.ts +16 -0
- package/dist/src/rules/logging/ExcessiveLoggersRule.d.ts.map +1 -0
- package/dist/src/rules/logging/ExcessiveLoggersRule.js +45 -0
- package/dist/src/rules/logging/ExcessiveLoggersRule.js.map +1 -0
- package/dist/src/rules/operations/CommentedCodeRule.d.ts +17 -0
- package/dist/src/rules/operations/CommentedCodeRule.d.ts.map +1 -0
- package/dist/src/rules/operations/CommentedCodeRule.js +58 -0
- package/dist/src/rules/operations/CommentedCodeRule.js.map +1 -0
- package/dist/src/rules/operations/UnusedFlowRule.d.ts +17 -0
- package/dist/src/rules/operations/UnusedFlowRule.d.ts.map +1 -0
- package/dist/src/rules/operations/UnusedFlowRule.js +80 -0
- package/dist/src/rules/operations/UnusedFlowRule.js.map +1 -0
- package/dist/src/rules/performance/ReconnectionStrategyRule.d.ts +16 -0
- package/dist/src/rules/performance/ReconnectionStrategyRule.d.ts.map +1 -0
- package/dist/src/rules/performance/ReconnectionStrategyRule.js +60 -0
- package/dist/src/rules/performance/ReconnectionStrategyRule.js.map +1 -0
- package/dist/src/rules/security/EncryptionKeyInLogsRule.d.ts +17 -0
- package/dist/src/rules/security/EncryptionKeyInLogsRule.d.ts.map +1 -0
- package/dist/src/rules/security/EncryptionKeyInLogsRule.js +46 -0
- package/dist/src/rules/security/EncryptionKeyInLogsRule.js.map +1 -0
- package/dist/src/rules/standards/ApiKitValidationRule.d.ts +16 -0
- package/dist/src/rules/standards/ApiKitValidationRule.d.ts.map +1 -0
- package/dist/src/rules/standards/ApiKitValidationRule.js +39 -0
- package/dist/src/rules/standards/ApiKitValidationRule.js.map +1 -0
- package/dist/src/rules/standards/AutoDiscoveryRule.d.ts +16 -0
- package/dist/src/rules/standards/AutoDiscoveryRule.d.ts.map +1 -0
- package/dist/src/rules/standards/AutoDiscoveryRule.js +47 -0
- package/dist/src/rules/standards/AutoDiscoveryRule.js.map +1 -0
- package/dist/src/rules/standards/CronExternalizedRule.d.ts +16 -0
- package/dist/src/rules/standards/CronExternalizedRule.d.ts.map +1 -0
- package/dist/src/rules/standards/CronExternalizedRule.js +32 -0
- package/dist/src/rules/standards/CronExternalizedRule.js.map +1 -0
- package/dist/src/rules/standards/HttpPortPlaceholderRule.d.ts +16 -0
- package/dist/src/rules/standards/HttpPortPlaceholderRule.d.ts.map +1 -0
- package/dist/src/rules/standards/HttpPortPlaceholderRule.js +34 -0
- package/dist/src/rules/standards/HttpPortPlaceholderRule.js.map +1 -0
- package/package.json +1 -1
- package/dist/src/rules/operations/OperationsRules.d.ts +0 -137
- package/dist/src/rules/operations/OperationsRules.d.ts.map +0 -1
- package/dist/src/rules/operations/OperationsRules.js +0 -442
- package/dist/src/rules/operations/OperationsRules.js.map +0 -1
package/dist/package.json
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ValidationContext, Issue } from '../../types';
|
|
2
|
+
import { BaseRule } from '../base/BaseRule';
|
|
3
|
+
/**
|
|
4
|
+
* DOC-001: Display Name Enforcement
|
|
5
|
+
*
|
|
6
|
+
* Key components should have meaningful doc:name attributes, not defaults.
|
|
7
|
+
*/
|
|
8
|
+
export declare class DisplayNameRule extends BaseRule {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
description: string;
|
|
12
|
+
severity: "info";
|
|
13
|
+
category: "documentation";
|
|
14
|
+
private componentDefaults;
|
|
15
|
+
validate(doc: Document, _context: ValidationContext): Issue[];
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=DisplayNameRule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DisplayNameRule.d.ts","sourceRoot":"","sources":["../../../../src/rules/documentation/DisplayNameRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;;;GAIG;AACH,qBAAa,eAAgB,SAAQ,QAAQ;IACzC,EAAE,SAAa;IACf,IAAI,SAA8B;IAClC,WAAW,SAAyD;IACpE,QAAQ,EAAG,MAAM,CAAU;IAC3B,QAAQ,EAAG,eAAe,CAAU;IAGpC,OAAO,CAAC,iBAAiB,CAOvB;IAEF,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,GAAG,KAAK,EAAE;CA8BhE"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DisplayNameRule = void 0;
|
|
4
|
+
const BaseRule_1 = require("../base/BaseRule");
|
|
5
|
+
/**
|
|
6
|
+
* DOC-001: Display Name Enforcement
|
|
7
|
+
*
|
|
8
|
+
* Key components should have meaningful doc:name attributes, not defaults.
|
|
9
|
+
*/
|
|
10
|
+
class DisplayNameRule extends BaseRule_1.BaseRule {
|
|
11
|
+
id = 'DOC-001';
|
|
12
|
+
name = 'Display Name Enforcement';
|
|
13
|
+
description = 'Key components should have meaningful display names';
|
|
14
|
+
severity = 'info';
|
|
15
|
+
category = 'documentation';
|
|
16
|
+
// Components that should have meaningful names, with their default names to flag
|
|
17
|
+
componentDefaults = [
|
|
18
|
+
{ element: 'set-payload', defaults: ['Set Payload', 'set-payload'] },
|
|
19
|
+
{ element: 'set-variable', defaults: ['Set Variable', 'set-variable'] },
|
|
20
|
+
{ element: 'transform', defaults: ['Transform Message', 'transform'] },
|
|
21
|
+
{ element: 'flow-ref', defaults: ['Flow Reference', 'flow-ref'] },
|
|
22
|
+
{ element: 'logger', defaults: ['Logger', 'logger'] },
|
|
23
|
+
{ element: 'choice', defaults: ['Choice', 'choice'] },
|
|
24
|
+
];
|
|
25
|
+
validate(doc, _context) {
|
|
26
|
+
const issues = [];
|
|
27
|
+
for (const component of this.componentDefaults) {
|
|
28
|
+
const elements = this.select(`//*[local-name()="${component.element}"]`, doc);
|
|
29
|
+
for (const element of elements) {
|
|
30
|
+
const docName = this.getDocName(element);
|
|
31
|
+
if (!docName) {
|
|
32
|
+
continue; // Missing doc:name is handled by MULE-604
|
|
33
|
+
}
|
|
34
|
+
// Check if using default name
|
|
35
|
+
if (component.defaults.some((d) => docName.toLowerCase() === d.toLowerCase())) {
|
|
36
|
+
issues.push(this.createIssue(element, `${component.element} has generic name "${docName}"`, {
|
|
37
|
+
suggestion: `Use a descriptive name explaining the purpose`,
|
|
38
|
+
}));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return issues;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.DisplayNameRule = DisplayNameRule;
|
|
46
|
+
//# sourceMappingURL=DisplayNameRule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DisplayNameRule.js","sourceRoot":"","sources":["../../../../src/rules/documentation/DisplayNameRule.ts"],"names":[],"mappings":";;;AACA,+CAA4C;AAE5C;;;;GAIG;AACH,MAAa,eAAgB,SAAQ,mBAAQ;IACzC,EAAE,GAAG,SAAS,CAAC;IACf,IAAI,GAAG,0BAA0B,CAAC;IAClC,WAAW,GAAG,qDAAqD,CAAC;IACpE,QAAQ,GAAG,MAAe,CAAC;IAC3B,QAAQ,GAAG,eAAwB,CAAC;IAEpC,iFAAiF;IACzE,iBAAiB,GAAG;QACxB,EAAE,OAAO,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AO,GAAG,EACpD;wBACI,UAAU,EAAE,+CAA+C;qBAC9D,CACJ,CACJ,CAAC;gBACN,CAAC;YACL,CAAC;QACL,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AA/CD,0CA+CC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/rules/index.ts"],"names":[],"mappings":"AACA,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/rules/index.ts"],"names":[],"mappings":"AACA,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AA4FnC,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAGhC,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAGrE,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAGjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAG7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,2BAA2B,EAAE,MAAM,uCAAuC,CAAC;AAGpF,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAG9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAGzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAGxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAE1E;;;GAGG;AACH,eAAO,MAAM,SAAS,EAAE,IAAI,EAoG3B,CAAC;AAEF;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,CAE3D;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAExD;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,MAAM,EAAE,CAExC"}
|
package/dist/src/rules/index.js
CHANGED
|
@@ -39,15 +39,21 @@ const InsecureTlsRule_1 = require("./security/InsecureTlsRule");
|
|
|
39
39
|
const TlsVersionRule_1 = require("./security/TlsVersionRule");
|
|
40
40
|
const RateLimitingRule_1 = require("./security/RateLimitingRule");
|
|
41
41
|
const InputValidationRule_1 = require("./security/InputValidationRule");
|
|
42
|
+
const EncryptionKeyInLogsRule_1 = require("./security/EncryptionKeyInLogsRule");
|
|
42
43
|
// Import all rules - Logging
|
|
43
44
|
const LoggerCategoryRule_1 = require("./logging/LoggerCategoryRule");
|
|
44
45
|
const LoggerPayloadRule_1 = require("./logging/LoggerPayloadRule");
|
|
45
46
|
const LoggerInUntilSuccessfulRule_1 = require("./logging/LoggerInUntilSuccessfulRule");
|
|
46
47
|
const NewLoggingRules_1 = require("./logging/NewLoggingRules");
|
|
48
|
+
const ExcessiveLoggersRule_1 = require("./logging/ExcessiveLoggersRule");
|
|
47
49
|
// Import all rules - Standards
|
|
48
50
|
const ChoiceAntiPatternRule_1 = require("./standards/ChoiceAntiPatternRule");
|
|
49
51
|
const DwlStandardsRule_1 = require("./standards/DwlStandardsRule");
|
|
50
52
|
const DeprecatedComponentRule_1 = require("./standards/DeprecatedComponentRule");
|
|
53
|
+
const AutoDiscoveryRule_1 = require("./standards/AutoDiscoveryRule");
|
|
54
|
+
const HttpPortPlaceholderRule_1 = require("./standards/HttpPortPlaceholderRule");
|
|
55
|
+
const CronExternalizedRule_1 = require("./standards/CronExternalizedRule");
|
|
56
|
+
const ApiKitValidationRule_1 = require("./standards/ApiKitValidationRule");
|
|
51
57
|
// Import all rules - HTTP
|
|
52
58
|
const HttpUserAgentRule_1 = require("./http/HttpUserAgentRule");
|
|
53
59
|
const HttpContentTypeRule_1 = require("./http/HttpContentTypeRule");
|
|
@@ -55,11 +61,13 @@ const HttpTimeoutRule_1 = require("./http/HttpTimeoutRule");
|
|
|
55
61
|
// Import all rules - Documentation
|
|
56
62
|
const FlowDescriptionRule_1 = require("./documentation/FlowDescriptionRule");
|
|
57
63
|
const MissingDocNameRule_1 = require("./documentation/MissingDocNameRule");
|
|
64
|
+
const DisplayNameRule_1 = require("./documentation/DisplayNameRule");
|
|
58
65
|
// Import all rules - Performance
|
|
59
66
|
const ScatterGatherRoutesRule_1 = require("./performance/ScatterGatherRoutesRule");
|
|
60
67
|
const AsyncErrorHandlerRule_1 = require("./performance/AsyncErrorHandlerRule");
|
|
61
68
|
const LargeChoiceBlockRule_1 = require("./performance/LargeChoiceBlockRule");
|
|
62
69
|
const ConnectionPoolingRule_1 = require("./performance/ConnectionPoolingRule");
|
|
70
|
+
const ReconnectionStrategyRule_1 = require("./performance/ReconnectionStrategyRule");
|
|
63
71
|
// Import all rules - Complexity
|
|
64
72
|
const FlowComplexityRule_1 = require("./complexity/FlowComplexityRule");
|
|
65
73
|
// Import all rules - YAML
|
|
@@ -74,8 +82,9 @@ const ApiLedRules_1 = require("./api-led/ApiLedRules");
|
|
|
74
82
|
const SingleSystemSapiRule_1 = require("./api-led/SingleSystemSapiRule");
|
|
75
83
|
// Import all rules - Experimental
|
|
76
84
|
const ExperimentalRules_1 = require("./experimental/ExperimentalRules");
|
|
77
|
-
// Import all rules - Operations &
|
|
78
|
-
const
|
|
85
|
+
// Import all rules - Operations & Hygiene
|
|
86
|
+
const CommentedCodeRule_1 = require("./operations/CommentedCodeRule");
|
|
87
|
+
const UnusedFlowRule_1 = require("./operations/UnusedFlowRule");
|
|
79
88
|
// Import all rules - Governance
|
|
80
89
|
const GovernanceRules_1 = require("./governance/GovernanceRules");
|
|
81
90
|
// Export individual rules - Error Handling
|
|
@@ -206,19 +215,19 @@ exports.ALL_RULES = [
|
|
|
206
215
|
new ExperimentalRules_1.ConnectorConfigNamingRule(),
|
|
207
216
|
new ExperimentalRules_1.MUnitCoverageRule(),
|
|
208
217
|
// Operations & Resilience Rules (RES-001, OPS-001, OPS-002, OPS-003)
|
|
209
|
-
new
|
|
210
|
-
new
|
|
211
|
-
new
|
|
212
|
-
new
|
|
218
|
+
new ReconnectionStrategyRule_1.ReconnectionStrategyRule(),
|
|
219
|
+
new AutoDiscoveryRule_1.AutoDiscoveryRule(),
|
|
220
|
+
new HttpPortPlaceholderRule_1.HttpPortPlaceholderRule(),
|
|
221
|
+
new CronExternalizedRule_1.CronExternalizedRule(),
|
|
213
222
|
// Security Enhancement (SEC-006)
|
|
214
|
-
new
|
|
223
|
+
new EncryptionKeyInLogsRule_1.EncryptionKeyInLogsRule(),
|
|
215
224
|
// Code Hygiene Rules (HYG-001, HYG-002, HYG-003)
|
|
216
|
-
new
|
|
217
|
-
new
|
|
218
|
-
new
|
|
225
|
+
new ExcessiveLoggersRule_1.ExcessiveLoggersRule(),
|
|
226
|
+
new CommentedCodeRule_1.CommentedCodeRule(),
|
|
227
|
+
new UnusedFlowRule_1.UnusedFlowRule(),
|
|
219
228
|
// Additional Standards (API-005, DOC-001)
|
|
220
|
-
new
|
|
221
|
-
new
|
|
229
|
+
new ApiKitValidationRule_1.ApiKitValidationRule(),
|
|
230
|
+
new DisplayNameRule_1.DisplayNameRule(),
|
|
222
231
|
// Governance Rules (PROJ-001, PROJ-002)
|
|
223
232
|
new GovernanceRules_1.PomValidationRule(),
|
|
224
233
|
new GovernanceRules_1.GitHygieneRule(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/rules/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/rules/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAsPA,gDAEC;AAKD,kCAEC;AAKD,sCAEC;AAtQD,oBAAoB;AACpB,kDAAgC;AAChC,qDAAmC;AAEnC,oCAAoC;AACpC,oFAAiF;AACjF,sFAAmF;AACnF,oEAAiE;AACjE,0EAAuE;AACvE,wEAAqE;AACrE,gEAA6D;AAE7D,4BAA4B;AAC5B,4DAAyD;AACzD,4DAAyD;AACzD,oEAAiE;AAEjE,8BAA8B;AAC9B,oEAAiE;AACjE,kFAA+E;AAC/E,gEAA6D;AAC7D,8DAA2D;AAC3D,kEAA+D;AAC/D,wEAAqE;AACrE,gFAA6E;AAE7E,6BAA6B;AAC7B,qEAAkE;AAClE,mEAAgE;AAChE,uFAAoF;AACpF,+DAA4F;AAC5F,yEAAsE;AAEtE,+BAA+B;AAC/B,6EAA0E;AAC1E,mEAAgE;AAChE,iFAA8E;AAC9E,qEAAkE;AAClE,iFAA8E;AAC9E,2EAAwE;AACxE,2EAAwE;AA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iCAAe,EAAE;IAErB,wCAAwC;IACxC,IAAI,mCAAiB,EAAE;IACvB,IAAI,gCAAc,EAAE;CACvB,CAAC;AAEF;;GAEG;AACH,SAAgB,kBAAkB,CAAC,QAAgB;IAC/C,OAAO,iBAAS,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC;AAClE,CAAC;AAED;;GAEG;AACH,SAAgB,WAAW,CAAC,EAAU;IAClC,OAAO,iBAAS,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AACpD,CAAC;AAED;;GAEG;AACH,SAAgB,aAAa;IACzB,OAAO,iBAAS,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ValidationContext, Issue } from '../../types';
|
|
2
|
+
import { BaseRule } from '../base/BaseRule';
|
|
3
|
+
/**
|
|
4
|
+
* HYG-001: Excessive Loggers
|
|
5
|
+
*
|
|
6
|
+
* Flows should not have too many loggers which can impact performance.
|
|
7
|
+
*/
|
|
8
|
+
export declare class ExcessiveLoggersRule extends BaseRule {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
description: string;
|
|
12
|
+
severity: "warning";
|
|
13
|
+
category: "logging";
|
|
14
|
+
validate(doc: Document, context: ValidationContext): Issue[];
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=ExcessiveLoggersRule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExcessiveLoggersRule.d.ts","sourceRoot":"","sources":["../../../../src/rules/logging/ExcessiveLoggersRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;;;GAIG;AACH,qBAAa,oBAAqB,SAAQ,QAAQ;IAC9C,EAAE,SAAa;IACf,IAAI,SAAuB;IAC3B,WAAW,SAA6C;IACxD,QAAQ,EAAG,SAAS,CAAU;IAC9B,QAAQ,EAAG,SAAS,CAAU;IAE9B,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,iBAAiB,GAAG,KAAK,EAAE;CAiD/D"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExcessiveLoggersRule = void 0;
|
|
4
|
+
const BaseRule_1 = require("../base/BaseRule");
|
|
5
|
+
/**
|
|
6
|
+
* HYG-001: Excessive Loggers
|
|
7
|
+
*
|
|
8
|
+
* Flows should not have too many loggers which can impact performance.
|
|
9
|
+
*/
|
|
10
|
+
class ExcessiveLoggersRule extends BaseRule_1.BaseRule {
|
|
11
|
+
id = 'HYG-001';
|
|
12
|
+
name = 'Excessive Loggers';
|
|
13
|
+
description = 'Flows should not have excessive loggers';
|
|
14
|
+
severity = 'warning';
|
|
15
|
+
category = 'logging';
|
|
16
|
+
validate(doc, context) {
|
|
17
|
+
const issues = [];
|
|
18
|
+
const maxLoggers = this.getOption(context, 'maxLoggers', 5);
|
|
19
|
+
// Check flows
|
|
20
|
+
const flows = this.select('//*[local-name()="flow"]', doc);
|
|
21
|
+
for (const flow of flows) {
|
|
22
|
+
const flowName = this.getNameAttribute(flow) ?? 'unknown';
|
|
23
|
+
const loggerCount = this.count('.//*[local-name()="logger"]', flow);
|
|
24
|
+
if (loggerCount > maxLoggers) {
|
|
25
|
+
issues.push(this.createIssue(flow, `Flow "${flowName}" has ${loggerCount} loggers (max recommended: ${maxLoggers})`, {
|
|
26
|
+
suggestion: 'Consider reducing loggers or moving detailed logging to DEBUG level',
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
// Check sub-flows
|
|
31
|
+
const subflows = this.select('//*[local-name()="sub-flow"]', doc);
|
|
32
|
+
for (const subflow of subflows) {
|
|
33
|
+
const subflowName = this.getNameAttribute(subflow) ?? 'unknown';
|
|
34
|
+
const loggerCount = this.count('.//*[local-name()="logger"]', subflow);
|
|
35
|
+
if (loggerCount > maxLoggers) {
|
|
36
|
+
issues.push(this.createIssue(subflow, `Sub-flow "${subflowName}" has ${loggerCount} loggers (max recommended: ${maxLoggers})`, {
|
|
37
|
+
suggestion: 'Consider reducing loggers or moving detailed logging to DEBUG level',
|
|
38
|
+
}));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return issues;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.ExcessiveLoggersRule = ExcessiveLoggersRule;
|
|
45
|
+
//# sourceMappingURL=ExcessiveLoggersRule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExcessiveLoggersRule.js","sourceRoot":"","sources":["../../../../src/rules/logging/ExcessiveLoggersRule.ts"],"names":[],"mappings":";;;AACA,+CAA4C;AAE5C;;;;GAIG;AACH,MAAa,oBAAqB,SAAQ,mBAAQ;IAC9C,EAAE,GAAG,SAAS,CAAC;IACf,IAAI,GAAG,mBAAmB,CAAC;IAC3B,WAAW,GAAG,yCAAyC,CAAC;IACxD,QAAQ,GAAG,SAAkB,CAAC;IAC9B,QAAQ,GAAG,SAAkB,CAAC;IAE9B,QAAQ,CAAC,GAAa,EAAE,OAA0B;QAC9C,MAAM,MAAM,GAAY,EAAE,CAAC;QAE3B,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAS,OAAO,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC;QAEpE,cAAc;QACd,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,0BAA0B,EAAE,GAAG,CAAC,CAAC;QAE3D,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACvB,MAAM,QAAQ,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,SAAS,CAAC;YAC1D,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,6BAA6B,EAAE,IAAI,CAAC,CAAC;YAEpE,IAAI,WAAW,GAAG,UAAU,EAAE,CAAC;gBAC3B,MAAM,CAAC,IAAI,CACP,IAAI,CAAC,WAAW,CACZ,IAAI,EACJ,SAAS,QAAQ,SAAS,WAAW,8BAA8B,UAAU,GAAG,EAChF;oBACI,UAAU,EACN,qEAAqE;iBAC5E,CACJ,CACJ,CAAC;YACN,CAAC;QACL,CAAC;QAED,kBAAkB;QAClB,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,8BAA8B,EAAE,GAAG,CAAC,CAAC;QAElE,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAC7B,MAAM,WAAW,GAAG,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,IAAI,SAAS,CAAC;YAChE,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,6BAA6B,EAAE,OAAO,CAAC,CAAC;YAEvE,IAAI,WAAW,GAAG,UAAU,EAAE,CAAC;gBAC3B,MAAM,CAAC,IAAI,CACP,IAAI,CAAC,WAAW,CACZ,OAAO,EACP,aAAa,WAAW,SAAS,WAAW,8BAA8B,UAAU,GAAG,EACvF;oBACI,UAAU,EACN,qEAAqE;iBAC5E,CACJ,CACJ,CAAC;YACN,CAAC;QACL,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AAxDD,oDAwDC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ValidationContext, Issue } from '../../types';
|
|
2
|
+
import { BaseRule } from '../base/BaseRule';
|
|
3
|
+
/**
|
|
4
|
+
* HYG-002: Commented Code Detection
|
|
5
|
+
*
|
|
6
|
+
* Detects potentially commented-out code blocks in Mule configurations.
|
|
7
|
+
*/
|
|
8
|
+
export declare class CommentedCodeRule extends BaseRule {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
description: string;
|
|
12
|
+
severity: "info";
|
|
13
|
+
category: "standards";
|
|
14
|
+
private codePatterns;
|
|
15
|
+
validate(doc: Document, _context: ValidationContext): Issue[];
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=CommentedCodeRule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommentedCodeRule.d.ts","sourceRoot":"","sources":["../../../../src/rules/operations/CommentedCodeRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;;;GAIG;AACH,qBAAa,iBAAkB,SAAQ,QAAQ;IAC3C,EAAE,SAAa;IACf,IAAI,SAA8B;IAClC,WAAW,SAA8D;IACzE,QAAQ,EAAG,MAAM,CAAU;IAC3B,QAAQ,EAAG,WAAW,CAAU;IAGhC,OAAO,CAAC,YAAY,CAYlB;IAEF,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,GAAG,KAAK,EAAE;CAgChE"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CommentedCodeRule = void 0;
|
|
4
|
+
const BaseRule_1 = require("../base/BaseRule");
|
|
5
|
+
/**
|
|
6
|
+
* HYG-002: Commented Code Detection
|
|
7
|
+
*
|
|
8
|
+
* Detects potentially commented-out code blocks in Mule configurations.
|
|
9
|
+
*/
|
|
10
|
+
class CommentedCodeRule extends BaseRule_1.BaseRule {
|
|
11
|
+
id = 'HYG-002';
|
|
12
|
+
name = 'Commented Code Detection';
|
|
13
|
+
description = 'Detects potentially commented-out code in configurations';
|
|
14
|
+
severity = 'info';
|
|
15
|
+
category = 'standards';
|
|
16
|
+
// Patterns that suggest commented-out XML code
|
|
17
|
+
codePatterns = [
|
|
18
|
+
/<flow\s/,
|
|
19
|
+
/<sub-flow\s/,
|
|
20
|
+
/<http:/,
|
|
21
|
+
/<logger\s/,
|
|
22
|
+
/<set-variable\s/,
|
|
23
|
+
/<set-payload\s/,
|
|
24
|
+
/<choice>/,
|
|
25
|
+
/<transform\s/,
|
|
26
|
+
/<flow-ref\s/,
|
|
27
|
+
/<try>/,
|
|
28
|
+
/<db:/,
|
|
29
|
+
];
|
|
30
|
+
validate(doc, _context) {
|
|
31
|
+
const issues = [];
|
|
32
|
+
// Use XPath to find comment nodes: comment()
|
|
33
|
+
// Note: In xmldom, we need to iterate through the document differently
|
|
34
|
+
try {
|
|
35
|
+
const commentNodes = this.select('//comment()', doc);
|
|
36
|
+
for (const commentNode of commentNodes) {
|
|
37
|
+
const commentText = commentNode.textContent ?? '';
|
|
38
|
+
// Check if comment contains code-like patterns
|
|
39
|
+
for (const pattern of this.codePatterns) {
|
|
40
|
+
if (pattern.test(commentText)) {
|
|
41
|
+
issues.push(this.createIssue(commentNode, 'Commented-out code detected', {
|
|
42
|
+
suggestion: 'Remove commented code or convert to documentation comment',
|
|
43
|
+
codeSnippet: commentText.substring(0, 80) + '...',
|
|
44
|
+
}));
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
// XPath comment() may not be supported in all parsers
|
|
52
|
+
// Silently return empty issues
|
|
53
|
+
}
|
|
54
|
+
return issues;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.CommentedCodeRule = CommentedCodeRule;
|
|
58
|
+
//# sourceMappingURL=CommentedCodeRule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommentedCodeRule.js","sourceRoot":"","sources":["../../../../src/rules/operations/CommentedCodeRule.ts"],"names":[],"mappings":";;;AACA,+CAA4C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 -0,0 +1,17 @@
|
|
|
1
|
+
import { ValidationContext, Issue } from '../../types';
|
|
2
|
+
import { BaseRule } from '../base/BaseRule';
|
|
3
|
+
/**
|
|
4
|
+
* HYG-003: Unused Flow Detection
|
|
5
|
+
*
|
|
6
|
+
* Detects flows that are never referenced by flow-ref.
|
|
7
|
+
*/
|
|
8
|
+
export declare class UnusedFlowRule extends BaseRule {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
description: string;
|
|
12
|
+
severity: "warning";
|
|
13
|
+
category: "standards";
|
|
14
|
+
validate(doc: Document, _context: ValidationContext): Issue[];
|
|
15
|
+
private isExternallyReferenced;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=UnusedFlowRule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnusedFlowRule.d.ts","sourceRoot":"","sources":["../../../../src/rules/operations/UnusedFlowRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;;;GAIG;AACH,qBAAa,cAAe,SAAQ,QAAQ;IACxC,EAAE,SAAa;IACf,IAAI,SAA2B;IAC/B,WAAW,SAA6C;IACxD,QAAQ,EAAG,SAAS,CAAU;IAC9B,QAAQ,EAAG,WAAW,CAAU;IAEhC,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,GAAG,KAAK,EAAE;IA2E7D,OAAO,CAAC,sBAAsB;CAYjC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UnusedFlowRule = void 0;
|
|
4
|
+
const BaseRule_1 = require("../base/BaseRule");
|
|
5
|
+
/**
|
|
6
|
+
* HYG-003: Unused Flow Detection
|
|
7
|
+
*
|
|
8
|
+
* Detects flows that are never referenced by flow-ref.
|
|
9
|
+
*/
|
|
10
|
+
class UnusedFlowRule extends BaseRule_1.BaseRule {
|
|
11
|
+
id = 'HYG-003';
|
|
12
|
+
name = 'Unused Flow Detection';
|
|
13
|
+
description = 'Detects flows that are never referenced';
|
|
14
|
+
severity = 'warning';
|
|
15
|
+
category = 'standards';
|
|
16
|
+
validate(doc, _context) {
|
|
17
|
+
const issues = [];
|
|
18
|
+
// Get all flow names in this document
|
|
19
|
+
const flows = this.select('//*[local-name()="flow"]', doc);
|
|
20
|
+
const subflows = this.select('//*[local-name()="sub-flow"]', doc);
|
|
21
|
+
// Get all flow-ref targets
|
|
22
|
+
const flowRefs = this.select('//*[local-name()="flow-ref"]', doc);
|
|
23
|
+
const referencedFlows = new Set();
|
|
24
|
+
for (const ref of flowRefs) {
|
|
25
|
+
const name = this.getNameAttribute(ref);
|
|
26
|
+
if (name) {
|
|
27
|
+
referencedFlows.add(name);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
// Check sub-flows (they should always be referenced)
|
|
31
|
+
for (const subflow of subflows) {
|
|
32
|
+
const name = this.getNameAttribute(subflow);
|
|
33
|
+
if (name && !referencedFlows.has(name)) {
|
|
34
|
+
// Exclude common patterns that are referenced externally
|
|
35
|
+
if (!this.isExternallyReferenced(name)) {
|
|
36
|
+
issues.push(this.createIssue(subflow, `Sub-flow "${name}" is never referenced within this file`, {
|
|
37
|
+
severity: 'info',
|
|
38
|
+
suggestion: 'Consider removing unused sub-flows or verify cross-file references',
|
|
39
|
+
}));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
// Check private flows (not triggered by HTTP/scheduler)
|
|
44
|
+
for (const flow of flows) {
|
|
45
|
+
const name = this.getNameAttribute(flow);
|
|
46
|
+
if (!name) {
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
// Skip if it has an external trigger
|
|
50
|
+
const hasHttpListener = this.exists('.//*[local-name()="listener"]', flow);
|
|
51
|
+
const hasScheduler = this.exists('.//*[local-name()="scheduler"]', flow);
|
|
52
|
+
const hasVmListener = this.exists('.//*[local-name()="listener" and contains(@config-ref, "vm")]', flow);
|
|
53
|
+
if (hasHttpListener || hasScheduler || hasVmListener) {
|
|
54
|
+
continue; // Entry point flow
|
|
55
|
+
}
|
|
56
|
+
// Check if referenced
|
|
57
|
+
if (!referencedFlows.has(name) && !this.isExternallyReferenced(name)) {
|
|
58
|
+
issues.push(this.createIssue(flow, `Flow "${name}" has no trigger and is never referenced`, {
|
|
59
|
+
severity: 'info',
|
|
60
|
+
suggestion: 'Verify this flow is referenced from other files or remove if unused',
|
|
61
|
+
}));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return issues;
|
|
65
|
+
}
|
|
66
|
+
isExternallyReferenced(name) {
|
|
67
|
+
// Common patterns that are typically referenced externally
|
|
68
|
+
const externalPatterns = [
|
|
69
|
+
/-main$/,
|
|
70
|
+
/-api$/,
|
|
71
|
+
/^api-/,
|
|
72
|
+
/-console$/,
|
|
73
|
+
/-error-handler$/,
|
|
74
|
+
/global/i,
|
|
75
|
+
];
|
|
76
|
+
return externalPatterns.some((pattern) => pattern.test(name));
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
exports.UnusedFlowRule = UnusedFlowRule;
|
|
80
|
+
//# sourceMappingURL=UnusedFlowRule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnusedFlowRule.js","sourceRoot":"","sources":["../../../../src/rules/operations/UnusedFlowRule.ts"],"names":[],"mappings":";;;AACA,+CAA4C;AAE5C;;;;GAIG;AACH,MAAa,cAAe,SAAQ,mBAAQ;IACxC,EAAE,GAAG,SAAS,CAAC;IACf,IAAI,GAAG,uBAAuB,CAAC;IAC/B,WAAW,GAAG,yCAAyC,CAAC;IACxD,QAAQ,GAAG,SAAkB,CAAC;IAC9B,QAAQ,GAAG,WAAoB,CAAC;IAEhC,QAAQ,CAAC,GAAa,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,IAAI,CAAC,IAAI,EAAE,CAAC;gBAAC,SAAS;YAAC,CAAC;YAExB,qCAAqC;YACrC,MAAM,eAAe,GAAG,IAAI,CAAC,MAAM,CAAC,+BAA+B,EAAE,IAAI,CAAC,CAAC;YAC3E,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,gCAAgC,EAAE,IAAI,CAAC,CAAC;YACzE,MAAM,aAAa,GAAG,IAAI,CAAC,MAAM,CAC7B,+DAA+D,EAC/D,IAAI,CACP,CAAC;YAEF,IAAI,eAAe,IAAI,YAAY,IAAI,aAAa,EAAE,CAAC;gBACnD,SAAS,CAAC,mBAAmB;YACjC,CAAC;YAED,sBAAsB;YACtB,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,EAAE,CAAC;gBACnE,MAAM,CAAC,IAAI,CACP,IAAI,CAAC,WAAW,CACZ,IAAI,EACJ,SAAS,IAAI,0CAA0C,EACvD;oBACI,QAAQ,EAAE,MAAM;oBAChB,UAAU,EACN,qEAAqE;iBAC5E,CACJ,CACJ,CAAC;YACN,CAAC;QACL,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;IAEO,sBAAsB,CAAC,IAAY;QACvC,2DAA2D;QAC3D,MAAM,gBAAgB,GAAG;YACrB,QAAQ;YACR,OAAO;YACP,OAAO;YACP,WAAW;YACX,iBAAiB;YACjB,SAAS;SACZ,CAAC;QACF,OAAO,gBAAgB,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAClE,CAAC;CACJ;AA9FD,wCA8FC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ValidationContext, Issue } from '../../types';
|
|
2
|
+
import { BaseRule } from '../base/BaseRule';
|
|
3
|
+
/**
|
|
4
|
+
* RES-001: Reconnection Strategy
|
|
5
|
+
*
|
|
6
|
+
* Connectors should have reconnection strategies configured for resilience.
|
|
7
|
+
*/
|
|
8
|
+
export declare class ReconnectionStrategyRule extends BaseRule {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
description: string;
|
|
12
|
+
severity: "warning";
|
|
13
|
+
category: "performance";
|
|
14
|
+
validate(doc: Document, _context: ValidationContext): Issue[];
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=ReconnectionStrategyRule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReconnectionStrategyRule.d.ts","sourceRoot":"","sources":["../../../../src/rules/performance/ReconnectionStrategyRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;;;GAIG;AACH,qBAAa,wBAAyB,SAAQ,QAAQ;IAClD,EAAE,SAAa;IACf,IAAI,SAA2B;IAC/B,WAAW,SAA+D;IAC1E,QAAQ,EAAG,SAAS,CAAU;IAC9B,QAAQ,EAAG,aAAa,CAAU;IAElC,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,GAAG,KAAK,EAAE;CAmEhE"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReconnectionStrategyRule = void 0;
|
|
4
|
+
const BaseRule_1 = require("../base/BaseRule");
|
|
5
|
+
/**
|
|
6
|
+
* RES-001: Reconnection Strategy
|
|
7
|
+
*
|
|
8
|
+
* Connectors should have reconnection strategies configured for resilience.
|
|
9
|
+
*/
|
|
10
|
+
class ReconnectionStrategyRule extends BaseRule_1.BaseRule {
|
|
11
|
+
id = 'RES-001';
|
|
12
|
+
name = 'Reconnection Strategy';
|
|
13
|
+
description = 'Connectors should have reconnection strategies configured';
|
|
14
|
+
severity = 'warning';
|
|
15
|
+
category = 'performance';
|
|
16
|
+
validate(doc, _context) {
|
|
17
|
+
const issues = [];
|
|
18
|
+
// Specific connector configurations that benefit from reconnection strategies
|
|
19
|
+
// Using more specific patterns to avoid false positives on generic "config" elements
|
|
20
|
+
const connectorConfigs = [
|
|
21
|
+
{ pattern: 'request-config', name: 'HTTP Request' },
|
|
22
|
+
{ pattern: 'listener-config', name: 'HTTP Listener' },
|
|
23
|
+
{ pattern: 'jms-config', name: 'JMS' },
|
|
24
|
+
{ pattern: 'amqp-config', name: 'AMQP' },
|
|
25
|
+
{ pattern: 'sftp-config', name: 'SFTP' },
|
|
26
|
+
{ pattern: 'ftp-config', name: 'FTP' },
|
|
27
|
+
{ pattern: 'vm-config', name: 'VM' },
|
|
28
|
+
];
|
|
29
|
+
for (const connector of connectorConfigs) {
|
|
30
|
+
const configs = this.select(`//*[local-name()="${connector.pattern}"]`, doc);
|
|
31
|
+
for (const config of configs) {
|
|
32
|
+
// Check for reconnection or reconnect child elements
|
|
33
|
+
const hasReconnection = this.exists('.//*[local-name()="reconnection"]', config) ||
|
|
34
|
+
this.exists('.//*[local-name()="reconnect"]', config) ||
|
|
35
|
+
this.exists('.//*[local-name()="reconnect-forever"]', config);
|
|
36
|
+
if (!hasReconnection) {
|
|
37
|
+
const name = this.getNameAttribute(config) ?? connector.name;
|
|
38
|
+
issues.push(this.createIssue(config, `${connector.name} config "${name}" has no reconnection strategy`, {
|
|
39
|
+
suggestion: 'Add <reconnection> or <reconnect-forever> for resilience',
|
|
40
|
+
}));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
// Database configs specifically - check for db namespace
|
|
45
|
+
const dbConfigs = this.select('//*[local-name()="config" and starts-with(name(), "db:")]', doc);
|
|
46
|
+
for (const config of dbConfigs) {
|
|
47
|
+
const hasReconnection = this.exists('.//*[local-name()="reconnection"]', config) ||
|
|
48
|
+
this.exists('.//*[local-name()="reconnect"]', config);
|
|
49
|
+
if (!hasReconnection) {
|
|
50
|
+
const name = this.getNameAttribute(config) ?? 'Database';
|
|
51
|
+
issues.push(this.createIssue(config, `Database config "${name}" has no reconnection strategy`, {
|
|
52
|
+
suggestion: 'Add <reconnection> inside the connection element',
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return issues;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.ReconnectionStrategyRule = ReconnectionStrategyRule;
|
|
60
|
+
//# sourceMappingURL=ReconnectionStrategyRule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReconnectionStrategyRule.js","sourceRoot":"","sources":["../../../../src/rules/performance/ReconnectionStrategyRule.ts"],"names":[],"mappings":";;;AACA,+CAA4C;AAE5C;;;;GAIG;AACH,MAAa,wBAAyB,SAAQ,mBAAQ;IAClD,EAAE,GAAG,SAAS,CAAC;IACf,IAAI,GAAG,uBAAuB,CAAC;IAC/B,WAAW,GAAG,2DAA2D,CAAC;IAC1E,QAAQ,GAAG,SAAkB,CAAC;IAC9B,QAAQ,GAAG,aAAsB,CAAC;IAElC,QAAQ,CAAC,GAAa,EAAE,QAA2B;QAC/C,MAAM,MAAM,GAAY,EAAE,CAAC;QAE3B,8EAA8E;QAC9E,qFAAqF;QACrF,MAAM,gBAAgB,GAAG;YACrB,EAAE,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,cAAc,EAAE;YACnD,EAAE,OAAO,EAAE,iBAAiB,EAAE,IAAI,EAAE,eAAe,EAAE;YACrD,EAAE,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,KAAK,EAAE;YACtC,EAAE,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE;YACxC,EAAE,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE;YACxC,EAAE,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,KAAK,EAAE;YACtC,EAAE,OAAO,EAAE,WAA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AAC,WAAW,CACZ,MAAM,EACN,oBAAoB,IAAI,gCAAgC,EACxD;oBACI,UAAU,EAAE,kDAAkD;iBACjE,CACJ,CACJ,CAAC;YACN,CAAC;QACL,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AA1ED,4DA0EC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ValidationContext, Issue } from '../../types';
|
|
2
|
+
import { BaseRule } from '../base/BaseRule';
|
|
3
|
+
/**
|
|
4
|
+
* SEC-006: Encryption Key in Logs
|
|
5
|
+
*
|
|
6
|
+
* Encryption keys and sensitive credentials should not appear in log statements.
|
|
7
|
+
*/
|
|
8
|
+
export declare class EncryptionKeyInLogsRule extends BaseRule {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
description: string;
|
|
12
|
+
severity: "error";
|
|
13
|
+
category: "security";
|
|
14
|
+
private sensitivePatterns;
|
|
15
|
+
validate(doc: Document, _context: ValidationContext): Issue[];
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=EncryptionKeyInLogsRule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EncryptionKeyInLogsRule.d.ts","sourceRoot":"","sources":["../../../../src/rules/security/EncryptionKeyInLogsRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;;;GAIG;AACH,qBAAa,uBAAwB,SAAQ,QAAQ;IACjD,EAAE,SAAa;IACf,IAAI,SAA4B;IAChC,WAAW,SAAkE;IAC7E,QAAQ,EAAG,OAAO,CAAU;IAC5B,QAAQ,EAAG,UAAU,CAAU;IAE/B,OAAO,CAAC,iBAAiB,CASvB;IAEF,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,GAAG,KAAK,EAAE;CA6BhE"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EncryptionKeyInLogsRule = void 0;
|
|
4
|
+
const BaseRule_1 = require("../base/BaseRule");
|
|
5
|
+
/**
|
|
6
|
+
* SEC-006: Encryption Key in Logs
|
|
7
|
+
*
|
|
8
|
+
* Encryption keys and sensitive credentials should not appear in log statements.
|
|
9
|
+
*/
|
|
10
|
+
class EncryptionKeyInLogsRule extends BaseRule_1.BaseRule {
|
|
11
|
+
id = 'SEC-006';
|
|
12
|
+
name = 'Encryption Key in Logs';
|
|
13
|
+
description = 'Encryption keys and sensitive data should not appear in logs';
|
|
14
|
+
severity = 'error';
|
|
15
|
+
category = 'security';
|
|
16
|
+
sensitivePatterns = [
|
|
17
|
+
/encrypt.*key/i,
|
|
18
|
+
/decryption.*key/i,
|
|
19
|
+
/secret.*key/i,
|
|
20
|
+
/api[_-]?key/i,
|
|
21
|
+
/password/i,
|
|
22
|
+
/credentials?/i,
|
|
23
|
+
/mule\.key/i,
|
|
24
|
+
/secure::.*key/i,
|
|
25
|
+
];
|
|
26
|
+
validate(doc, _context) {
|
|
27
|
+
const issues = [];
|
|
28
|
+
// Find all loggers
|
|
29
|
+
const loggers = this.select('//*[local-name()="logger"]', doc);
|
|
30
|
+
for (const logger of loggers) {
|
|
31
|
+
const message = this.getAttribute(logger, 'message') ?? '';
|
|
32
|
+
// Check for sensitive patterns in log messages
|
|
33
|
+
for (const pattern of this.sensitivePatterns) {
|
|
34
|
+
if (pattern.test(message)) {
|
|
35
|
+
issues.push(this.createIssue(logger, `Logger may expose sensitive data: "${message.substring(0, 50)}${message.length > 50 ? '...' : ''}"`, {
|
|
36
|
+
suggestion: 'Remove encryption keys and sensitive data from log messages',
|
|
37
|
+
}));
|
|
38
|
+
break; // Only one issue per logger
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return issues;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.EncryptionKeyInLogsRule = EncryptionKeyInLogsRule;
|
|
46
|
+
//# sourceMappingURL=EncryptionKeyInLogsRule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EncryptionKeyInLogsRule.js","sourceRoot":"","sources":["../../../../src/rules/security/EncryptionKeyInLogsRule.ts"],"names":[],"mappings":";;;AACA,+CAA4C;AAE5C;;;;GAIG;AACH,MAAa,uBAAwB,SAAQ,mBAAQ;IACjD,EAAE,GAAG,SAAS,CAAC;IACf,IAAI,GAAG,wBAAwB,CAAC;IAChC,WAAW,GAAG,8DAA8D,CAAC;IAC7E,QAAQ,GAAG,OAAgB,CAAC;IAC5B,QAAQ,GAAG,UAAmB,CAAC;IAEvB,iBAAiB,GAAG;QACxB,eAAe;QACf,kBAAkB;QAClB,cAAc;QACd,cAAc;QACd,WAAW;QACX,eAAe;QACf,YAAY;QACZ,gBAAgB;KACnB,CAAC;IAEF,QAAQ,CAAC,GAAa,EAAE,QAA2B;QAC/C,MAAM,MAAM,GAAY,EAAE,CAAC;QAE3B,mBAAmB;QACnB,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,4BAA4B,EAAE,GAAG,CAAC,CAAC;QAE/D,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC3B,MAAM,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,SAAS,CAAC,IAAI,EAAE,CAAC;YAE3D,+CAA+C;YAC/C,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,iBAAiB,EAAE,CAAC;gBAC3C,IAAI,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;oBACxB,MAAM,CAAC,IAAI,CACP,IAAI,CAAC,WAAW,CACZ,MAAM,EACN,sCAAsC,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,GAAG,EAAE,CAAC,CAA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