@sfdxy/mule-lint 1.4.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.
Files changed (206) hide show
  1. package/README.md +413 -0
  2. package/dist/bin/mule-lint.d.ts +3 -0
  3. package/dist/bin/mule-lint.d.ts.map +1 -0
  4. package/dist/bin/mule-lint.js +123 -0
  5. package/dist/bin/mule-lint.js.map +1 -0
  6. package/dist/src/core/ComplexityCalculator.d.ts +42 -0
  7. package/dist/src/core/ComplexityCalculator.d.ts.map +1 -0
  8. package/dist/src/core/ComplexityCalculator.js +123 -0
  9. package/dist/src/core/ComplexityCalculator.js.map +1 -0
  10. package/dist/src/core/FileScanner.d.ts +58 -0
  11. package/dist/src/core/FileScanner.d.ts.map +1 -0
  12. package/dist/src/core/FileScanner.js +161 -0
  13. package/dist/src/core/FileScanner.js.map +1 -0
  14. package/dist/src/core/XPathHelper.d.ts +81 -0
  15. package/dist/src/core/XPathHelper.d.ts.map +1 -0
  16. package/dist/src/core/XPathHelper.js +229 -0
  17. package/dist/src/core/XPathHelper.js.map +1 -0
  18. package/dist/src/core/XmlParser.d.ts +38 -0
  19. package/dist/src/core/XmlParser.d.ts.map +1 -0
  20. package/dist/src/core/XmlParser.js +131 -0
  21. package/dist/src/core/XmlParser.js.map +1 -0
  22. package/dist/src/core/YamlParser.d.ts +30 -0
  23. package/dist/src/core/YamlParser.d.ts.map +1 -0
  24. package/dist/src/core/YamlParser.js +120 -0
  25. package/dist/src/core/YamlParser.js.map +1 -0
  26. package/dist/src/core/index.d.ts +4 -0
  27. package/dist/src/core/index.d.ts.map +1 -0
  28. package/dist/src/core/index.js +21 -0
  29. package/dist/src/core/index.js.map +1 -0
  30. package/dist/src/engine/LintEngine.d.ts +60 -0
  31. package/dist/src/engine/LintEngine.d.ts.map +1 -0
  32. package/dist/src/engine/LintEngine.js +271 -0
  33. package/dist/src/engine/LintEngine.js.map +1 -0
  34. package/dist/src/engine/index.d.ts +2 -0
  35. package/dist/src/engine/index.d.ts.map +1 -0
  36. package/dist/src/engine/index.js +18 -0
  37. package/dist/src/engine/index.js.map +1 -0
  38. package/dist/src/formatters/JsonFormatter.d.ts +18 -0
  39. package/dist/src/formatters/JsonFormatter.d.ts.map +1 -0
  40. package/dist/src/formatters/JsonFormatter.js +45 -0
  41. package/dist/src/formatters/JsonFormatter.js.map +1 -0
  42. package/dist/src/formatters/SarifFormatter.d.ts +8 -0
  43. package/dist/src/formatters/SarifFormatter.d.ts.map +1 -0
  44. package/dist/src/formatters/SarifFormatter.js +115 -0
  45. package/dist/src/formatters/SarifFormatter.js.map +1 -0
  46. package/dist/src/formatters/TableFormatter.d.ts +10 -0
  47. package/dist/src/formatters/TableFormatter.d.ts.map +1 -0
  48. package/dist/src/formatters/TableFormatter.js +100 -0
  49. package/dist/src/formatters/TableFormatter.js.map +1 -0
  50. package/dist/src/formatters/index.d.ts +10 -0
  51. package/dist/src/formatters/index.d.ts.map +1 -0
  52. package/dist/src/formatters/index.js +42 -0
  53. package/dist/src/formatters/index.js.map +1 -0
  54. package/dist/src/index.d.ts +6 -0
  55. package/dist/src/index.d.ts.map +1 -0
  56. package/dist/src/index.js +28 -0
  57. package/dist/src/index.js.map +1 -0
  58. package/dist/src/rules/api-led/ApiLedRules.d.ts +42 -0
  59. package/dist/src/rules/api-led/ApiLedRules.d.ts.map +1 -0
  60. package/dist/src/rules/api-led/ApiLedRules.js +95 -0
  61. package/dist/src/rules/api-led/ApiLedRules.js.map +1 -0
  62. package/dist/src/rules/base/BaseRule.d.ts +89 -0
  63. package/dist/src/rules/base/BaseRule.d.ts.map +1 -0
  64. package/dist/src/rules/base/BaseRule.js +137 -0
  65. package/dist/src/rules/base/BaseRule.js.map +1 -0
  66. package/dist/src/rules/complexity/FlowComplexityRule.d.ts +18 -0
  67. package/dist/src/rules/complexity/FlowComplexityRule.d.ts.map +1 -0
  68. package/dist/src/rules/complexity/FlowComplexityRule.js +58 -0
  69. package/dist/src/rules/complexity/FlowComplexityRule.js.map +1 -0
  70. package/dist/src/rules/dataweave/DataWeaveRules.d.ts +45 -0
  71. package/dist/src/rules/dataweave/DataWeaveRules.d.ts.map +1 -0
  72. package/dist/src/rules/dataweave/DataWeaveRules.js +168 -0
  73. package/dist/src/rules/dataweave/DataWeaveRules.js.map +1 -0
  74. package/dist/src/rules/documentation/FlowDescriptionRule.d.ts +16 -0
  75. package/dist/src/rules/documentation/FlowDescriptionRule.d.ts.map +1 -0
  76. package/dist/src/rules/documentation/FlowDescriptionRule.js +33 -0
  77. package/dist/src/rules/documentation/FlowDescriptionRule.js.map +1 -0
  78. package/dist/src/rules/documentation/MissingDocNameRule.d.ts +17 -0
  79. package/dist/src/rules/documentation/MissingDocNameRule.d.ts.map +1 -0
  80. package/dist/src/rules/documentation/MissingDocNameRule.js +44 -0
  81. package/dist/src/rules/documentation/MissingDocNameRule.js.map +1 -0
  82. package/dist/src/rules/error-handling/CorrelationIdRule.d.ts +26 -0
  83. package/dist/src/rules/error-handling/CorrelationIdRule.d.ts.map +1 -0
  84. package/dist/src/rules/error-handling/CorrelationIdRule.js +86 -0
  85. package/dist/src/rules/error-handling/CorrelationIdRule.js.map +1 -0
  86. package/dist/src/rules/error-handling/GenericErrorRule.d.ts +22 -0
  87. package/dist/src/rules/error-handling/GenericErrorRule.d.ts.map +1 -0
  88. package/dist/src/rules/error-handling/GenericErrorRule.js +51 -0
  89. package/dist/src/rules/error-handling/GenericErrorRule.js.map +1 -0
  90. package/dist/src/rules/error-handling/GlobalErrorHandlerRule.d.ts +17 -0
  91. package/dist/src/rules/error-handling/GlobalErrorHandlerRule.d.ts.map +1 -0
  92. package/dist/src/rules/error-handling/GlobalErrorHandlerRule.js +77 -0
  93. package/dist/src/rules/error-handling/GlobalErrorHandlerRule.js.map +1 -0
  94. package/dist/src/rules/error-handling/HttpStatusRule.d.ts +21 -0
  95. package/dist/src/rules/error-handling/HttpStatusRule.d.ts.map +1 -0
  96. package/dist/src/rules/error-handling/HttpStatusRule.js +57 -0
  97. package/dist/src/rules/error-handling/HttpStatusRule.js.map +1 -0
  98. package/dist/src/rules/error-handling/MissingErrorHandlerRule.d.ts +17 -0
  99. package/dist/src/rules/error-handling/MissingErrorHandlerRule.d.ts.map +1 -0
  100. package/dist/src/rules/error-handling/MissingErrorHandlerRule.js +51 -0
  101. package/dist/src/rules/error-handling/MissingErrorHandlerRule.js.map +1 -0
  102. package/dist/src/rules/experimental/ExperimentalRules.d.ts +43 -0
  103. package/dist/src/rules/experimental/ExperimentalRules.d.ts.map +1 -0
  104. package/dist/src/rules/experimental/ExperimentalRules.js +92 -0
  105. package/dist/src/rules/experimental/ExperimentalRules.js.map +1 -0
  106. package/dist/src/rules/http/HttpContentTypeRule.d.ts +17 -0
  107. package/dist/src/rules/http/HttpContentTypeRule.d.ts.map +1 -0
  108. package/dist/src/rules/http/HttpContentTypeRule.js +50 -0
  109. package/dist/src/rules/http/HttpContentTypeRule.js.map +1 -0
  110. package/dist/src/rules/http/HttpTimeoutRule.d.ts +16 -0
  111. package/dist/src/rules/http/HttpTimeoutRule.d.ts.map +1 -0
  112. package/dist/src/rules/http/HttpTimeoutRule.js +33 -0
  113. package/dist/src/rules/http/HttpTimeoutRule.js.map +1 -0
  114. package/dist/src/rules/http/HttpUserAgentRule.d.ts +17 -0
  115. package/dist/src/rules/http/HttpUserAgentRule.d.ts.map +1 -0
  116. package/dist/src/rules/http/HttpUserAgentRule.js +48 -0
  117. package/dist/src/rules/http/HttpUserAgentRule.js.map +1 -0
  118. package/dist/src/rules/index.d.ts +45 -0
  119. package/dist/src/rules/index.d.ts.map +1 -0
  120. package/dist/src/rules/index.js +205 -0
  121. package/dist/src/rules/index.js.map +1 -0
  122. package/dist/src/rules/logging/LoggerCategoryRule.d.ts +21 -0
  123. package/dist/src/rules/logging/LoggerCategoryRule.d.ts.map +1 -0
  124. package/dist/src/rules/logging/LoggerCategoryRule.js +61 -0
  125. package/dist/src/rules/logging/LoggerCategoryRule.js.map +1 -0
  126. package/dist/src/rules/logging/LoggerInUntilSuccessfulRule.d.ts +16 -0
  127. package/dist/src/rules/logging/LoggerInUntilSuccessfulRule.d.ts.map +1 -0
  128. package/dist/src/rules/logging/LoggerInUntilSuccessfulRule.js +29 -0
  129. package/dist/src/rules/logging/LoggerInUntilSuccessfulRule.js.map +1 -0
  130. package/dist/src/rules/logging/LoggerPayloadRule.d.ts +17 -0
  131. package/dist/src/rules/logging/LoggerPayloadRule.d.ts.map +1 -0
  132. package/dist/src/rules/logging/LoggerPayloadRule.js +39 -0
  133. package/dist/src/rules/logging/LoggerPayloadRule.js.map +1 -0
  134. package/dist/src/rules/naming/FlowCasingRule.d.ts +18 -0
  135. package/dist/src/rules/naming/FlowCasingRule.d.ts.map +1 -0
  136. package/dist/src/rules/naming/FlowCasingRule.js +40 -0
  137. package/dist/src/rules/naming/FlowCasingRule.js.map +1 -0
  138. package/dist/src/rules/naming/FlowNamingRule.d.ts +17 -0
  139. package/dist/src/rules/naming/FlowNamingRule.d.ts.map +1 -0
  140. package/dist/src/rules/naming/FlowNamingRule.js +60 -0
  141. package/dist/src/rules/naming/FlowNamingRule.js.map +1 -0
  142. package/dist/src/rules/naming/VariableNamingRule.d.ts +18 -0
  143. package/dist/src/rules/naming/VariableNamingRule.d.ts.map +1 -0
  144. package/dist/src/rules/naming/VariableNamingRule.js +39 -0
  145. package/dist/src/rules/naming/VariableNamingRule.js.map +1 -0
  146. package/dist/src/rules/performance/AsyncErrorHandlerRule.d.ts +16 -0
  147. package/dist/src/rules/performance/AsyncErrorHandlerRule.d.ts.map +1 -0
  148. package/dist/src/rules/performance/AsyncErrorHandlerRule.js +34 -0
  149. package/dist/src/rules/performance/AsyncErrorHandlerRule.js.map +1 -0
  150. package/dist/src/rules/performance/LargeChoiceBlockRule.d.ts +16 -0
  151. package/dist/src/rules/performance/LargeChoiceBlockRule.d.ts.map +1 -0
  152. package/dist/src/rules/performance/LargeChoiceBlockRule.js +32 -0
  153. package/dist/src/rules/performance/LargeChoiceBlockRule.js.map +1 -0
  154. package/dist/src/rules/performance/ScatterGatherRoutesRule.d.ts +16 -0
  155. package/dist/src/rules/performance/ScatterGatherRoutesRule.d.ts.map +1 -0
  156. package/dist/src/rules/performance/ScatterGatherRoutesRule.js +32 -0
  157. package/dist/src/rules/performance/ScatterGatherRoutesRule.js.map +1 -0
  158. package/dist/src/rules/security/HardcodedCredentialsRule.d.ts +19 -0
  159. package/dist/src/rules/security/HardcodedCredentialsRule.d.ts.map +1 -0
  160. package/dist/src/rules/security/HardcodedCredentialsRule.js +66 -0
  161. package/dist/src/rules/security/HardcodedCredentialsRule.js.map +1 -0
  162. package/dist/src/rules/security/HardcodedHttpRule.d.ts +33 -0
  163. package/dist/src/rules/security/HardcodedHttpRule.d.ts.map +1 -0
  164. package/dist/src/rules/security/HardcodedHttpRule.js +108 -0
  165. package/dist/src/rules/security/HardcodedHttpRule.js.map +1 -0
  166. package/dist/src/rules/security/InsecureTlsRule.d.ts +16 -0
  167. package/dist/src/rules/security/InsecureTlsRule.d.ts.map +1 -0
  168. package/dist/src/rules/security/InsecureTlsRule.js +36 -0
  169. package/dist/src/rules/security/InsecureTlsRule.js.map +1 -0
  170. package/dist/src/rules/standards/ChoiceAntiPatternRule.d.ts +17 -0
  171. package/dist/src/rules/standards/ChoiceAntiPatternRule.d.ts.map +1 -0
  172. package/dist/src/rules/standards/ChoiceAntiPatternRule.js +43 -0
  173. package/dist/src/rules/standards/ChoiceAntiPatternRule.js.map +1 -0
  174. package/dist/src/rules/standards/DeprecatedComponentRule.d.ts +17 -0
  175. package/dist/src/rules/standards/DeprecatedComponentRule.d.ts.map +1 -0
  176. package/dist/src/rules/standards/DeprecatedComponentRule.js +37 -0
  177. package/dist/src/rules/standards/DeprecatedComponentRule.js.map +1 -0
  178. package/dist/src/rules/standards/DwlStandardsRule.d.ts +22 -0
  179. package/dist/src/rules/standards/DwlStandardsRule.d.ts.map +1 -0
  180. package/dist/src/rules/standards/DwlStandardsRule.js +90 -0
  181. package/dist/src/rules/standards/DwlStandardsRule.js.map +1 -0
  182. package/dist/src/rules/structure/StructureRules.d.ts +45 -0
  183. package/dist/src/rules/structure/StructureRules.d.ts.map +1 -0
  184. package/dist/src/rules/structure/StructureRules.js +163 -0
  185. package/dist/src/rules/structure/StructureRules.js.map +1 -0
  186. package/dist/src/rules/yaml/YamlRules.d.ts +46 -0
  187. package/dist/src/rules/yaml/YamlRules.d.ts.map +1 -0
  188. package/dist/src/rules/yaml/YamlRules.js +226 -0
  189. package/dist/src/rules/yaml/YamlRules.js.map +1 -0
  190. package/dist/src/types/Config.d.ts +50 -0
  191. package/dist/src/types/Config.d.ts.map +1 -0
  192. package/dist/src/types/Config.js +18 -0
  193. package/dist/src/types/Config.js.map +1 -0
  194. package/dist/src/types/Report.d.ts +47 -0
  195. package/dist/src/types/Report.d.ts.map +1 -0
  196. package/dist/src/types/Report.js +3 -0
  197. package/dist/src/types/Report.js.map +1 -0
  198. package/dist/src/types/Rule.d.ts +76 -0
  199. package/dist/src/types/Rule.d.ts.map +1 -0
  200. package/dist/src/types/Rule.js +3 -0
  201. package/dist/src/types/Rule.js.map +1 -0
  202. package/dist/src/types/index.d.ts +4 -0
  203. package/dist/src/types/index.d.ts.map +1 -0
  204. package/dist/src/types/index.js +21 -0
  205. package/dist/src/types/index.js.map +1 -0
  206. package/package.json +70 -0
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VariableNamingRule = void 0;
4
+ const BaseRule_1 = require("../base/BaseRule");
5
+ /**
6
+ * MULE-102: Variable Naming Convention
7
+ *
8
+ * Variables should follow camelCase naming.
9
+ */
10
+ class VariableNamingRule extends BaseRule_1.BaseRule {
11
+ id = 'MULE-102';
12
+ name = 'Variable Naming Convention';
13
+ description = 'Variables should follow camelCase naming';
14
+ severity = 'warning';
15
+ category = 'naming';
16
+ CAMEL_CASE_PATTERN = /^[a-z][a-zA-Z0-9]*$/;
17
+ validate(doc, _context) {
18
+ const issues = [];
19
+ const setVariables = this.select('//mule:set-variable', doc);
20
+ for (const setVar of setVariables) {
21
+ const varName = this.getAttribute(setVar, 'variableName');
22
+ if (!varName)
23
+ continue;
24
+ if (!this.CAMEL_CASE_PATTERN.test(varName)) {
25
+ issues.push(this.createIssue(setVar, `Variable "${varName}" should be camelCase`, {
26
+ suggestion: `Rename to "${this.toCamelCase(varName)}"`
27
+ }));
28
+ }
29
+ }
30
+ return issues;
31
+ }
32
+ toCamelCase(name) {
33
+ return name
34
+ .replace(/[-_\s]+(.)?/g, (_, c) => c ? c.toUpperCase() : '')
35
+ .replace(/^[A-Z]/, c => c.toLowerCase());
36
+ }
37
+ }
38
+ exports.VariableNamingRule = VariableNamingRule;
39
+ //# sourceMappingURL=VariableNamingRule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VariableNamingRule.js","sourceRoot":"","sources":["../../../../src/rules/naming/VariableNamingRule.ts"],"names":[],"mappings":";;;AACA,+CAA4C;AAE5C;;;;GAIG;AACH,MAAa,kBAAmB,SAAQ,mBAAQ;IAC5C,EAAE,GAAG,UAAU,CAAC;IAChB,IAAI,GAAG,4BAA4B,CAAC;IACpC,WAAW,GAAG,0CAA0C,CAAC;IACzD,QAAQ,GAAG,SAAkB,CAAC;IAC9B,QAAQ,GAAG,QAAiB,CAAC;IAEZ,kBAAkB,GAAG,qBAAqB,CAAC;IAE5D,QAAQ,CAAC,GAAa,EAAE,QAA2B;QAC/C,MAAM,MAAM,GAAY,EAAE,CAAC;QAE3B,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,qBAAqB,EAAE,GAAG,CAAC,CAAC;QAE7D,KAAK,MAAM,MAAM,IAAI,YAAY,EAAE,CAAC;YAChC,MAAM,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;YAC1D,IAAI,CAAC,OAAO;gBAAE,SAAS;YAEvB,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;gBACzC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CACxB,MAAM,EACN,aAAa,OAAO,uBAAuB,EAC3C;oBACI,UAAU,EAAE,cAAc,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,GAAG;iBACzD,CACJ,CAAC,CAAC;YACP,CAAC;QACL,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;IAEO,WAAW,CAAC,IAAY;QAC5B,OAAO,IAAI;aACN,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAC3D,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;IACjD,CAAC;CACJ;AArCD,gDAqCC"}
@@ -0,0 +1,16 @@
1
+ import { ValidationContext, Issue } from '../../types';
2
+ import { BaseRule } from '../base/BaseRule';
3
+ /**
4
+ * MULE-502: Async Without Error Handler
5
+ *
6
+ * Async scopes should have their own error handling.
7
+ */
8
+ export declare class AsyncErrorHandlerRule 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=AsyncErrorHandlerRule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AsyncErrorHandlerRule.d.ts","sourceRoot":"","sources":["../../../../src/rules/performance/AsyncErrorHandlerRule.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,qBAAsB,SAAQ,QAAQ;IAC/C,EAAE,SAAc;IAChB,IAAI,SAAiC;IACrC,WAAW,SAAuD;IAClE,QAAQ,EAAG,SAAS,CAAU;IAC9B,QAAQ,EAAG,aAAa,CAAU;IAElC,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,GAAG,KAAK,EAAE;CAwBhE"}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AsyncErrorHandlerRule = void 0;
4
+ const BaseRule_1 = require("../base/BaseRule");
5
+ /**
6
+ * MULE-502: Async Without Error Handler
7
+ *
8
+ * Async scopes should have their own error handling.
9
+ */
10
+ class AsyncErrorHandlerRule extends BaseRule_1.BaseRule {
11
+ id = 'MULE-502';
12
+ name = 'Async Without Error Handler';
13
+ description = 'Async scopes should have their own error handling';
14
+ severity = 'warning';
15
+ category = 'performance';
16
+ validate(doc, _context) {
17
+ const issues = [];
18
+ const asyncScopes = this.select('//mule:async', doc);
19
+ for (const async of asyncScopes) {
20
+ // Check if async has error-handler or try scope
21
+ const hasErrorHandling = this.exists('./mule:error-handler', async) ||
22
+ this.exists('./mule:try', async);
23
+ if (!hasErrorHandling) {
24
+ const docName = this.getDocName(async) ?? 'Async scope';
25
+ issues.push(this.createIssue(async, `${docName} has no error handling - errors won't propagate to parent`, {
26
+ suggestion: 'Add error-handler or wrap content in try scope'
27
+ }));
28
+ }
29
+ }
30
+ return issues;
31
+ }
32
+ }
33
+ exports.AsyncErrorHandlerRule = AsyncErrorHandlerRule;
34
+ //# sourceMappingURL=AsyncErrorHandlerRule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AsyncErrorHandlerRule.js","sourceRoot":"","sources":["../../../../src/rules/performance/AsyncErrorHandlerRule.ts"],"names":[],"mappings":";;;AACA,+CAA4C;AAE5C;;;;GAIG;AACH,MAAa,qBAAsB,SAAQ,mBAAQ;IAC/C,EAAE,GAAG,UAAU,CAAC;IAChB,IAAI,GAAG,6BAA6B,CAAC;IACrC,WAAW,GAAG,mDAAmD,CAAC;IAClE,QAAQ,GAAG,SAAkB,CAAC;IAC9B,QAAQ,GAAG,aAAsB,CAAC;IAElC,QAAQ,CAAC,GAAa,EAAE,QAA2B;QAC/C,MAAM,MAAM,GAAY,EAAE,CAAC;QAE3B,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC;QAErD,KAAK,MAAM,KAAK,IAAI,WAAW,EAAE,CAAC;YAC9B,gDAAgD;YAChD,MAAM,gBAAgB,GAAG,IAAI,CAAC,MAAM,CAAC,sBAAsB,EAAE,KAAiB,CAAC;gBAC3E,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,KAAiB,CAAC,CAAC;YAEjD,IAAI,CAAC,gBAAgB,EAAE,CAAC;gBACpB,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,aAAa,CAAC;gBACxD,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CACxB,KAAK,EACL,GAAG,OAAO,2DAA2D,EACrE;oBACI,UAAU,EAAE,gDAAgD;iBAC/D,CACJ,CAAC,CAAC;YACP,CAAC;QACL,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AA/BD,sDA+BC"}
@@ -0,0 +1,16 @@
1
+ import { ValidationContext, Issue } from '../../types';
2
+ import { BaseRule } from '../base/BaseRule';
3
+ /**
4
+ * MULE-503: Large Choice Blocks
5
+ *
6
+ * Choice blocks with many when clauses should be refactored.
7
+ */
8
+ export declare class LargeChoiceBlockRule 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=LargeChoiceBlockRule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LargeChoiceBlockRule.d.ts","sourceRoot":"","sources":["../../../../src/rules/performance/LargeChoiceBlockRule.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,SAAc;IAChB,IAAI,SAAyB;IAC7B,WAAW,SAA+D;IAC1E,QAAQ,EAAG,SAAS,CAAU;IAC9B,QAAQ,EAAG,aAAa,CAAU;IAElC,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,iBAAiB,GAAG,KAAK,EAAE;CAsB/D"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LargeChoiceBlockRule = void 0;
4
+ const BaseRule_1 = require("../base/BaseRule");
5
+ /**
6
+ * MULE-503: Large Choice Blocks
7
+ *
8
+ * Choice blocks with many when clauses should be refactored.
9
+ */
10
+ class LargeChoiceBlockRule extends BaseRule_1.BaseRule {
11
+ id = 'MULE-503';
12
+ name = 'Large Choice Blocks';
13
+ description = 'Choice blocks with many when clauses should be refactored';
14
+ severity = 'warning';
15
+ category = 'performance';
16
+ validate(doc, context) {
17
+ const issues = [];
18
+ const maxWhenClauses = this.getOption(context, 'maxWhenClauses', 7);
19
+ const choices = this.select('//mule:choice', doc);
20
+ for (const choice of choices) {
21
+ const whenClauses = this.select('./mule:when', choice);
22
+ if (whenClauses.length > maxWhenClauses) {
23
+ issues.push(this.createIssue(choice, `Choice has ${whenClauses.length} when clauses (max recommended: ${maxWhenClauses})`, {
24
+ suggestion: 'Consider using DataWeave lookup table or flow-ref with dynamic routing'
25
+ }));
26
+ }
27
+ }
28
+ return issues;
29
+ }
30
+ }
31
+ exports.LargeChoiceBlockRule = LargeChoiceBlockRule;
32
+ //# sourceMappingURL=LargeChoiceBlockRule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LargeChoiceBlockRule.js","sourceRoot":"","sources":["../../../../src/rules/performance/LargeChoiceBlockRule.ts"],"names":[],"mappings":";;;AACA,+CAA4C;AAE5C;;;;GAIG;AACH,MAAa,oBAAqB,SAAQ,mBAAQ;IAC9C,EAAE,GAAG,UAAU,CAAC;IAChB,IAAI,GAAG,qBAAqB,CAAC;IAC7B,WAAW,GAAG,2DAA2D,CAAC;IAC1E,QAAQ,GAAG,SAAkB,CAAC;IAC9B,QAAQ,GAAG,aAAsB,CAAC;IAElC,QAAQ,CAAC,GAAa,EAAE,OAA0B;QAC9C,MAAM,MAAM,GAAY,EAAE,CAAC;QAC3B,MAAM,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,gBAAgB,EAAE,CAAC,CAAC,CAAC;QAEpE,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC;QAElD,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC3B,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,MAAkB,CAAC,CAAC;YAEnE,IAAI,WAAW,CAAC,MAAM,GAAG,cAAc,EAAE,CAAC;gBACtC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CACxB,MAAM,EACN,cAAc,WAAW,CAAC,MAAM,mCAAmC,cAAc,GAAG,EACpF;oBACI,UAAU,EAAE,wEAAwE;iBACvF,CACJ,CAAC,CAAC;YACP,CAAC;QACL,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AA7BD,oDA6BC"}
@@ -0,0 +1,16 @@
1
+ import { ValidationContext, Issue } from '../../types';
2
+ import { BaseRule } from '../base/BaseRule';
3
+ /**
4
+ * MULE-501: Scatter-Gather Route Count
5
+ *
6
+ * Scatter-gather with many routes may cause memory issues.
7
+ */
8
+ export declare class ScatterGatherRoutesRule extends BaseRule {
9
+ id: string;
10
+ name: string;
11
+ description: string;
12
+ severity: "info";
13
+ category: "performance";
14
+ validate(doc: Document, context: ValidationContext): Issue[];
15
+ }
16
+ //# sourceMappingURL=ScatterGatherRoutesRule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScatterGatherRoutesRule.d.ts","sourceRoot":"","sources":["../../../../src/rules/performance/ScatterGatherRoutesRule.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,SAAc;IAChB,IAAI,SAAgC;IACpC,WAAW,SAA6D;IACxE,QAAQ,EAAG,MAAM,CAAU;IAC3B,QAAQ,EAAG,aAAa,CAAU;IAElC,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,iBAAiB,GAAG,KAAK,EAAE;CAsB/D"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ScatterGatherRoutesRule = void 0;
4
+ const BaseRule_1 = require("../base/BaseRule");
5
+ /**
6
+ * MULE-501: Scatter-Gather Route Count
7
+ *
8
+ * Scatter-gather with many routes may cause memory issues.
9
+ */
10
+ class ScatterGatherRoutesRule extends BaseRule_1.BaseRule {
11
+ id = 'MULE-501';
12
+ name = 'Scatter-Gather Route Count';
13
+ description = 'Scatter-gather with many routes may cause memory issues';
14
+ severity = 'info';
15
+ category = 'performance';
16
+ validate(doc, context) {
17
+ const issues = [];
18
+ const maxRoutes = this.getOption(context, 'maxRoutes', 5);
19
+ const scatterGathers = this.select('//mule:scatter-gather', doc);
20
+ for (const sg of scatterGathers) {
21
+ const routes = this.select('./mule:route', sg);
22
+ if (routes.length > maxRoutes) {
23
+ issues.push(this.createIssue(sg, `Scatter-gather has ${routes.length} routes (max recommended: ${maxRoutes})`, {
24
+ suggestion: 'Consider using batch processing for large parallel operations'
25
+ }));
26
+ }
27
+ }
28
+ return issues;
29
+ }
30
+ }
31
+ exports.ScatterGatherRoutesRule = ScatterGatherRoutesRule;
32
+ //# sourceMappingURL=ScatterGatherRoutesRule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScatterGatherRoutesRule.js","sourceRoot":"","sources":["../../../../src/rules/performance/ScatterGatherRoutesRule.ts"],"names":[],"mappings":";;;AACA,+CAA4C;AAE5C;;;;GAIG;AACH,MAAa,uBAAwB,SAAQ,mBAAQ;IACjD,EAAE,GAAG,UAAU,CAAC;IAChB,IAAI,GAAG,4BAA4B,CAAC;IACpC,WAAW,GAAG,yDAAyD,CAAC;IACxE,QAAQ,GAAG,MAAe,CAAC;IAC3B,QAAQ,GAAG,aAAsB,CAAC;IAElC,QAAQ,CAAC,GAAa,EAAE,OAA0B;QAC9C,MAAM,MAAM,GAAY,EAAE,CAAC;QAC3B,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC;QAE1D,MAAM,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC,uBAAuB,EAAE,GAAG,CAAC,CAAC;QAEjE,KAAK,MAAM,EAAE,IAAI,cAAc,EAAE,CAAC;YAC9B,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,EAAc,CAAC,CAAC;YAE3D,IAAI,MAAM,CAAC,MAAM,GAAG,SAAS,EAAE,CAAC;gBAC5B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CACxB,EAAE,EACF,sBAAsB,MAAM,CAAC,MAAM,6BAA6B,SAAS,GAAG,EAC5E;oBACI,UAAU,EAAE,+DAA+D;iBAC9E,CACJ,CAAC,CAAC;YACP,CAAC;QACL,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AA7BD,0DA6BC"}
@@ -0,0 +1,19 @@
1
+ import { ValidationContext, Issue } from '../../types';
2
+ import { BaseRule } from '../base/BaseRule';
3
+ /**
4
+ * MULE-201: Hardcoded Credentials
5
+ *
6
+ * Passwords and secrets should use secure property placeholders.
7
+ */
8
+ export declare class HardcodedCredentialsRule extends BaseRule {
9
+ id: string;
10
+ name: string;
11
+ description: string;
12
+ severity: "error";
13
+ category: "security";
14
+ private readonly SENSITIVE_ATTRS;
15
+ validate(doc: Document, _context: ValidationContext): Issue[];
16
+ private isSensitiveAttribute;
17
+ private isHardcoded;
18
+ }
19
+ //# sourceMappingURL=HardcodedCredentialsRule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HardcodedCredentialsRule.d.ts","sourceRoot":"","sources":["../../../../src/rules/security/HardcodedCredentialsRule.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,SAAc;IAChB,IAAI,SAA2B;IAC/B,WAAW,SAA+E;IAC1F,QAAQ,EAAG,OAAO,CAAU;IAC5B,QAAQ,EAAG,UAAU,CAAU;IAE/B,OAAO,CAAC,QAAQ,CAAC,eAAe,CAU9B;IAEF,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,GAAG,KAAK,EAAE;IA6B7D,OAAO,CAAC,oBAAoB;IAM5B,OAAO,CAAC,WAAW;CActB"}
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HardcodedCredentialsRule = void 0;
4
+ const BaseRule_1 = require("../base/BaseRule");
5
+ /**
6
+ * MULE-201: Hardcoded Credentials
7
+ *
8
+ * Passwords and secrets should use secure property placeholders.
9
+ */
10
+ class HardcodedCredentialsRule extends BaseRule_1.BaseRule {
11
+ id = 'MULE-201';
12
+ name = 'Hardcoded Credentials';
13
+ description = 'Passwords and secrets should use secure property placeholders ${secure::}';
14
+ severity = 'error';
15
+ category = 'security';
16
+ SENSITIVE_ATTRS = [
17
+ 'password',
18
+ 'secret',
19
+ 'clientSecret',
20
+ 'client-secret',
21
+ 'apiKey',
22
+ 'api-key',
23
+ 'token',
24
+ 'accessToken',
25
+ 'privateKey',
26
+ ];
27
+ validate(doc, _context) {
28
+ const issues = [];
29
+ const allElements = doc.getElementsByTagName('*');
30
+ for (let i = 0; i < allElements.length; i++) {
31
+ const element = allElements[i];
32
+ const attrs = element.attributes;
33
+ for (let j = 0; j < attrs.length; j++) {
34
+ const attr = attrs[j];
35
+ const attrName = attr.name.toLowerCase();
36
+ const value = attr.value;
37
+ // Check if this is a sensitive attribute
38
+ if (this.isSensitiveAttribute(attrName) && this.isHardcoded(value)) {
39
+ issues.push(this.createIssue(element, `Hardcoded ${attr.name} found - use secure property placeholder`, {
40
+ suggestion: `Use \${secure::${attr.name}} instead of hardcoded value`
41
+ }));
42
+ }
43
+ }
44
+ }
45
+ return issues;
46
+ }
47
+ isSensitiveAttribute(attrName) {
48
+ return this.SENSITIVE_ATTRS.some(sensitive => attrName.includes(sensitive.toLowerCase()));
49
+ }
50
+ isHardcoded(value) {
51
+ // Empty values are not hardcoded
52
+ if (!value || value.trim() === '')
53
+ return false;
54
+ // Ignore boolean/numeric flags (e.g. useToken="true", timeout="1000")
55
+ if (value === 'true' || value === 'false' || !isNaN(Number(value)))
56
+ return false;
57
+ // Check for secure property placeholder
58
+ // Must start with ${secure:: and end with }
59
+ if (value.startsWith('${secure::') && value.endsWith('}'))
60
+ return false;
61
+ // Any other value is considered "hardcoded" or "insecure" in this context
62
+ return true;
63
+ }
64
+ }
65
+ exports.HardcodedCredentialsRule = HardcodedCredentialsRule;
66
+ //# sourceMappingURL=HardcodedCredentialsRule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HardcodedCredentialsRule.js","sourceRoot":"","sources":["../../../../src/rules/security/HardcodedCredentialsRule.ts"],"names":[],"mappings":";;;AACA,+CAA4C;AAE5C;;;;GAIG;AACH,MAAa,wBAAyB,SAAQ,mBAAQ;IAClD,EAAE,GAAG,UAAU,CAAC;IAChB,IAAI,GAAG,uBAAuB,CAAC;IAC/B,WAAW,GAAG,2EAA2E,CAAC;IAC1F,QAAQ,GAAG,OAAgB,CAAC;IAC5B,QAAQ,GAAG,UAAmB,CAAC;IAEd,eAAe,GAAG;QAC/B,UAAU;QACV,QAAQ;QACR,cAAc;QACd,eAAe;QACf,QAAQ;QACR,SAAS;QACT,OAAO;QACP,aAAa;QACb,YAAY;KACf,CAAC;IAEF,QAAQ,CAAC,GAAa,EAAE,QAA2B;QAC/C,MAAM,MAAM,GAAY,EAAE,CAAC;QAC3B,MAAM,WAAW,GAAG,GAAG,CAAC,oBAAoB,CAAC,GAAG,CAAC,CAAC;QAElD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC1C,MAAM,OAAO,GAAG,WAAW,CAAC,CAAC,CAAY,CAAC;YAC1C,MAAM,KAAK,GAAG,OAAO,CAAC,UAAU,CAAC;YAEjC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBACpC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;gBACtB,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;gBACzC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;gBAEzB,yCAAyC;gBACzC,IAAI,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;oBACjE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CACxB,OAAO,EACP,aAAa,IAAI,CAAC,IAAI,0CAA0C,EAChE;wBACI,UAAU,EAAE,kBAAkB,IAAI,CAAC,IAAI,8BAA8B;qBACxE,CACJ,CAAC,CAAC;gBACP,CAAC;YACL,CAAC;QACL,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;IAEO,oBAAoB,CAAC,QAAgB;QACzC,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CACzC,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,CAC7C,CAAC;IACN,CAAC;IAEO,WAAW,CAAC,KAAa;QAC7B,iCAAiC;QACjC,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE;YAAE,OAAO,KAAK,CAAC;QAEhD,sEAAsE;QACtE,IAAI,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAAE,OAAO,KAAK,CAAC;QAEjF,wCAAwC;QACxC,4CAA4C;QAC5C,IAAI,KAAK,CAAC,UAAU,CAAC,YAAY,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC;YAAE,OAAO,KAAK,CAAC;QAExE,0EAA0E;QAC1E,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AApED,4DAoEC"}
@@ -0,0 +1,33 @@
1
+ import { ValidationContext, Issue } from '../../types';
2
+ import { BaseRule } from '../base/BaseRule';
3
+ /**
4
+ * MULE-004: Hardcoded HTTP URLs
5
+ *
6
+ * HTTP/HTTPS URLs should use property placeholders, not hardcoded values.
7
+ * Hardcoded URLs make environment promotion difficult and can lead to errors.
8
+ */
9
+ export declare class HardcodedHttpRule extends BaseRule {
10
+ id: string;
11
+ name: string;
12
+ description: string;
13
+ severity: "error";
14
+ category: "security";
15
+ private readonly URL_PATTERN;
16
+ private readonly ALLOWED_PATTERNS;
17
+ private readonly IGNORED_ATTRIBUTES;
18
+ private readonly URL_ATTRIBUTES;
19
+ validate(doc: Document, _context: ValidationContext): Issue[];
20
+ /**
21
+ * Check if a value is a hardcoded URL
22
+ */
23
+ private isHardcodedUrl;
24
+ /**
25
+ * Check if an attribute should be ignored
26
+ */
27
+ private isIgnoredAttribute;
28
+ /**
29
+ * Truncate long URLs for display
30
+ */
31
+ private truncate;
32
+ }
33
+ //# sourceMappingURL=HardcodedHttpRule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HardcodedHttpRule.d.ts","sourceRoot":"","sources":["../../../../src/rules/security/HardcodedHttpRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;;;;GAKG;AACH,qBAAa,iBAAkB,SAAQ,QAAQ;IAC3C,EAAE,SAAc;IAChB,IAAI,SAAyB;IAC7B,WAAW,SAAkF;IAC7F,QAAQ,EAAG,OAAO,CAAU;IAC5B,QAAQ,EAAG,UAAU,CAAU;IAG/B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAmB;IAG/C,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAI/B;IAGF,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAIjC;IAGF,OAAO,CAAC,QAAQ,CAAC,cAAc,CAQ7B;IAEF,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,GAAG,KAAK,EAAE;IAoC7D;;OAEG;IACH,OAAO,CAAC,cAAc;IAiBtB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAY1B;;OAEG;IACH,OAAO,CAAC,QAAQ;CAMnB"}
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HardcodedHttpRule = void 0;
4
+ const BaseRule_1 = require("../base/BaseRule");
5
+ /**
6
+ * MULE-004: Hardcoded HTTP URLs
7
+ *
8
+ * HTTP/HTTPS URLs should use property placeholders, not hardcoded values.
9
+ * Hardcoded URLs make environment promotion difficult and can lead to errors.
10
+ */
11
+ class HardcodedHttpRule extends BaseRule_1.BaseRule {
12
+ id = 'MULE-004';
13
+ name = 'Hardcoded HTTP URLs';
14
+ description = 'HTTP/HTTPS URLs should use property placeholders instead of hardcoded values';
15
+ severity = 'error';
16
+ category = 'security';
17
+ // URL patterns to detect
18
+ URL_PATTERN = /^https?:\/\//i;
19
+ // Patterns that indicate the value is dynamic (allowed)
20
+ ALLOWED_PATTERNS = [
21
+ /\$\{[^}]+\}/, // Property placeholders ${...}
22
+ /#\[[^\]]+\]/, // DataWeave expressions #[...]
23
+ /p\(['"]/, // Property function p('...')
24
+ ];
25
+ // Attributes that should be ignored (not user-configurable URLs)
26
+ IGNORED_ATTRIBUTES = [
27
+ 'xmlns',
28
+ 'xsi:schemaLocation',
29
+ 'schemaLocation',
30
+ ];
31
+ // Attributes to check for URLs
32
+ URL_ATTRIBUTES = [
33
+ 'url',
34
+ 'host',
35
+ 'path',
36
+ 'value',
37
+ 'uri',
38
+ 'address',
39
+ 'endpoint',
40
+ ];
41
+ validate(doc, _context) {
42
+ const issues = [];
43
+ // Get all elements and check their attributes
44
+ const allElements = doc.getElementsByTagName('*');
45
+ for (let i = 0; i < allElements.length; i++) {
46
+ const element = allElements[i];
47
+ const attrs = element.attributes;
48
+ for (let j = 0; j < attrs.length; j++) {
49
+ const attr = attrs[j];
50
+ const attrName = attr.name;
51
+ const value = attr.value;
52
+ // Skip namespace declarations and schema locations
53
+ if (this.isIgnoredAttribute(attrName)) {
54
+ continue;
55
+ }
56
+ // Check if this looks like a hardcoded URL
57
+ if (this.isHardcodedUrl(value)) {
58
+ issues.push(this.createIssue(element, `Hardcoded URL "${this.truncate(value)}" found in attribute "${attrName}"`, {
59
+ suggestion: 'Use property placeholder: ${http.baseUrl} or ${env.api.host}'
60
+ }));
61
+ }
62
+ }
63
+ }
64
+ return issues;
65
+ }
66
+ /**
67
+ * Check if a value is a hardcoded URL
68
+ */
69
+ isHardcodedUrl(value) {
70
+ // Must match URL pattern
71
+ if (!this.URL_PATTERN.test(value)) {
72
+ return false;
73
+ }
74
+ // Check if it contains any allowed dynamic pattern
75
+ for (const pattern of this.ALLOWED_PATTERNS) {
76
+ if (pattern.test(value)) {
77
+ return false;
78
+ }
79
+ }
80
+ // It's a hardcoded URL
81
+ return true;
82
+ }
83
+ /**
84
+ * Check if an attribute should be ignored
85
+ */
86
+ isIgnoredAttribute(attrName) {
87
+ // Check exact match
88
+ if (this.IGNORED_ATTRIBUTES.includes(attrName)) {
89
+ return true;
90
+ }
91
+ // Check for xmlns: prefixed attributes
92
+ if (attrName.startsWith('xmlns:')) {
93
+ return true;
94
+ }
95
+ return false;
96
+ }
97
+ /**
98
+ * Truncate long URLs for display
99
+ */
100
+ truncate(value, maxLen = 50) {
101
+ if (value.length <= maxLen) {
102
+ return value;
103
+ }
104
+ return value.substring(0, maxLen) + '...';
105
+ }
106
+ }
107
+ exports.HardcodedHttpRule = HardcodedHttpRule;
108
+ //# sourceMappingURL=HardcodedHttpRule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HardcodedHttpRule.js","sourceRoot":"","sources":["../../../../src/rules/security/HardcodedHttpRule.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,16 @@
1
+ import { ValidationContext, Issue } from '../../types';
2
+ import { BaseRule } from '../base/BaseRule';
3
+ /**
4
+ * MULE-202: Insecure TLS Configuration
5
+ *
6
+ * TLS configurations should not disable certificate verification.
7
+ */
8
+ export declare class InsecureTlsRule extends BaseRule {
9
+ id: string;
10
+ name: string;
11
+ description: string;
12
+ severity: "error";
13
+ category: "security";
14
+ validate(doc: Document, _context: ValidationContext): Issue[];
15
+ }
16
+ //# sourceMappingURL=InsecureTlsRule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InsecureTlsRule.d.ts","sourceRoot":"","sources":["../../../../src/rules/security/InsecureTlsRule.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,SAAc;IAChB,IAAI,SAAgC;IACpC,WAAW,SAAoE;IAC/E,QAAQ,EAAG,OAAO,CAAU;IAC5B,QAAQ,EAAG,UAAU,CAAU;IAE/B,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,GAAG,KAAK,EAAE;CAqChE"}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InsecureTlsRule = void 0;
4
+ const BaseRule_1 = require("../base/BaseRule");
5
+ /**
6
+ * MULE-202: Insecure TLS Configuration
7
+ *
8
+ * TLS configurations should not disable certificate verification.
9
+ */
10
+ class InsecureTlsRule extends BaseRule_1.BaseRule {
11
+ id = 'MULE-202';
12
+ name = 'Insecure TLS Configuration';
13
+ description = 'TLS configurations should not disable certificate verification';
14
+ severity = 'error';
15
+ category = 'security';
16
+ validate(doc, _context) {
17
+ const issues = [];
18
+ // Find insecure trust-store configurations
19
+ const insecureTrustStores = this.select('//*[local-name()="trust-store"][@insecure="true"]', doc);
20
+ for (const trustStore of insecureTrustStores) {
21
+ issues.push(this.createIssue(trustStore, 'TLS trust-store has insecure="true" - certificates not verified', {
22
+ suggestion: 'Remove insecure="true" and configure proper certificate validation'
23
+ }));
24
+ }
25
+ // Find insecure key-store configurations
26
+ const insecureKeyStores = this.select('//*[local-name()="key-store"][@insecure="true"]', doc);
27
+ for (const keyStore of insecureKeyStores) {
28
+ issues.push(this.createIssue(keyStore, 'TLS key-store has insecure="true"', {
29
+ suggestion: 'Remove insecure="true" and use proper key management'
30
+ }));
31
+ }
32
+ return issues;
33
+ }
34
+ }
35
+ exports.InsecureTlsRule = InsecureTlsRule;
36
+ //# sourceMappingURL=InsecureTlsRule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InsecureTlsRule.js","sourceRoot":"","sources":["../../../../src/rules/security/InsecureTlsRule.ts"],"names":[],"mappings":";;;AACA,+CAA4C;AAE5C;;;;GAIG;AACH,MAAa,eAAgB,SAAQ,mBAAQ;IACzC,EAAE,GAAG,UAAU,CAAC;IAChB,IAAI,GAAG,4BAA4B,CAAC;IACpC,WAAW,GAAG,gEAAgE,CAAC;IAC/E,QAAQ,GAAG,OAAgB,CAAC;IAC5B,QAAQ,GAAG,UAAmB,CAAC;IAE/B,QAAQ,CAAC,GAAa,EAAE,QAA2B;QAC/C,MAAM,MAAM,GAAY,EAAE,CAAC;QAE3B,2CAA2C;QAC3C,MAAM,mBAAmB,GAAG,IAAI,CAAC,MAAM,CACnC,mDAAmD,EACnD,GAAG,CACN,CAAC;QAEF,KAAK,MAAM,UAAU,IAAI,mBAAmB,EAAE,CAAC;YAC3C,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CACxB,UAAU,EACV,iEAAiE,EACjE;gBACI,UAAU,EAAE,oEAAoE;aACnF,CACJ,CAAC,CAAC;QACP,CAAC;QAED,yCAAyC;QACzC,MAAM,iBAAiB,GAAG,IAAI,CAAC,MAAM,CACjC,iDAAiD,EACjD,GAAG,CACN,CAAC;QAEF,KAAK,MAAM,QAAQ,IAAI,iBAAiB,EAAE,CAAC;YACvC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CACxB,QAAQ,EACR,mCAAmC,EACnC;gBACI,UAAU,EAAE,sDAAsD;aACrE,CACJ,CAAC,CAAC;QACP,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AA5CD,0CA4CC"}
@@ -0,0 +1,17 @@
1
+ import { ValidationContext, Issue } from '../../types';
2
+ import { BaseRule } from '../base/BaseRule';
3
+ /**
4
+ * MULE-008: Choice Anti-Pattern
5
+ *
6
+ * Avoid using raise-error directly inside choice/otherwise blocks.
7
+ * This is an anti-pattern - use a more descriptive error type instead.
8
+ */
9
+ export declare class ChoiceAntiPatternRule extends BaseRule {
10
+ id: string;
11
+ name: string;
12
+ description: string;
13
+ severity: "warning";
14
+ category: "standards";
15
+ validate(doc: Document, _context: ValidationContext): Issue[];
16
+ }
17
+ //# sourceMappingURL=ChoiceAntiPatternRule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChoiceAntiPatternRule.d.ts","sourceRoot":"","sources":["../../../../src/rules/standards/ChoiceAntiPatternRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;;;;GAKG;AACH,qBAAa,qBAAsB,SAAQ,QAAQ;IAC/C,EAAE,SAAc;IAChB,IAAI,SAAyB;IAC7B,WAAW,SAAkF;IAC7F,QAAQ,EAAG,SAAS,CAAU;IAC9B,QAAQ,EAAG,WAAW,CAAU;IAEhC,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,GAAG,KAAK,EAAE;CA6ChE"}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ChoiceAntiPatternRule = void 0;
4
+ const BaseRule_1 = require("../base/BaseRule");
5
+ /**
6
+ * MULE-008: Choice Anti-Pattern
7
+ *
8
+ * Avoid using raise-error directly inside choice/otherwise blocks.
9
+ * This is an anti-pattern - use a more descriptive error type instead.
10
+ */
11
+ class ChoiceAntiPatternRule extends BaseRule_1.BaseRule {
12
+ id = 'MULE-008';
13
+ name = 'Choice Anti-Pattern';
14
+ description = 'Avoid raise-error directly in choice/otherwise - use descriptive error types';
15
+ severity = 'warning';
16
+ category = 'standards';
17
+ validate(doc, _context) {
18
+ const issues = [];
19
+ // Find raise-error directly in otherwise blocks
20
+ const raiseErrorsInOtherwise = this.select('//mule:choice/mule:otherwise/mule:raise-error', doc);
21
+ for (const raiseError of raiseErrorsInOtherwise) {
22
+ const errorType = this.getAttribute(raiseError, 'type') ?? 'unknown';
23
+ issues.push(this.createIssue(raiseError, `raise-error with type="${errorType}" directly in otherwise block is an anti-pattern`, {
24
+ suggestion: 'Consider using a custom error type (e.g., APP:INVALID_REQUEST) with descriptive message, or refactor the choice logic'
25
+ }));
26
+ }
27
+ // Also check for raise-error in when blocks (less common but still an anti-pattern)
28
+ const raiseErrorsInWhen = this.select('//mule:choice/mule:when/mule:raise-error', doc);
29
+ for (const raiseError of raiseErrorsInWhen) {
30
+ const errorType = this.getAttribute(raiseError, 'type') ?? 'unknown';
31
+ // Check if using generic ANY type
32
+ if (errorType === 'ANY' || errorType === 'MULE:ANY') {
33
+ issues.push(this.createIssue(raiseError, `raise-error with generic type="${errorType}" in choice/when block`, {
34
+ suggestion: 'Use a specific error type (e.g., APP:VALIDATION_ERROR) instead of ANY',
35
+ severity: 'info'
36
+ }));
37
+ }
38
+ }
39
+ return issues;
40
+ }
41
+ }
42
+ exports.ChoiceAntiPatternRule = ChoiceAntiPatternRule;
43
+ //# sourceMappingURL=ChoiceAntiPatternRule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChoiceAntiPatternRule.js","sourceRoot":"","sources":["../../../../src/rules/standards/ChoiceAntiPatternRule.ts"],"names":[],"mappings":";;;AACA,+CAA4C;AAE5C;;;;;GAKG;AACH,MAAa,qBAAsB,SAAQ,mBAAQ;IAC/C,EAAE,GAAG,UAAU,CAAC;IAChB,IAAI,GAAG,qBAAqB,CAAC;IAC7B,WAAW,GAAG,8EAA8E,CAAC;IAC7F,QAAQ,GAAG,SAAkB,CAAC;IAC9B,QAAQ,GAAG,WAAoB,CAAC;IAEhC,QAAQ,CAAC,GAAa,EAAE,QAA2B;QAC/C,MAAM,MAAM,GAAY,EAAE,CAAC;QAE3B,gDAAgD;QAChD,MAAM,sBAAsB,GAAG,IAAI,CAAC,MAAM,CACtC,+CAA+C,EAC/C,GAAG,CACN,CAAC;QAEF,KAAK,MAAM,UAAU,IAAI,sBAAsB,EAAE,CAAC;YAC9C,MAAM,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,IAAI,SAAS,CAAC;YAErE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CACxB,UAAU,EACV,0BAA0B,SAAS,kDAAkD,EACrF;gBACI,UAAU,EAAE,uHAAuH;aACtI,CACJ,CAAC,CAAC;QACP,CAAC;QAED,oFAAoF;QACpF,MAAM,iBAAiB,GAAG,IAAI,CAAC,MAAM,CACjC,0CAA0C,EAC1C,GAAG,CACN,CAAC;QAEF,KAAK,MAAM,UAAU,IAAI,iBAAiB,EAAE,CAAC;YACzC,MAAM,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,IAAI,SAAS,CAAC;YAErE,kCAAkC;YAClC,IAAI,SAAS,KAAK,KAAK,IAAI,SAAS,KAAK,UAAU,EAAE,CAAC;gBAClD,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CACxB,UAAU,EACV,kCAAkC,SAAS,wBAAwB,EACnE;oBACI,UAAU,EAAE,uEAAuE;oBACnF,QAAQ,EAAE,MAAM;iBACnB,CACJ,CAAC,CAAC;YACP,CAAC;QACL,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AApDD,sDAoDC"}
@@ -0,0 +1,17 @@
1
+ import { ValidationContext, Issue } from '../../types';
2
+ import { BaseRule } from '../base/BaseRule';
3
+ /**
4
+ * MULE-701: Deprecated Component Usage
5
+ *
6
+ * Detect usage of deprecated Mule components.
7
+ */
8
+ export declare class DeprecatedComponentRule extends BaseRule {
9
+ id: string;
10
+ name: string;
11
+ description: string;
12
+ severity: "warning";
13
+ category: "standards";
14
+ private readonly DEPRECATED_ELEMENTS;
15
+ validate(doc: Document, _context: ValidationContext): Issue[];
16
+ }
17
+ //# sourceMappingURL=DeprecatedComponentRule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DeprecatedComponentRule.d.ts","sourceRoot":"","sources":["../../../../src/rules/standards/DeprecatedComponentRule.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,SAAc;IAChB,IAAI,SAAgC;IACpC,WAAW,SAAgD;IAC3D,QAAQ,EAAG,SAAS,CAAU;IAC9B,QAAQ,EAAG,WAAW,CAAU;IAEhC,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAMlC;IAEF,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,GAAG,KAAK,EAAE;CAmBhE"}