@btc-embedded/cdk-extensions 0.23.4 → 0.23.5

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 (135) hide show
  1. package/.jsii +5 -5
  2. package/CHANGELOG.md +7 -0
  3. package/assets/cli/catnip.js +154 -166
  4. package/lib/constructs/EventPipe.js +1 -1
  5. package/lib/constructs/ExportedService.js +1 -1
  6. package/lib/constructs/S3Bucket.js +1 -1
  7. package/lib/constructs/SecureRestApi.js +1 -1
  8. package/lib/constructs/SecureRestApiV2.js +1 -1
  9. package/lib/constructs/api-keys/ApiKeyClientAuthorization.js +1 -1
  10. package/lib/constructs/api-keys/ApiKeyManagement.js +1 -1
  11. package/lib/constructs/api-keys/ApiKeyPreTokenHandler.js +1 -1
  12. package/lib/constructs/api-keys/ApiKeyStore.js +1 -1
  13. package/lib/extensions/ApiGatewayExtension.js +1 -1
  14. package/lib/extensions/ApplicationContainer.js +1 -1
  15. package/lib/extensions/ApplicationLoadBalancerExtension.js +1 -1
  16. package/lib/extensions/ApplicationLoadBalancerExtensionV2.js +1 -1
  17. package/lib/extensions/CloudMapExtension.js +1 -1
  18. package/lib/extensions/DeactivatableServiceExtension.js +1 -1
  19. package/lib/extensions/DeploymentConfigExtension.js +1 -1
  20. package/lib/extensions/DocumentDbAccessExtension.js +1 -1
  21. package/lib/extensions/DomainEventMessagingExtension.js +1 -1
  22. package/lib/extensions/EfsMountExtension.js +1 -1
  23. package/lib/extensions/ExtraContainerExtension.js +1 -1
  24. package/lib/extensions/HTTPApiExtension.js +1 -1
  25. package/lib/extensions/LogExtension.js +1 -1
  26. package/lib/extensions/ModifyContainerDefinitionExtension.js +1 -1
  27. package/lib/extensions/ModifyTaskDefinitionExtension.js +1 -1
  28. package/lib/extensions/OpenIdExtension.js +1 -1
  29. package/lib/extensions/OpenTelemetryExtension.js +1 -1
  30. package/lib/extensions/PostgresDbAccessExtension.js +1 -1
  31. package/lib/extensions/SharedVolumeExtension.js +1 -1
  32. package/lib/extensions/TcpKeepAliveExtension.js +1 -1
  33. package/lib/platform/ApiGateway.js +1 -1
  34. package/lib/platform/ApiGatewayVpcLink.js +2 -2
  35. package/lib/platform/ApplicationLoadBalancer.js +1 -1
  36. package/lib/platform/ApplicationLoadBalancerV2.d.ts +1 -0
  37. package/lib/platform/ApplicationLoadBalancerV2.js +10 -3
  38. package/lib/platform/AuroraPostgresDB.js +2 -2
  39. package/lib/platform/BTCLogGroup.js +1 -1
  40. package/lib/platform/CognitoUserPool.js +2 -2
  41. package/lib/platform/DefaultUserPoolClients.js +1 -1
  42. package/lib/platform/DocumentDB.js +2 -2
  43. package/lib/platform/EcsCluster.js +1 -1
  44. package/lib/platform/EfsFileSystem.js +1 -1
  45. package/lib/platform/HostedZone.js +1 -1
  46. package/lib/platform/PrivateDnsNamespace.js +1 -1
  47. package/lib/platform/ResourceServer.js +1 -1
  48. package/lib/platform/Vpc.js +1 -1
  49. package/lib/platform/VpcV2.js +1 -1
  50. package/lib/stacks/ApplicationStack.js +1 -1
  51. package/lib/utils/BasePlatformStackResolver.js +1 -1
  52. package/lib/utils/StackParameter.js +1 -1
  53. package/node_modules/@nodable/entities/README.md +41 -0
  54. package/node_modules/@nodable/entities/package.json +54 -0
  55. package/node_modules/@nodable/entities/src/EntityDecoder.js +543 -0
  56. package/node_modules/@nodable/entities/src/EntityEncoder.js +194 -0
  57. package/node_modules/@nodable/entities/src/entities.js +1177 -0
  58. package/node_modules/@nodable/entities/src/entityTries.js +49 -0
  59. package/node_modules/@nodable/entities/src/index.d.ts +264 -0
  60. package/node_modules/@nodable/entities/src/index.js +29 -0
  61. package/node_modules/fast-xml-builder/CHANGELOG.md +40 -0
  62. package/node_modules/fast-xml-builder/LICENSE +21 -0
  63. package/node_modules/fast-xml-builder/README.md +74 -0
  64. package/node_modules/fast-xml-builder/lib/fxb.cjs +1 -0
  65. package/node_modules/fast-xml-builder/lib/fxb.d.cts +270 -0
  66. package/node_modules/fast-xml-builder/lib/fxb.min.js +2 -0
  67. package/node_modules/fast-xml-builder/lib/fxb.min.js.map +1 -0
  68. package/node_modules/fast-xml-builder/package.json +81 -0
  69. package/node_modules/fast-xml-builder/src/fxb.d.ts +270 -0
  70. package/node_modules/fast-xml-builder/src/fxb.js +599 -0
  71. package/node_modules/fast-xml-builder/src/ignoreAttributes.js +18 -0
  72. package/node_modules/fast-xml-builder/src/orderedJs2Xml.js +359 -0
  73. package/node_modules/fast-xml-builder/src/util.js +16 -0
  74. package/node_modules/fast-xml-parser/CHANGELOG.md +165 -0
  75. package/node_modules/fast-xml-parser/README.md +21 -44
  76. package/node_modules/fast-xml-parser/lib/fxbuilder.min.js +1 -1
  77. package/node_modules/fast-xml-parser/lib/fxbuilder.min.js.map +1 -1
  78. package/node_modules/fast-xml-parser/lib/fxp.cjs +1 -1
  79. package/node_modules/fast-xml-parser/lib/fxp.d.cts +343 -31
  80. package/node_modules/fast-xml-parser/lib/fxp.min.js +1 -1
  81. package/node_modules/fast-xml-parser/lib/fxp.min.js.map +1 -1
  82. package/node_modules/fast-xml-parser/lib/fxparser.min.js +1 -1
  83. package/node_modules/fast-xml-parser/lib/fxparser.min.js.map +1 -1
  84. package/node_modules/fast-xml-parser/lib/fxvalidator.min.js +1 -1
  85. package/node_modules/fast-xml-parser/lib/fxvalidator.min.js.map +1 -1
  86. package/node_modules/fast-xml-parser/package.json +13 -8
  87. package/node_modules/fast-xml-parser/src/fxp.d.ts +335 -30
  88. package/node_modules/fast-xml-parser/src/fxp.js +1 -1
  89. package/node_modules/fast-xml-parser/src/util.js +18 -25
  90. package/node_modules/fast-xml-parser/src/v6/EntitiesParser.js +89 -87
  91. package/node_modules/fast-xml-parser/src/v6/OptionsBuilder.js +10 -10
  92. package/node_modules/fast-xml-parser/src/v6/OutputBuilders/BaseOutputBuilder.js +23 -23
  93. package/node_modules/fast-xml-parser/src/v6/OutputBuilders/JsArrBuilder.js +29 -29
  94. package/node_modules/fast-xml-parser/src/v6/OutputBuilders/JsMinArrBuilder.js +1 -1
  95. package/node_modules/fast-xml-parser/src/v6/OutputBuilders/JsObjBuilder.js +39 -39
  96. package/node_modules/fast-xml-parser/src/v6/OutputBuilders/ParserOptionsBuilder.js +21 -21
  97. package/node_modules/fast-xml-parser/src/v6/XMLParser.js +22 -22
  98. package/node_modules/fast-xml-parser/src/v6/valueParsers/EntitiesParser.js +85 -85
  99. package/node_modules/fast-xml-parser/src/validator.js +34 -34
  100. package/node_modules/fast-xml-parser/src/xmlbuilder/json2xml.js +5 -284
  101. package/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js +335 -293
  102. package/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js +160 -43
  103. package/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js +540 -308
  104. package/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js +26 -26
  105. package/node_modules/fast-xml-parser/src/xmlparser/node2json.js +99 -41
  106. package/node_modules/fast-xml-parser/src/xmlparser/xmlNode.js +10 -10
  107. package/node_modules/path-expression-matcher/LICENSE +21 -0
  108. package/node_modules/path-expression-matcher/README.md +872 -0
  109. package/node_modules/path-expression-matcher/lib/pem.cjs +1 -0
  110. package/node_modules/path-expression-matcher/lib/pem.d.cts +634 -0
  111. package/node_modules/path-expression-matcher/lib/pem.min.js +2 -0
  112. package/node_modules/path-expression-matcher/lib/pem.min.js.map +1 -0
  113. package/node_modules/path-expression-matcher/package.json +78 -0
  114. package/node_modules/path-expression-matcher/src/Expression.js +232 -0
  115. package/node_modules/path-expression-matcher/src/ExpressionSet.js +209 -0
  116. package/node_modules/path-expression-matcher/src/Matcher.js +570 -0
  117. package/node_modules/path-expression-matcher/src/index.d.ts +523 -0
  118. package/node_modules/path-expression-matcher/src/index.js +29 -0
  119. package/node_modules/strnum/CHANGELOG.md +12 -2
  120. package/node_modules/strnum/README.md +1 -0
  121. package/node_modules/strnum/package.json +5 -4
  122. package/node_modules/strnum/strnum.js +99 -65
  123. package/node_modules/xml-naming/README.md +189 -0
  124. package/node_modules/xml-naming/package.json +54 -0
  125. package/node_modules/xml-naming/src/index.d.ts +74 -0
  126. package/node_modules/xml-naming/src/index.js +270 -0
  127. package/package.json +3 -2
  128. package/renovate.json5 +1 -0
  129. package/node_modules/fast-xml-parser/src/xmlbuilder/orderedJs2Xml.js +0 -134
  130. package/node_modules/strnum/.github/SECURITY.md +0 -5
  131. package/node_modules/strnum/.vscode/launch.json +0 -25
  132. package/node_modules/strnum/algo.stflow +0 -84
  133. package/node_modules/strnum/strnum.test.js +0 -173
  134. package/node_modules/strnum/test.js +0 -9
  135. /package/node_modules/{fast-xml-parser/src/xmlbuilder → fast-xml-builder/src}/prettifyJs2Xml.js +0 -0
