@sfdxy/mule-lint 1.20.0 → 1.22.0
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/README.md +63 -17
- package/dist/package.json +1 -1
- package/dist/src/core/XPathHelper.d.ts.map +1 -1
- package/dist/src/core/XPathHelper.js +8 -0
- package/dist/src/core/XPathHelper.js.map +1 -1
- package/dist/src/engine/LintEngine.d.ts +22 -0
- package/dist/src/engine/LintEngine.d.ts.map +1 -1
- package/dist/src/engine/LintEngine.js +105 -18
- package/dist/src/engine/LintEngine.js.map +1 -1
- package/dist/src/mcp/prompts/index.d.ts +1 -1
- package/dist/src/mcp/prompts/index.d.ts.map +1 -1
- package/dist/src/mcp/prompts/index.js +62 -1
- package/dist/src/mcp/prompts/index.js.map +1 -1
- package/dist/src/mcp/resources/index.js +114 -16
- package/dist/src/mcp/resources/index.js.map +1 -1
- package/dist/src/mcp/tools/getRuleDetails.d.ts.map +1 -1
- package/dist/src/mcp/tools/getRuleDetails.js +30 -1
- package/dist/src/mcp/tools/getRuleDetails.js.map +1 -1
- package/dist/src/rules/api-led/ApikitConsoleProductionRule.d.ts +22 -0
- package/dist/src/rules/api-led/ApikitConsoleProductionRule.d.ts.map +1 -0
- package/dist/src/rules/api-led/ApikitConsoleProductionRule.js +43 -0
- package/dist/src/rules/api-led/ApikitConsoleProductionRule.js.map +1 -0
- package/dist/src/rules/api-led/ApikitMainFlowStructureRule.d.ts +24 -0
- package/dist/src/rules/api-led/ApikitMainFlowStructureRule.d.ts.map +1 -0
- package/dist/src/rules/api-led/ApikitMainFlowStructureRule.js +53 -0
- package/dist/src/rules/api-led/ApikitMainFlowStructureRule.js.map +1 -0
- package/dist/src/rules/api-led/ApikitStatusCodeVariableRule.d.ts +25 -0
- package/dist/src/rules/api-led/ApikitStatusCodeVariableRule.d.ts.map +1 -0
- package/dist/src/rules/api-led/ApikitStatusCodeVariableRule.js +59 -0
- package/dist/src/rules/api-led/ApikitStatusCodeVariableRule.js.map +1 -0
- package/dist/src/rules/connector/EventListenerNullGuardRule.d.ts +24 -0
- package/dist/src/rules/connector/EventListenerNullGuardRule.d.ts.map +1 -0
- package/dist/src/rules/connector/EventListenerNullGuardRule.js +58 -0
- package/dist/src/rules/connector/EventListenerNullGuardRule.js.map +1 -0
- package/dist/src/rules/connector/ReplayChannelConfigRule.d.ts +23 -0
- package/dist/src/rules/connector/ReplayChannelConfigRule.d.ts.map +1 -0
- package/dist/src/rules/connector/ReplayChannelConfigRule.js +52 -0
- package/dist/src/rules/connector/ReplayChannelConfigRule.js.map +1 -0
- package/dist/src/rules/dataweave/DataWeaveRules.d.ts +11 -4
- package/dist/src/rules/dataweave/DataWeaveRules.d.ts.map +1 -1
- package/dist/src/rules/dataweave/DataWeaveRules.js +20 -20
- package/dist/src/rules/dataweave/DataWeaveRules.js.map +1 -1
- package/dist/src/rules/dataweave/DuplicateTransformLogicRule.d.ts +25 -0
- package/dist/src/rules/dataweave/DuplicateTransformLogicRule.d.ts.map +1 -0
- package/dist/src/rules/dataweave/DuplicateTransformLogicRule.js +63 -0
- package/dist/src/rules/dataweave/DuplicateTransformLogicRule.js.map +1 -0
- package/dist/src/rules/error-handling/CatchAllLastRule.d.ts +24 -0
- package/dist/src/rules/error-handling/CatchAllLastRule.d.ts.map +1 -0
- package/dist/src/rules/error-handling/CatchAllLastRule.js +65 -0
- package/dist/src/rules/error-handling/CatchAllLastRule.js.map +1 -0
- package/dist/src/rules/error-handling/ErrorHandlerTypeCoverageRule.d.ts +28 -0
- package/dist/src/rules/error-handling/ErrorHandlerTypeCoverageRule.d.ts.map +1 -0
- package/dist/src/rules/error-handling/ErrorHandlerTypeCoverageRule.js +70 -0
- package/dist/src/rules/error-handling/ErrorHandlerTypeCoverageRule.js.map +1 -0
- package/dist/src/rules/error-handling/ErrorResponseStructureRule.d.ts +23 -0
- package/dist/src/rules/error-handling/ErrorResponseStructureRule.d.ts.map +1 -0
- package/dist/src/rules/error-handling/ErrorResponseStructureRule.js +73 -0
- package/dist/src/rules/error-handling/ErrorResponseStructureRule.js.map +1 -0
- package/dist/src/rules/error-handling/GenericErrorRule.d.ts +15 -3
- package/dist/src/rules/error-handling/GenericErrorRule.d.ts.map +1 -1
- package/dist/src/rules/error-handling/GenericErrorRule.js +58 -18
- package/dist/src/rules/error-handling/GenericErrorRule.js.map +1 -1
- package/dist/src/rules/error-handling/GlobalErrorHandlerRule.d.ts +14 -15
- package/dist/src/rules/error-handling/GlobalErrorHandlerRule.d.ts.map +1 -1
- package/dist/src/rules/error-handling/GlobalErrorHandlerRule.js +59 -38
- package/dist/src/rules/error-handling/GlobalErrorHandlerRule.js.map +1 -1
- package/dist/src/rules/error-handling/TryScopeRule.d.ts +5 -0
- package/dist/src/rules/error-handling/TryScopeRule.d.ts.map +1 -1
- package/dist/src/rules/error-handling/TryScopeRule.js +30 -7
- package/dist/src/rules/error-handling/TryScopeRule.js.map +1 -1
- package/dist/src/rules/http/ConnectionIdleTimeoutRule.d.ts +27 -0
- package/dist/src/rules/http/ConnectionIdleTimeoutRule.d.ts.map +1 -0
- package/dist/src/rules/http/ConnectionIdleTimeoutRule.js +46 -0
- package/dist/src/rules/http/ConnectionIdleTimeoutRule.js.map +1 -0
- package/dist/src/rules/index.d.ts +1 -1
- package/dist/src/rules/index.d.ts.map +1 -1
- package/dist/src/rules/index.js +50 -8
- package/dist/src/rules/index.js.map +1 -1
- package/dist/src/rules/logging/LoggerPayloadRule.d.ts +15 -0
- package/dist/src/rules/logging/LoggerPayloadRule.d.ts.map +1 -1
- package/dist/src/rules/logging/LoggerPayloadRule.js +48 -4
- package/dist/src/rules/logging/LoggerPayloadRule.js.map +1 -1
- package/dist/src/rules/operations/FlowRefTargetExistsRule.d.ts +23 -0
- package/dist/src/rules/operations/FlowRefTargetExistsRule.d.ts.map +1 -0
- package/dist/src/rules/operations/FlowRefTargetExistsRule.js +58 -0
- package/dist/src/rules/operations/FlowRefTargetExistsRule.js.map +1 -0
- package/dist/src/rules/operations/UnusedFlowRule.d.ts +20 -0
- package/dist/src/rules/operations/UnusedFlowRule.d.ts.map +1 -1
- package/dist/src/rules/operations/UnusedFlowRule.js +73 -7
- package/dist/src/rules/operations/UnusedFlowRule.js.map +1 -1
- package/dist/src/rules/operations/UnusedVariableRule.d.ts +31 -0
- package/dist/src/rules/operations/UnusedVariableRule.d.ts.map +1 -0
- package/dist/src/rules/operations/UnusedVariableRule.js +103 -0
- package/dist/src/rules/operations/UnusedVariableRule.js.map +1 -0
- package/dist/src/rules/performance/ListenerReconnectForeverRule.d.ts +28 -0
- package/dist/src/rules/performance/ListenerReconnectForeverRule.d.ts.map +1 -0
- package/dist/src/rules/performance/ListenerReconnectForeverRule.js +56 -0
- package/dist/src/rules/performance/ListenerReconnectForeverRule.js.map +1 -0
- package/dist/src/rules/performance/ReconnectionStrategyRule.d.ts +7 -4
- package/dist/src/rules/performance/ReconnectionStrategyRule.d.ts.map +1 -1
- package/dist/src/rules/performance/ReconnectionStrategyRule.js +44 -24
- package/dist/src/rules/performance/ReconnectionStrategyRule.js.map +1 -1
- package/dist/src/rules/security/ConnectorCredentialsSecuredRule.d.ts +36 -0
- package/dist/src/rules/security/ConnectorCredentialsSecuredRule.d.ts.map +1 -0
- package/dist/src/rules/security/ConnectorCredentialsSecuredRule.js +124 -0
- package/dist/src/rules/security/ConnectorCredentialsSecuredRule.js.map +1 -0
- package/dist/src/rules/security/HardcodedCredentialsRule.d.ts +4 -0
- package/dist/src/rules/security/HardcodedCredentialsRule.d.ts.map +1 -1
- package/dist/src/rules/security/HardcodedCredentialsRule.js +15 -0
- package/dist/src/rules/security/HardcodedCredentialsRule.js.map +1 -1
- package/dist/src/rules/security/SecurePropertiesEncryptionRule.d.ts +25 -0
- package/dist/src/rules/security/SecurePropertiesEncryptionRule.d.ts.map +1 -0
- package/dist/src/rules/security/SecurePropertiesEncryptionRule.js +59 -0
- package/dist/src/rules/security/SecurePropertiesEncryptionRule.js.map +1 -0
- package/dist/src/rules/security/SecurePropertiesKeyRule.d.ts +23 -0
- package/dist/src/rules/security/SecurePropertiesKeyRule.d.ts.map +1 -0
- package/dist/src/rules/security/SecurePropertiesKeyRule.js +45 -0
- package/dist/src/rules/security/SecurePropertiesKeyRule.js.map +1 -0
- package/dist/src/rules/security/TlsKeystorePasswordRule.d.ts +25 -0
- package/dist/src/rules/security/TlsKeystorePasswordRule.d.ts.map +1 -0
- package/dist/src/rules/security/TlsKeystorePasswordRule.js +63 -0
- package/dist/src/rules/security/TlsKeystorePasswordRule.js.map +1 -0
- package/dist/src/rules/standards/ApikitRouteVariableConsistencyRule.d.ts +26 -0
- package/dist/src/rules/standards/ApikitRouteVariableConsistencyRule.d.ts.map +1 -0
- package/dist/src/rules/standards/ApikitRouteVariableConsistencyRule.js +61 -0
- package/dist/src/rules/standards/ApikitRouteVariableConsistencyRule.js.map +1 -0
- package/dist/src/rules/standards/ConfigPropertiesOrderingRule.d.ts +34 -0
- package/dist/src/rules/standards/ConfigPropertiesOrderingRule.d.ts.map +1 -0
- package/dist/src/rules/standards/ConfigPropertiesOrderingRule.js +76 -0
- package/dist/src/rules/standards/ConfigPropertiesOrderingRule.js.map +1 -0
- package/dist/src/rules/standards/MissingEnvPropertiesDeclarationRule.d.ts +25 -0
- package/dist/src/rules/standards/MissingEnvPropertiesDeclarationRule.d.ts.map +1 -0
- package/dist/src/rules/standards/MissingEnvPropertiesDeclarationRule.js +111 -0
- package/dist/src/rules/standards/MissingEnvPropertiesDeclarationRule.js.map +1 -0
- package/dist/src/rules/yaml/YamlRules.d.ts +6 -2
- package/dist/src/rules/yaml/YamlRules.d.ts.map +1 -1
- package/dist/src/rules/yaml/YamlRules.js +15 -11
- package/dist/src/rules/yaml/YamlRules.js.map +1 -1
- package/dist/src/types/Rule.d.ts +13 -0
- package/dist/src/types/Rule.d.ts.map +1 -1
- package/docs/README.md +87 -27
- package/docs/best-practices/ci-cd.md +135 -0
- package/docs/best-practices/connector-patterns.md +253 -0
- package/docs/best-practices/dataweave-patterns.md +370 -0
- package/docs/best-practices/deployment-2026.md +171 -0
- package/docs/best-practices/error-handling.md +277 -0
- package/docs/best-practices/event-driven-patterns.md +424 -0
- package/docs/best-practices/logging.md +163 -0
- package/docs/best-practices/mulesoft-best-practices.md +72 -865
- package/docs/best-practices/performance.md +273 -0
- package/docs/best-practices/rules-catalog.md +337 -29
- package/docs/best-practices/security.md +181 -0
- package/docs/best-practices/testing.md +190 -0
- package/docs/best-practices/variable-contracts.md +191 -0
- package/docs/linter/architecture.md +119 -64
- package/package.json +1 -1
|
@@ -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;AAkHnC,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,EA0H3B,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
|
@@ -28,6 +28,9 @@ const HttpStatusRule_1 = require("./error-handling/HttpStatusRule");
|
|
|
28
28
|
const CorrelationIdRule_1 = require("./error-handling/CorrelationIdRule");
|
|
29
29
|
const GenericErrorRule_1 = require("./error-handling/GenericErrorRule");
|
|
30
30
|
const TryScopeRule_1 = require("./error-handling/TryScopeRule");
|
|
31
|
+
const ErrorHandlerTypeCoverageRule_1 = require("./error-handling/ErrorHandlerTypeCoverageRule");
|
|
32
|
+
const ErrorResponseStructureRule_1 = require("./error-handling/ErrorResponseStructureRule");
|
|
33
|
+
const CatchAllLastRule_1 = require("./error-handling/CatchAllLastRule");
|
|
31
34
|
// Import all rules - Naming
|
|
32
35
|
const FlowNamingRule_1 = require("./naming/FlowNamingRule");
|
|
33
36
|
const FlowCasingRule_1 = require("./naming/FlowCasingRule");
|
|
@@ -40,6 +43,10 @@ const TlsVersionRule_1 = require("./security/TlsVersionRule");
|
|
|
40
43
|
const RateLimitingRule_1 = require("./security/RateLimitingRule");
|
|
41
44
|
const InputValidationRule_1 = require("./security/InputValidationRule");
|
|
42
45
|
const EncryptionKeyInLogsRule_1 = require("./security/EncryptionKeyInLogsRule");
|
|
46
|
+
const ConnectorCredentialsSecuredRule_1 = require("./security/ConnectorCredentialsSecuredRule");
|
|
47
|
+
const SecurePropertiesKeyRule_1 = require("./security/SecurePropertiesKeyRule");
|
|
48
|
+
const TlsKeystorePasswordRule_1 = require("./security/TlsKeystorePasswordRule");
|
|
49
|
+
const SecurePropertiesEncryptionRule_1 = require("./security/SecurePropertiesEncryptionRule");
|
|
43
50
|
// Import all rules - Logging
|
|
44
51
|
const LoggerCategoryRule_1 = require("./logging/LoggerCategoryRule");
|
|
45
52
|
const LoggerPayloadRule_1 = require("./logging/LoggerPayloadRule");
|
|
@@ -54,10 +61,17 @@ const AutoDiscoveryRule_1 = require("./standards/AutoDiscoveryRule");
|
|
|
54
61
|
const HttpPortPlaceholderRule_1 = require("./standards/HttpPortPlaceholderRule");
|
|
55
62
|
const CronExternalizedRule_1 = require("./standards/CronExternalizedRule");
|
|
56
63
|
const ApiKitValidationRule_1 = require("./standards/ApiKitValidationRule");
|
|
64
|
+
const ConfigPropertiesOrderingRule_1 = require("./standards/ConfigPropertiesOrderingRule");
|
|
65
|
+
const MissingEnvPropertiesDeclarationRule_1 = require("./standards/MissingEnvPropertiesDeclarationRule");
|
|
66
|
+
const ApikitRouteVariableConsistencyRule_1 = require("./standards/ApikitRouteVariableConsistencyRule");
|
|
57
67
|
// Import all rules - HTTP
|
|
58
68
|
const HttpUserAgentRule_1 = require("./http/HttpUserAgentRule");
|
|
59
69
|
const HttpContentTypeRule_1 = require("./http/HttpContentTypeRule");
|
|
60
70
|
const HttpTimeoutRule_1 = require("./http/HttpTimeoutRule");
|
|
71
|
+
const ConnectionIdleTimeoutRule_1 = require("./http/ConnectionIdleTimeoutRule");
|
|
72
|
+
// Import all rules - Connector
|
|
73
|
+
const ReplayChannelConfigRule_1 = require("./connector/ReplayChannelConfigRule");
|
|
74
|
+
const EventListenerNullGuardRule_1 = require("./connector/EventListenerNullGuardRule");
|
|
61
75
|
// Import all rules - Documentation
|
|
62
76
|
const FlowDescriptionRule_1 = require("./documentation/FlowDescriptionRule");
|
|
63
77
|
const MissingDocNameRule_1 = require("./documentation/MissingDocNameRule");
|
|
@@ -68,6 +82,7 @@ const AsyncErrorHandlerRule_1 = require("./performance/AsyncErrorHandlerRule");
|
|
|
68
82
|
const LargeChoiceBlockRule_1 = require("./performance/LargeChoiceBlockRule");
|
|
69
83
|
const ConnectionPoolingRule_1 = require("./performance/ConnectionPoolingRule");
|
|
70
84
|
const ReconnectionStrategyRule_1 = require("./performance/ReconnectionStrategyRule");
|
|
85
|
+
const ListenerReconnectForeverRule_1 = require("./performance/ListenerReconnectForeverRule");
|
|
71
86
|
// Import all rules - Complexity
|
|
72
87
|
const FlowComplexityRule_1 = require("./complexity/FlowComplexityRule");
|
|
73
88
|
// Import all rules - YAML
|
|
@@ -77,14 +92,20 @@ const StructureRules_1 = require("./structure/StructureRules");
|
|
|
77
92
|
// Import all rules - DataWeave
|
|
78
93
|
const DataWeaveRules_1 = require("./dataweave/DataWeaveRules");
|
|
79
94
|
const Java17DWErrorHandlingRule_1 = require("./dataweave/Java17DWErrorHandlingRule");
|
|
95
|
+
const DuplicateTransformLogicRule_1 = require("./dataweave/DuplicateTransformLogicRule");
|
|
80
96
|
// Import all rules - API-Led
|
|
81
97
|
const ApiLedRules_1 = require("./api-led/ApiLedRules");
|
|
82
98
|
const SingleSystemSapiRule_1 = require("./api-led/SingleSystemSapiRule");
|
|
99
|
+
const ApikitMainFlowStructureRule_1 = require("./api-led/ApikitMainFlowStructureRule");
|
|
100
|
+
const ApikitStatusCodeVariableRule_1 = require("./api-led/ApikitStatusCodeVariableRule");
|
|
101
|
+
const ApikitConsoleProductionRule_1 = require("./api-led/ApikitConsoleProductionRule");
|
|
83
102
|
// Import all rules - Experimental
|
|
84
103
|
const ExperimentalRules_1 = require("./experimental/ExperimentalRules");
|
|
85
104
|
// Import all rules - Operations & Hygiene
|
|
86
105
|
const CommentedCodeRule_1 = require("./operations/CommentedCodeRule");
|
|
87
106
|
const UnusedFlowRule_1 = require("./operations/UnusedFlowRule");
|
|
107
|
+
const FlowRefTargetExistsRule_1 = require("./operations/FlowRefTargetExistsRule");
|
|
108
|
+
const UnusedVariableRule_1 = require("./operations/UnusedVariableRule");
|
|
88
109
|
// Import all rules - Governance
|
|
89
110
|
const GovernanceRules_1 = require("./governance/GovernanceRules");
|
|
90
111
|
// Export individual rules - Error Handling
|
|
@@ -147,7 +168,7 @@ var LargeChoiceBlockRule_2 = require("./performance/LargeChoiceBlockRule");
|
|
|
147
168
|
Object.defineProperty(exports, "LargeChoiceBlockRule", { enumerable: true, get: function () { return LargeChoiceBlockRule_2.LargeChoiceBlockRule; } });
|
|
148
169
|
/**
|
|
149
170
|
* All available rules - instantiated and ready to use
|
|
150
|
-
* Total:
|
|
171
|
+
* Total: 82 rules (including operations, resilience, hygiene, API-led, connector, and code quality rules)
|
|
151
172
|
*/
|
|
152
173
|
exports.ALL_RULES = [
|
|
153
174
|
// Error Handling Rules (MULE-001, 003, 005, 007, 009)
|
|
@@ -157,6 +178,9 @@ exports.ALL_RULES = [
|
|
|
157
178
|
new CorrelationIdRule_1.CorrelationIdRule(),
|
|
158
179
|
new GenericErrorRule_1.GenericErrorRule(),
|
|
159
180
|
new TryScopeRule_1.TryScopeRule(), // ERR-001: Try Scope Best Practice
|
|
181
|
+
new ErrorHandlerTypeCoverageRule_1.ErrorHandlerTypeCoverageRule(), // ERR-002: APIKit Error Type Coverage
|
|
182
|
+
new ErrorResponseStructureRule_1.ErrorResponseStructureRule(), // ERR-003: Error Response Structure
|
|
183
|
+
new CatchAllLastRule_1.CatchAllLastRule(), // ERR-004: Catch-All Must Be Last
|
|
160
184
|
// Naming Rules (MULE-002, 101, 102)
|
|
161
185
|
new FlowNamingRule_1.FlowNamingRule(),
|
|
162
186
|
new FlowCasingRule_1.FlowCasingRule(),
|
|
@@ -178,10 +202,11 @@ exports.ALL_RULES = [
|
|
|
178
202
|
new ChoiceAntiPatternRule_1.ChoiceAntiPatternRule(),
|
|
179
203
|
new DwlStandardsRule_1.DwlStandardsRule(),
|
|
180
204
|
new DeprecatedComponentRule_1.DeprecatedComponentRule(),
|
|
181
|
-
// HTTP Rules (MULE-401, 402, 403)
|
|
205
|
+
// HTTP Rules (MULE-401, 402, 403, HTTP-004)
|
|
182
206
|
new HttpUserAgentRule_1.HttpUserAgentRule(),
|
|
183
207
|
new HttpContentTypeRule_1.HttpContentTypeRule(),
|
|
184
208
|
new HttpTimeoutRule_1.HttpTimeoutRule(),
|
|
209
|
+
new ConnectionIdleTimeoutRule_1.ConnectionIdleTimeoutRule(), // HTTP-004: Connection Idle Timeout
|
|
185
210
|
// Documentation Rules (MULE-601, 604)
|
|
186
211
|
new FlowDescriptionRule_1.FlowDescriptionRule(),
|
|
187
212
|
new MissingDocNameRule_1.MissingDocNameRule(),
|
|
@@ -200,37 +225,54 @@ exports.ALL_RULES = [
|
|
|
200
225
|
new StructureRules_1.ProjectStructureRule(),
|
|
201
226
|
new StructureRules_1.GlobalConfigRule(),
|
|
202
227
|
new StructureRules_1.MonolithicXmlRule(),
|
|
203
|
-
// DataWeave Rules (DW-001, 002, 003, 004)
|
|
228
|
+
// DataWeave Rules (DW-001, 002, 003, 004, 005)
|
|
204
229
|
new DataWeaveRules_1.ExternalDwlRule(),
|
|
205
230
|
new DataWeaveRules_1.DwlNamingRule(),
|
|
206
231
|
new DataWeaveRules_1.DwlModulesRule(),
|
|
207
232
|
new Java17DWErrorHandlingRule_1.Java17DWErrorHandlingRule(),
|
|
208
|
-
|
|
233
|
+
new DuplicateTransformLogicRule_1.DuplicateTransformLogicRule(), // DW-005: Duplicate Transform Logic
|
|
234
|
+
// API-Led Rules (API-001, 002, 003, 004, 006, 007, 008)
|
|
209
235
|
new ApiLedRules_1.ExperienceLayerRule(),
|
|
210
236
|
new ApiLedRules_1.ProcessLayerRule(),
|
|
211
237
|
new ApiLedRules_1.SystemLayerRule(),
|
|
212
238
|
new SingleSystemSapiRule_1.SingleSystemSapiRule(),
|
|
239
|
+
new ApikitMainFlowStructureRule_1.ApikitMainFlowStructureRule(), // API-006: APIKit Main Flow Structure
|
|
240
|
+
new ApikitStatusCodeVariableRule_1.ApikitStatusCodeVariableRule(), // API-007: APIKit Status Code Variable
|
|
241
|
+
new ApikitConsoleProductionRule_1.ApikitConsoleProductionRule(), // API-008: APIKit Console in Production
|
|
213
242
|
// Experimental Rules (EXP-001, 002, 003)
|
|
214
243
|
new ExperimentalRules_1.FlowRefDepthRule(),
|
|
215
244
|
new ExperimentalRules_1.ConnectorConfigNamingRule(),
|
|
216
245
|
new ExperimentalRules_1.MUnitCoverageRule(),
|
|
217
|
-
// Operations & Resilience Rules (RES-001, OPS-001, OPS-002, OPS-003)
|
|
246
|
+
// Operations & Resilience Rules (RES-001, RES-002, OPS-001, OPS-002, OPS-003)
|
|
218
247
|
new ReconnectionStrategyRule_1.ReconnectionStrategyRule(),
|
|
248
|
+
new ListenerReconnectForeverRule_1.ListenerReconnectForeverRule(), // RES-002: Listener Reconnect-Forever
|
|
219
249
|
new AutoDiscoveryRule_1.AutoDiscoveryRule(),
|
|
220
250
|
new HttpPortPlaceholderRule_1.HttpPortPlaceholderRule(),
|
|
221
251
|
new CronExternalizedRule_1.CronExternalizedRule(),
|
|
222
|
-
// Security Enhancement (SEC-006)
|
|
252
|
+
// Security Enhancement (SEC-006, SEC-007, SEC-008, SEC-009, SEC-010)
|
|
223
253
|
new EncryptionKeyInLogsRule_1.EncryptionKeyInLogsRule(),
|
|
224
|
-
|
|
254
|
+
new ConnectorCredentialsSecuredRule_1.ConnectorCredentialsSecuredRule(),
|
|
255
|
+
new SecurePropertiesKeyRule_1.SecurePropertiesKeyRule(),
|
|
256
|
+
new TlsKeystorePasswordRule_1.TlsKeystorePasswordRule(),
|
|
257
|
+
new SecurePropertiesEncryptionRule_1.SecurePropertiesEncryptionRule(),
|
|
258
|
+
// Code Hygiene Rules (HYG-001, HYG-002, HYG-003, HYG-004, HYG-005)
|
|
225
259
|
new ExcessiveLoggersRule_1.ExcessiveLoggersRule(),
|
|
226
260
|
new CommentedCodeRule_1.CommentedCodeRule(),
|
|
227
261
|
new UnusedFlowRule_1.UnusedFlowRule(),
|
|
228
|
-
|
|
262
|
+
new FlowRefTargetExistsRule_1.FlowRefTargetExistsRule(),
|
|
263
|
+
new UnusedVariableRule_1.UnusedVariableRule(), // HYG-005: Unused Variable
|
|
264
|
+
// Additional Standards (API-005, DOC-001, CFG-001, CFG-002, STD-001)
|
|
229
265
|
new ApiKitValidationRule_1.ApiKitValidationRule(),
|
|
230
266
|
new DisplayNameRule_1.DisplayNameRule(),
|
|
267
|
+
new ConfigPropertiesOrderingRule_1.ConfigPropertiesOrderingRule(), // CFG-001: Config Properties Ordering
|
|
268
|
+
new MissingEnvPropertiesDeclarationRule_1.MissingEnvPropertiesDeclarationRule(), // CFG-002: Missing Env Properties
|
|
269
|
+
new ApikitRouteVariableConsistencyRule_1.ApikitRouteVariableConsistencyRule(), // STD-001: APIKit Route Variable Consistency
|
|
231
270
|
// Governance Rules (PROJ-001, PROJ-002)
|
|
232
271
|
new GovernanceRules_1.PomValidationRule(),
|
|
233
272
|
new GovernanceRules_1.GitHygieneRule(),
|
|
273
|
+
// Connector Rules (SF-001, SF-002)
|
|
274
|
+
new ReplayChannelConfigRule_1.ReplayChannelConfigRule(), // SF-001: Salesforce Replay Channel Config
|
|
275
|
+
new EventListenerNullGuardRule_1.EventListenerNullGuardRule(), // SF-002: Event Listener Null Guard
|
|
234
276
|
];
|
|
235
277
|
/**
|
|
236
278
|
* Get rules by category
|
|
@@ -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":";;;;;;;;;;;;;;;;;AAkSA,gDAEC;AAKD,kCAEC;AAKD,sCAEC;AAlTD,oBAAoB;AACpB,kDAAgC;AAChC,qDAAmC;AAEnC,oCAAoC;AACpC,oFAAiF;AACjF,sFAAmF;AACnF,oEAAiE;AACjE,0EAAuE;AACvE,wEAAqE;AACrE,gEAA6D;AAC7D,gGAA6F;AAC7F,4FAAyF;AACzF,wEAAqE;AAErE,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;AAC7E,gGAA6F;AAC7F,gFAA6E;AAC7E,gFAA6E;AAC7E,8FAA2F;AAE3F,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;AACxE,2FAAwF;AACxF,yGAAsG;AACtG,uGAAoG;AAEpG,0BAA0B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AAU;IACpC,OAAO,iBAAS,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AAClD,CAAC;AAED;;GAEG;AACH,SAAgB,aAAa;IAC3B,OAAO,iBAAS,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC1C,CAAC"}
|
|
@@ -4,6 +4,14 @@ import { BaseRule } from '../base/BaseRule';
|
|
|
4
4
|
* MULE-301: Logger Payload Reference
|
|
5
5
|
*
|
|
6
6
|
* Loggers should not directly reference #[payload] for security/performance.
|
|
7
|
+
* This includes:
|
|
8
|
+
* - Direct payload reference: #[payload]
|
|
9
|
+
* - DataWeave write of full payload: write(payload, 'application/json')
|
|
10
|
+
* - output application/json --- payload (full payload serialization)
|
|
11
|
+
*
|
|
12
|
+
* Logging the entire payload risks exposing PII/sensitive customer data
|
|
13
|
+
* (names, addresses, SSNs, credit cards) and can degrade performance for
|
|
14
|
+
* large payloads.
|
|
7
15
|
*/
|
|
8
16
|
export declare class LoggerPayloadRule extends BaseRule {
|
|
9
17
|
id: string;
|
|
@@ -13,5 +21,12 @@ export declare class LoggerPayloadRule extends BaseRule {
|
|
|
13
21
|
category: "logging";
|
|
14
22
|
validate(doc: Document, _context: ValidationContext): Issue[];
|
|
15
23
|
private hasDirectPayloadReference;
|
|
24
|
+
/**
|
|
25
|
+
* Detect DataWeave patterns that serialize the full payload:
|
|
26
|
+
* - write(payload, 'application/json')
|
|
27
|
+
* - write(payload, "application/json")
|
|
28
|
+
* - output application/json --- payload
|
|
29
|
+
*/
|
|
30
|
+
private hasPayloadSerialization;
|
|
16
31
|
}
|
|
17
32
|
//# sourceMappingURL=LoggerPayloadRule.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LoggerPayloadRule.d.ts","sourceRoot":"","sources":["../../../../src/rules/logging/LoggerPayloadRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C
|
|
1
|
+
{"version":3,"file":"LoggerPayloadRule.d.ts","sourceRoot":"","sources":["../../../../src/rules/logging/LoggerPayloadRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;;;;;;;;;;;GAYG;AACH,qBAAa,iBAAkB,SAAQ,QAAQ;IAC7C,EAAE,SAAc;IAChB,IAAI,SAA8B;IAClC,WAAW,SAAoD;IAC/D,QAAQ,EAAG,SAAS,CAAU;IAC9B,QAAQ,EAAG,SAAS,CAAU;IAE9B,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,GAAG,KAAK,EAAE;IAuD7D,OAAO,CAAC,yBAAyB;IAUjC;;;;;OAKG;IACH,OAAO,CAAC,uBAAuB;CAWhC"}
|
|
@@ -6,6 +6,14 @@ const BaseRule_1 = require("../base/BaseRule");
|
|
|
6
6
|
* MULE-301: Logger Payload Reference
|
|
7
7
|
*
|
|
8
8
|
* Loggers should not directly reference #[payload] for security/performance.
|
|
9
|
+
* This includes:
|
|
10
|
+
* - Direct payload reference: #[payload]
|
|
11
|
+
* - DataWeave write of full payload: write(payload, 'application/json')
|
|
12
|
+
* - output application/json --- payload (full payload serialization)
|
|
13
|
+
*
|
|
14
|
+
* Logging the entire payload risks exposing PII/sensitive customer data
|
|
15
|
+
* (names, addresses, SSNs, credit cards) and can degrade performance for
|
|
16
|
+
* large payloads.
|
|
9
17
|
*/
|
|
10
18
|
class LoggerPayloadRule extends BaseRule_1.BaseRule {
|
|
11
19
|
id = 'MULE-301';
|
|
@@ -15,24 +23,60 @@ class LoggerPayloadRule extends BaseRule_1.BaseRule {
|
|
|
15
23
|
category = 'logging';
|
|
16
24
|
validate(doc, _context) {
|
|
17
25
|
const issues = [];
|
|
18
|
-
|
|
26
|
+
// Check standard logger elements with message attribute
|
|
27
|
+
const loggers = this.select('//*[local-name()="logger"]', doc);
|
|
19
28
|
for (const logger of loggers) {
|
|
20
29
|
const message = this.getAttribute(logger, 'message') ?? '';
|
|
21
|
-
// Check for direct payload logging
|
|
22
30
|
if (this.hasDirectPayloadReference(message)) {
|
|
23
31
|
const docName = this.getDocName(logger) ?? 'Logger';
|
|
24
32
|
issues.push(this.createIssue(logger, `Logger "${docName}" logs entire payload - security/performance risk`, {
|
|
25
|
-
suggestion: 'Log specific fields instead: #[payload.orderId]',
|
|
33
|
+
suggestion: 'Log specific fields instead: #[payload.orderId] or use a masking DataWeave module',
|
|
26
34
|
}));
|
|
27
35
|
}
|
|
28
36
|
}
|
|
37
|
+
// Check ee:transform set-payload inside logger contexts
|
|
38
|
+
// (Some projects put write(payload,...) in transform message elements)
|
|
39
|
+
const transforms = this.select('//*[local-name()="transform"]', doc);
|
|
40
|
+
for (const transform of transforms) {
|
|
41
|
+
// Check all text content in set-payload / set-variable / message elements
|
|
42
|
+
const payloadSetters = this.select('.//*[local-name()="set-payload" or local-name()="set-variable"]', transform);
|
|
43
|
+
for (const setter of payloadSetters) {
|
|
44
|
+
const content = setter.textContent ?? '';
|
|
45
|
+
if (this.hasPayloadSerialization(content)) {
|
|
46
|
+
const docName = this.getDocName(transform) ?? 'Transform';
|
|
47
|
+
issues.push(this.createIssue(transform, `Transform "${docName}" serializes entire payload (write(payload,...)) - PII exposure risk`, {
|
|
48
|
+
severity: 'warning',
|
|
49
|
+
suggestion: 'Serialize only specific fields or use a masking function to redact sensitive data before logging',
|
|
50
|
+
}));
|
|
51
|
+
break; // One issue per transform
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
29
55
|
return issues;
|
|
30
56
|
}
|
|
31
57
|
hasDirectPayloadReference(message) {
|
|
32
58
|
// Match #[payload] but not #[payload.something]
|
|
33
59
|
return (/#\[payload\s*\]/.test(message) ||
|
|
34
60
|
/#\[\s*payload\s*\]/.test(message) ||
|
|
35
|
-
message === '#[payload]'
|
|
61
|
+
message === '#[payload]' ||
|
|
62
|
+
this.hasPayloadSerialization(message));
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Detect DataWeave patterns that serialize the full payload:
|
|
66
|
+
* - write(payload, 'application/json')
|
|
67
|
+
* - write(payload, "application/json")
|
|
68
|
+
* - output application/json --- payload
|
|
69
|
+
*/
|
|
70
|
+
hasPayloadSerialization(content) {
|
|
71
|
+
// write(payload, ...) — serializes entire payload to string
|
|
72
|
+
if (/write\s*\(\s*payload\s*,/.test(content)) {
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
// output ... --- payload (entire payload as output body)
|
|
76
|
+
if (/---\s*payload\s*$/.test(content.trim())) {
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
return false;
|
|
36
80
|
}
|
|
37
81
|
}
|
|
38
82
|
exports.LoggerPayloadRule = LoggerPayloadRule;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LoggerPayloadRule.js","sourceRoot":"","sources":["../../../../src/rules/logging/LoggerPayloadRule.ts"],"names":[],"mappings":";;;AACA,+CAA4C;AAE5C
|
|
1
|
+
{"version":3,"file":"LoggerPayloadRule.js","sourceRoot":"","sources":["../../../../src/rules/logging/LoggerPayloadRule.ts"],"names":[],"mappings":";;;AACA,+CAA4C;AAE5C;;;;;;;;;;;;GAYG;AACH,MAAa,iBAAkB,SAAQ,mBAAQ;IAC7C,EAAE,GAAG,UAAU,CAAC;IAChB,IAAI,GAAG,0BAA0B,CAAC;IAClC,WAAW,GAAG,gDAAgD,CAAC;IAC/D,QAAQ,GAAG,SAAkB,CAAC;IAC9B,QAAQ,GAAG,SAAkB,CAAC;IAE9B,QAAQ,CAAC,GAAa,EAAE,QAA2B;QACjD,MAAM,MAAM,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AC;oBACF,MAAM,CAAC,0BAA0B;gBACnC,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAEO,yBAAyB,CAAC,OAAe;QAC/C,gDAAgD;QAChD,OAAO,CACL,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC;YAC/B,oBAAoB,CAAC,IAAI,CAAC,OAAO,CAAC;YAClC,OAAO,KAAK,YAAY;YACxB,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC,CACtC,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACK,uBAAuB,CAAC,OAAe;QAC7C,4DAA4D;QAC5D,IAAI,0BAA0B,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;YAC7C,OAAO,IAAI,CAAC;QACd,CAAC;QACD,yDAAyD;QACzD,IAAI,mBAAmB,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC;YAC7C,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAzFD,8CAyFC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ValidationContext, Issue, IssueType } from '../../types';
|
|
2
|
+
import { BaseRule } from '../base/BaseRule';
|
|
3
|
+
/**
|
|
4
|
+
* HYG-004: Flow-Ref Target Exists
|
|
5
|
+
*
|
|
6
|
+
* Every <flow-ref name="X"/> must have a corresponding <flow name="X"/> or
|
|
7
|
+
* <sub-flow name="X"/> somewhere in the project. When the engine provides
|
|
8
|
+
* `context.allFlowRefs` we rely on the pre-scanned flow name map; otherwise
|
|
9
|
+
* we fall back to intra-file validation only.
|
|
10
|
+
*
|
|
11
|
+
* This rule catches broken wiring at lint time, preventing runtime
|
|
12
|
+
* MULE:ROUTING errors in production.
|
|
13
|
+
*/
|
|
14
|
+
export declare class FlowRefTargetExistsRule extends BaseRule {
|
|
15
|
+
id: string;
|
|
16
|
+
name: string;
|
|
17
|
+
description: string;
|
|
18
|
+
severity: "error";
|
|
19
|
+
category: "operations";
|
|
20
|
+
issueType: IssueType;
|
|
21
|
+
validate(doc: Document, context: ValidationContext): Issue[];
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=FlowRefTargetExistsRule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlowRefTargetExistsRule.d.ts","sourceRoot":"","sources":["../../../../src/rules/operations/FlowRefTargetExistsRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;;;;;;;;;GAUG;AACH,qBAAa,uBAAwB,SAAQ,QAAQ;IACnD,EAAE,SAAa;IACf,IAAI,SAA4B;IAChC,WAAW,SAAgE;IAC3E,QAAQ,EAAG,OAAO,CAAU;IAC5B,QAAQ,EAAG,YAAY,CAAU;IACjC,SAAS,EAAE,SAAS,CAAS;IAE7B,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,iBAAiB,GAAG,KAAK,EAAE;CA0C7D"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FlowRefTargetExistsRule = void 0;
|
|
4
|
+
const BaseRule_1 = require("../base/BaseRule");
|
|
5
|
+
/**
|
|
6
|
+
* HYG-004: Flow-Ref Target Exists
|
|
7
|
+
*
|
|
8
|
+
* Every <flow-ref name="X"/> must have a corresponding <flow name="X"/> or
|
|
9
|
+
* <sub-flow name="X"/> somewhere in the project. When the engine provides
|
|
10
|
+
* `context.allFlowRefs` we rely on the pre-scanned flow name map; otherwise
|
|
11
|
+
* we fall back to intra-file validation only.
|
|
12
|
+
*
|
|
13
|
+
* This rule catches broken wiring at lint time, preventing runtime
|
|
14
|
+
* MULE:ROUTING errors in production.
|
|
15
|
+
*/
|
|
16
|
+
class FlowRefTargetExistsRule extends BaseRule_1.BaseRule {
|
|
17
|
+
id = 'HYG-004';
|
|
18
|
+
name = 'Flow-Ref Target Exists';
|
|
19
|
+
description = 'Every flow-ref must reference an existing flow or sub-flow';
|
|
20
|
+
severity = 'error';
|
|
21
|
+
category = 'operations';
|
|
22
|
+
issueType = 'bug';
|
|
23
|
+
validate(doc, context) {
|
|
24
|
+
const issues = [];
|
|
25
|
+
// Collect all flow/sub-flow names defined in this file
|
|
26
|
+
const localFlowNames = new Set();
|
|
27
|
+
const flows = this.select('//*[local-name()="flow" or local-name()="sub-flow"]', doc);
|
|
28
|
+
for (const flow of flows) {
|
|
29
|
+
const name = this.getNameAttribute(flow);
|
|
30
|
+
if (name) {
|
|
31
|
+
localFlowNames.add(name);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
// Collect all flow names across project if available
|
|
35
|
+
const allFlowNames = context.allFlowNames ?? localFlowNames;
|
|
36
|
+
// Check every flow-ref
|
|
37
|
+
const flowRefs = this.select('//*[local-name()="flow-ref"]', doc);
|
|
38
|
+
for (const ref of flowRefs) {
|
|
39
|
+
const targetName = this.getNameAttribute(ref);
|
|
40
|
+
if (!targetName) {
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
// Skip dynamic flow-refs (DataWeave expressions)
|
|
44
|
+
if (targetName.includes('#[') || targetName.includes('${')) {
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
if (!allFlowNames.has(targetName)) {
|
|
48
|
+
const docName = this.getDocName(ref) ?? targetName;
|
|
49
|
+
issues.push(this.createIssue(ref, `Flow-ref "${docName}" targets non-existent flow "${targetName}"`, {
|
|
50
|
+
suggestion: 'Verify the target flow or sub-flow exists. Check for typos or missing XML files in src/main/mule/',
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return issues;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.FlowRefTargetExistsRule = FlowRefTargetExistsRule;
|
|
58
|
+
//# sourceMappingURL=FlowRefTargetExistsRule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlowRefTargetExistsRule.js","sourceRoot":"","sources":["../../../../src/rules/operations/FlowRefTargetExistsRule.ts"],"names":[],"mappings":";;;AACA,+CAA4C;AAE5C;;;;;;;;;;GAUG;AACH,MAAa,uBAAwB,SAAQ,mBAAQ;IACnD,EAAE,GAAG,SAAS,CAAC;IACf,IAAI,GAAG,wBAAwB,CAAC;IAChC,WAAW,GAAG,4DAA4D,CAAC;IAC3E,QAAQ,GAAG,OAAgB,CAAC;IAC5B,QAAQ,GAAG,YAAqB,CAAC;IACjC,SAAS,GAAc,KAAK,CAAC;IAE7B,QAAQ,CAAC,GAAa,EAAE,OAA0B;QAChD,MAAM,MAAM,GAAY,EAAE,CAAC;QAE3B,uDAAuD;QACvD,MAAM,cAAc,GAAG,IAAI,GAAG,EAAU,CAAC;QACzC,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,qDAAqD,EAAE,GAAG,CAAC,CAAC;QACtF,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,MAAM,IAAI,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;YACzC,IAAI,IAAI,EAAE,CAAC;gBACT,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAC3B,CAAC;QACH,CAAC;QAED,qDAAqD;QACrD,MAAM,YAAY,GAAG,OAAO,CAAC,YAAY,IAAI,cAAc,CAAC;QAE5D,uBAAuB;QACvB,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,8BAA8B,EAAE,GAAG,CAAC,CAAC;QAClE,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;YAC3B,MAAM,UAAU,GAAG,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;YAC9C,IAAI,CAAC,UAAU,EAAE,CAAC;gBAChB,SAAS;YACX,CAAC;YAED,iDAAiD;YACjD,IAAI,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC3D,SAAS;YACX,CAAC;YAED,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;gBAClC,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,UAAU,CAAC;gBACnD,MAAM,CAAC,IAAI,CACT,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,aAAa,OAAO,gCAAgC,UAAU,GAAG,EAAE;oBACvF,UAAU,EACR,mGAAmG;iBACtG,CAAC,CACH,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAlDD,0DAkDC"}
|
|
@@ -9,6 +9,14 @@ import { BaseRule } from '../base/BaseRule';
|
|
|
9
9
|
* (populated during the pre-scan phase), the rule checks across all project
|
|
10
10
|
* files. When scanning a standalone file (allFlowRefs is undefined), only
|
|
11
11
|
* intra-file references are checked.
|
|
12
|
+
*
|
|
13
|
+
* The rule recognises several categories of "externally referenced" flows:
|
|
14
|
+
* - APIKit-generated flows: verb:\path:config (routed by apikit:router)
|
|
15
|
+
* - Flows with external triggers: http:listener, scheduler, vm:listener,
|
|
16
|
+
* salesforce:* listeners (replay-channel-listener, subscribe-channel-listener,
|
|
17
|
+
* replay-topic-listener, subscribe-topic-listener, modified-object-listener,
|
|
18
|
+
* new-object-listener)
|
|
19
|
+
* - Common naming conventions: *-main, *-api, api-*, *-console, *-error-handler, global*
|
|
12
20
|
*/
|
|
13
21
|
export declare class UnusedFlowRule extends BaseRule {
|
|
14
22
|
id: string;
|
|
@@ -17,6 +25,18 @@ export declare class UnusedFlowRule extends BaseRule {
|
|
|
17
25
|
severity: "warning";
|
|
18
26
|
category: "standards";
|
|
19
27
|
validate(doc: Document, context: ValidationContext): Issue[];
|
|
28
|
+
/**
|
|
29
|
+
* Check if a flow name matches the APIKit auto-generated naming convention.
|
|
30
|
+
* Pattern: verb:\path:config-name (e.g. "get:\orders:api-config")
|
|
31
|
+
* Also matches with (type) suffix: "get:\orders:api-config(application\json)"
|
|
32
|
+
*/
|
|
33
|
+
private isApikitFlow;
|
|
34
|
+
/**
|
|
35
|
+
* Check if a flow has an external trigger (a source component as the first
|
|
36
|
+
* processor). This covers HTTP listeners, schedulers, VM listeners,
|
|
37
|
+
* Salesforce connectors, and any other connector listener.
|
|
38
|
+
*/
|
|
39
|
+
private hasExternalTrigger;
|
|
20
40
|
private isExternallyReferenced;
|
|
21
41
|
}
|
|
22
42
|
//# sourceMappingURL=UnusedFlowRule.d.ts.map
|
|
@@ -1 +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
|
|
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;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,cAAe,SAAQ,QAAQ;IAC1C,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,OAAO,EAAE,iBAAiB,GAAG,KAAK,EAAE;IAwE5D;;;;OAIG;IACH,OAAO,CAAC,YAAY;IAKpB;;;;OAIG;IACH,OAAO,CAAC,kBAAkB;IAgD1B,OAAO,CAAC,sBAAsB;CAY/B"}
|
|
@@ -11,6 +11,14 @@ const BaseRule_1 = require("../base/BaseRule");
|
|
|
11
11
|
* (populated during the pre-scan phase), the rule checks across all project
|
|
12
12
|
* files. When scanning a standalone file (allFlowRefs is undefined), only
|
|
13
13
|
* intra-file references are checked.
|
|
14
|
+
*
|
|
15
|
+
* The rule recognises several categories of "externally referenced" flows:
|
|
16
|
+
* - APIKit-generated flows: verb:\path:config (routed by apikit:router)
|
|
17
|
+
* - Flows with external triggers: http:listener, scheduler, vm:listener,
|
|
18
|
+
* salesforce:* listeners (replay-channel-listener, subscribe-channel-listener,
|
|
19
|
+
* replay-topic-listener, subscribe-topic-listener, modified-object-listener,
|
|
20
|
+
* new-object-listener)
|
|
21
|
+
* - Common naming conventions: *-main, *-api, api-*, *-console, *-error-handler, global*
|
|
14
22
|
*/
|
|
15
23
|
class UnusedFlowRule extends BaseRule_1.BaseRule {
|
|
16
24
|
id = 'HYG-003';
|
|
@@ -54,18 +62,19 @@ class UnusedFlowRule extends BaseRule_1.BaseRule {
|
|
|
54
62
|
}
|
|
55
63
|
}
|
|
56
64
|
}
|
|
57
|
-
// Check private flows (not triggered by HTTP/scheduler)
|
|
65
|
+
// Check private flows (not triggered by HTTP/scheduler/connector listeners)
|
|
58
66
|
for (const flow of flows) {
|
|
59
67
|
const name = this.getNameAttribute(flow);
|
|
60
68
|
if (!name) {
|
|
61
69
|
continue;
|
|
62
70
|
}
|
|
63
|
-
// Skip
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
if
|
|
68
|
-
|
|
71
|
+
// Skip APIKit-generated flows (verb:\path:config pattern)
|
|
72
|
+
if (this.isApikitFlow(name)) {
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
// Skip if it has an external trigger (listener / scheduler)
|
|
76
|
+
if (this.hasExternalTrigger(flow)) {
|
|
77
|
+
continue;
|
|
69
78
|
}
|
|
70
79
|
// Check if referenced
|
|
71
80
|
if (!referencedFlows.has(name) && !this.isExternallyReferenced(name)) {
|
|
@@ -77,6 +86,63 @@ class UnusedFlowRule extends BaseRule_1.BaseRule {
|
|
|
77
86
|
}
|
|
78
87
|
return issues;
|
|
79
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* Check if a flow name matches the APIKit auto-generated naming convention.
|
|
91
|
+
* Pattern: verb:\path:config-name (e.g. "get:\orders:api-config")
|
|
92
|
+
* Also matches with (type) suffix: "get:\orders:api-config(application\json)"
|
|
93
|
+
*/
|
|
94
|
+
isApikitFlow(name) {
|
|
95
|
+
// APIKit flow names contain backslash-separated segments starting with an HTTP verb
|
|
96
|
+
return /^(get|post|put|patch|delete|head|options|trace):\\.+:.+$/i.test(name);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Check if a flow has an external trigger (a source component as the first
|
|
100
|
+
* processor). This covers HTTP listeners, schedulers, VM listeners,
|
|
101
|
+
* Salesforce connectors, and any other connector listener.
|
|
102
|
+
*/
|
|
103
|
+
hasExternalTrigger(flow) {
|
|
104
|
+
// http:listener or any namespace listener
|
|
105
|
+
const hasHttpListener = this.exists('.//*[local-name()="listener"]', flow);
|
|
106
|
+
if (hasHttpListener) {
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
// scheduler
|
|
110
|
+
const hasScheduler = this.exists('.//*[local-name()="scheduler"]', flow);
|
|
111
|
+
if (hasScheduler) {
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
// Salesforce-specific listeners (platform events, CDC, polling)
|
|
115
|
+
const sfListenerPatterns = [
|
|
116
|
+
'replay-channel-listener',
|
|
117
|
+
'subscribe-channel-listener',
|
|
118
|
+
'replay-topic-listener',
|
|
119
|
+
'subscribe-topic-listener',
|
|
120
|
+
'modified-object-listener',
|
|
121
|
+
'new-object-listener',
|
|
122
|
+
];
|
|
123
|
+
for (const pattern of sfListenerPatterns) {
|
|
124
|
+
if (this.exists(`.//*[local-name()="${pattern}"]`, flow)) {
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
// JMS, AMQP, Anypoint MQ, File, FTP, SFTP, Email, DB polling listeners
|
|
129
|
+
const otherListenerPatterns = [
|
|
130
|
+
'subscriber', // jms:subscriber, amqp:subscriber
|
|
131
|
+
'consume', // anypoint-mq:subscriber is actually "subscriber" but some use "consume"
|
|
132
|
+
'on-new-file', // file:listener
|
|
133
|
+
'on-new-or-updated-file', // sftp/ftp
|
|
134
|
+
'listener-imap', // email
|
|
135
|
+
'listener-pop3', // email
|
|
136
|
+
'on-new-message', // anypoint-mq
|
|
137
|
+
'on-table-row', // db polling
|
|
138
|
+
];
|
|
139
|
+
for (const pattern of otherListenerPatterns) {
|
|
140
|
+
if (this.exists(`.//*[local-name()="${pattern}"]`, flow)) {
|
|
141
|
+
return true;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
80
146
|
isExternallyReferenced(name) {
|
|
81
147
|
// Common patterns that are typically referenced externally
|
|
82
148
|
const externalPatterns = [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnusedFlowRule.js","sourceRoot":"","sources":["../../../../src/rules/operations/UnusedFlowRule.ts"],"names":[],"mappings":";;;AACA,+CAA4C;AAE5C
|
|
1
|
+
{"version":3,"file":"UnusedFlowRule.js","sourceRoot":"","sources":["../../../../src/rules/operations/UnusedFlowRule.ts"],"names":[],"mappings":";;;AACA,+CAA4C;AAE5C;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAa,cAAe,SAAQ,mBAAQ;IAC1C,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,EAA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
import { BaseRule } from '../base/BaseRule';
|
|
3
|
+
/**
|
|
4
|
+
* HYG-005: Unused Variable
|
|
5
|
+
*
|
|
6
|
+
* Detects variables that are set in a flow but never referenced later
|
|
7
|
+
* in the same flow. This is a common code smell that indicates dead code
|
|
8
|
+
* or incomplete refactoring.
|
|
9
|
+
*
|
|
10
|
+
* Checks for set-variable elements whose variableName is not referenced
|
|
11
|
+
* by any subsequent expression in the same flow via `vars.variableName`
|
|
12
|
+
* or `#[vars.variableName]` patterns.
|
|
13
|
+
*
|
|
14
|
+
* Note: This is a best-effort heuristic — variables consumed outside the
|
|
15
|
+
* flow (via flow-ref caller, for example) cannot be detected.
|
|
16
|
+
*/
|
|
17
|
+
export declare class UnusedVariableRule extends BaseRule {
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
description: string;
|
|
21
|
+
severity: "info";
|
|
22
|
+
category: "operations";
|
|
23
|
+
issueType: IssueType;
|
|
24
|
+
/** Well-known variables that are always considered "used" (consumed by connectors/listeners) */
|
|
25
|
+
private readonly WELL_KNOWN_VARS;
|
|
26
|
+
validate(doc: Document, _context: ValidationContext): Issue[];
|
|
27
|
+
private serializeNode;
|
|
28
|
+
private collectTextContent;
|
|
29
|
+
private escapeRegex;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=UnusedVariableRule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnusedVariableRule.d.ts","sourceRoot":"","sources":["../../../../src/rules/operations/UnusedVariableRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;;;;;;;;;;;;GAaG;AACH,qBAAa,kBAAmB,SAAQ,QAAQ;IAC9C,EAAE,SAAa;IACf,IAAI,SAAqB;IACzB,WAAW,SAAuE;IAClF,QAAQ,EAAG,MAAM,CAAU;IAC3B,QAAQ,EAAG,YAAY,CAAU;IACjC,SAAS,EAAE,SAAS,CAAgB;IAEpC,gGAAgG;IAChG,OAAO,CAAC,QAAQ,CAAC,eAAe,CAK7B;IAEH,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,GAAG,KAAK,EAAE;IAuD7D,OAAO,CAAC,aAAa;IAOrB,OAAO,CAAC,kBAAkB;IAqB1B,OAAO,CAAC,WAAW;CAGpB"}
|