@@ -1,46 +1,163 @@
1
+ import { DANGEROUS_PROPERTY_NAMES, criticalProperties } from "../util.js";
2
+ import { COMMON_HTML, CURRENCY } from '@nodable/entities';
1
3
 
2
- export const defaultOptions = {
3
- preserveOrder: false,
4
- attributeNamePrefix: '@_',
5
- attributesGroupName: false,
6
- textNodeName: '#text',
7
- ignoreAttributes: true,
8
- removeNSPrefix: false, // remove NS from tag name or attribute name if true
9
- allowBooleanAttributes: false, //a tag can have attributes without any value
10
- //ignoreRootElement : false,
11
- parseTagValue: true,
12
- parseAttributeValue: false,
13
- trimValues: true, //Trim string values of tag and attributes
14
- cdataPropName: false,
15
- numberParseOptions: {
16
- hex: true,
17
- leadingZeros: true,
18
- eNotation: true
19
- },
20
- tagValueProcessor: function(tagName, val) {
21
- return val;
22
- },
23
- attributeValueProcessor: function(attrName, val) {
24
- return val;
25
- },
26
- stopNodes: [], //nested tags will not be parsed even for errors
27
- alwaysCreateTextNode: false,
28
- isArray: () => false,
29
- commentPropName: false,
30
- unpairedTags: [],
31
- processEntities: true,
32
- htmlEntities: false,
33
- ignoreDeclaration: false,
34
- ignorePiTags: false,
35
- transformTagName: false,
36
- transformAttributeName: false,
37
- updateTag: function(tagName, jPath, attrs){
38
- return tagName
39
- },
40
- // skipEmptyListItem: false
41
- captureMetaData: false,
4
+ const defaultOnDangerousProperty = (name) => {
5
+ if (DANGEROUS_PROPERTY_NAMES.includes(name)) {
6
+ return "__" + name;
7
+ }
8
+ return name;
42
9
  };
43
-
44
- export const buildOptions = function(options) {
45
- return Object.assign({}, defaultOptions, options);
10
+
11
+
12
+ export const defaultOptions = {
13
+ preserveOrder: false,
14
+ attributeNamePrefix: '@_',
15
+ attributesGroupName: false,
16
+ textNodeName: '#text',
17
+ ignoreAttributes: true,
18
+ removeNSPrefix: false, // remove NS from tag name or attribute name if true
19
+ allowBooleanAttributes: false, //a tag can have attributes without any value
20
+ //ignoreRootElement : false,
21
+ parseTagValue: true,
22
+ parseAttributeValue: false,
23
+ trimValues: true, //Trim string values of tag and attributes
24
+ cdataPropName: false,
25
+ numberParseOptions: {
26
+ hex: true,
27
+ leadingZeros: true,
28
+ eNotation: true
29
+ },
30
+ tagValueProcessor: function (tagName, val) {
31
+ return val;
32
+ },
33
+ attributeValueProcessor: function (attrName, val) {
34
+ return val;
35
+ },
36
+ stopNodes: [], //nested tags will not be parsed even for errors
37
+ alwaysCreateTextNode: false,
38
+ isArray: () => false,
39
+ commentPropName: false,
40
+ unpairedTags: [],
41
+ processEntities: true,
42
+ htmlEntities: false,
43
+ entityDecoder: null,
44
+ ignoreDeclaration: false,
45
+ ignorePiTags: false,
46
+ transformTagName: false,
47
+ transformAttributeName: false,
48
+ updateTag: function (tagName, jPath, attrs) {
49
+ return tagName
50
+ },
51
+ // skipEmptyListItem: false
52
+ captureMetaData: false,
53
+ maxNestedTags: 100,
54
+ strictReservedNames: true,
55
+ jPath: true, // if true, pass jPath string to callbacks; if false, pass matcher instance
56
+ onDangerousProperty: defaultOnDangerousProperty
46
57
  };
58
+
59
+
60
+ /**
61
+ * Validates that a property name is safe to use
62
+ * @param {string} propertyName - The property name to validate
63
+ * @param {string} optionName - The option field name (for error message)
64
+ * @throws {Error} If property name is dangerous
65
+ */
66
+ function validatePropertyName(propertyName, optionName) {
67
+ if (typeof propertyName !== 'string') {
68
+ return; // Only validate string property names
69
+ }
70
+
71
+ const normalized = propertyName.toLowerCase();
72
+ if (DANGEROUS_PROPERTY_NAMES.some(dangerous => normalized === dangerous.toLowerCase())) {
73
+ throw new Error(
74
+ `[SECURITY] Invalid ${optionName}: "${propertyName}" is a reserved JavaScript keyword that could cause prototype pollution`
75
+ );
76
+ }
77
+
78
+ if (criticalProperties.some(dangerous => normalized === dangerous.toLowerCase())) {
79
+ throw new Error(
80
+ `[SECURITY] Invalid ${optionName}: "${propertyName}" is a reserved JavaScript keyword that could cause prototype pollution`
81
+ );
82
+ }
83
+ }
84
+
85
+ /**
86
+ * Normalizes processEntities option for backward compatibility
87
+ * @param {boolean|object} value
88
+ * @returns {object} Always returns normalized object
89
+ */
90
+ function normalizeProcessEntities(value, htmlEntities) {
91
+ // Boolean backward compatibility
92
+ if (typeof value === 'boolean') {
93
+ return {
94
+ enabled: value, // true or false
95
+ maxEntitySize: 10000,
96
+ maxExpansionDepth: 10000,
97
+ maxTotalExpansions: Infinity,
98
+ maxExpandedLength: 100000,
99
+ maxEntityCount: 1000,
100
+ allowedTags: null,
101
+ tagFilter: null,
102
+ appliesTo: "all",
103
+ };
104
+ }
105
+
106
+ // Object config - merge with defaults
107
+ if (typeof value === 'object' && value !== null) {
108
+ return {
109
+ enabled: value.enabled !== false,
110
+ maxEntitySize: Math.max(1, value.maxEntitySize ?? 10000),
111
+ maxExpansionDepth: Math.max(1, value.maxExpansionDepth ?? 10000),
112
+ maxTotalExpansions: Math.max(1, value.maxTotalExpansions ?? Infinity),
113
+ maxExpandedLength: Math.max(1, value.maxExpandedLength ?? 100000),
114
+ maxEntityCount: Math.max(1, value.maxEntityCount ?? 1000),
115
+ allowedTags: value.allowedTags ?? null,
116
+ tagFilter: value.tagFilter ?? null,
117
+ appliesTo: value.appliesTo ?? "all",
118
+ };
119
+ }
120
+
121
+ // Default to enabled with limits
122
+ return normalizeProcessEntities(true);
123
+ }
124
+
125
+ export const buildOptions = function (options) {
126
+ const built = Object.assign({}, defaultOptions, options);
127
+
128
+ // Validate property names to prevent prototype pollution
129
+ const propertyNameOptions = [
130
+ { value: built.attributeNamePrefix, name: 'attributeNamePrefix' },
131
+ { value: built.attributesGroupName, name: 'attributesGroupName' },
132
+ { value: built.textNodeName, name: 'textNodeName' },
133
+ { value: built.cdataPropName, name: 'cdataPropName' },
134
+ { value: built.commentPropName, name: 'commentPropName' }
135
+ ];
136
+
137
+ for (const { value, name } of propertyNameOptions) {
138
+ if (value) {
139
+ validatePropertyName(value, name);
140
+ }
141
+ }
142
+
143
+ if (built.onDangerousProperty === null) {
144
+ built.onDangerousProperty = defaultOnDangerousProperty;
145
+ }
146
+
147
+ // Always normalize processEntities for backward compatibility and validation
148
+ built.processEntities = normalizeProcessEntities(built.processEntities, built.htmlEntities);
149
+ built.unpairedTagsSet = new Set(built.unpairedTags);
150
+ // Convert old-style stopNodes for backward compatibility
151
+ if (built.stopNodes && Array.isArray(built.stopNodes)) {
152
+ built.stopNodes = built.stopNodes.map(node => {
153
+ if (typeof node === 'string' && node.startsWith('*.')) {
154
+ // Old syntax: *.tagname meant "tagname anywhere"
155
+ // Convert to new syntax: ..tagname
156
+ return '..' + node.substring(2);
157
+ }
158
+ return node;
159
+ });
160
+ }
161
+ //console.debug(built.processEntities)
162
+ return built;
163
+ };