@btc-embedded/cdk-extensions 0.23.3 → 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.
- package/.jsii +41 -41
- package/CHANGELOG.md +14 -0
- package/assets/cli/catnip.js +154 -166
- package/lib/constructs/EventPipe.js +1 -1
- package/lib/constructs/ExportedService.js +1 -1
- package/lib/constructs/S3Bucket.js +1 -1
- package/lib/constructs/SecureRestApi.js +1 -1
- package/lib/constructs/SecureRestApiV2.js +1 -1
- package/lib/constructs/api-keys/ApiKeyClientAuthorization.js +1 -1
- package/lib/constructs/api-keys/ApiKeyManagement.js +1 -1
- package/lib/constructs/api-keys/ApiKeyPreTokenHandler.js +1 -1
- package/lib/constructs/api-keys/ApiKeyStore.js +1 -1
- package/lib/extensions/ApiGatewayExtension.js +1 -1
- package/lib/extensions/ApplicationContainer.js +1 -1
- package/lib/extensions/ApplicationLoadBalancerExtension.js +1 -1
- package/lib/extensions/ApplicationLoadBalancerExtensionV2.js +1 -1
- package/lib/extensions/CloudMapExtension.js +1 -1
- package/lib/extensions/DeactivatableServiceExtension.js +1 -1
- package/lib/extensions/DeploymentConfigExtension.js +1 -1
- package/lib/extensions/DocumentDbAccessExtension.js +1 -1
- package/lib/extensions/DomainEventMessagingExtension.js +1 -1
- package/lib/extensions/EfsMountExtension.js +1 -1
- package/lib/extensions/ExtraContainerExtension.js +1 -1
- package/lib/extensions/HTTPApiExtension.js +1 -1
- package/lib/extensions/LogExtension.js +1 -1
- package/lib/extensions/ModifyContainerDefinitionExtension.js +1 -1
- package/lib/extensions/ModifyTaskDefinitionExtension.js +1 -1
- package/lib/extensions/OpenIdExtension.js +1 -1
- package/lib/extensions/OpenTelemetryExtension.js +1 -1
- package/lib/extensions/PostgresDbAccessExtension.js +1 -1
- package/lib/extensions/SharedVolumeExtension.js +1 -1
- package/lib/extensions/TcpKeepAliveExtension.js +1 -1
- package/lib/platform/ApiGateway.js +1 -1
- package/lib/platform/ApiGatewayVpcLink.js +2 -2
- package/lib/platform/ApplicationLoadBalancer.js +1 -1
- package/lib/platform/ApplicationLoadBalancerV2.d.ts +1 -0
- package/lib/platform/ApplicationLoadBalancerV2.js +10 -3
- package/lib/platform/AuroraPostgresDB.js +5 -4
- package/lib/platform/BTCLogGroup.js +1 -1
- package/lib/platform/CognitoUserPool.js +2 -2
- package/lib/platform/DefaultUserPoolClients.js +1 -1
- package/lib/platform/DocumentDB.js +2 -2
- package/lib/platform/EcsCluster.js +1 -1
- package/lib/platform/EfsFileSystem.js +1 -1
- package/lib/platform/HostedZone.js +1 -1
- package/lib/platform/PrivateDnsNamespace.js +1 -1
- package/lib/platform/ResourceServer.js +1 -1
- package/lib/platform/Vpc.js +1 -1
- package/lib/platform/VpcV2.js +1 -1
- package/lib/stacks/ApplicationStack.js +1 -1
- package/lib/utils/BasePlatformStackResolver.js +1 -1
- package/lib/utils/StackParameter.js +1 -1
- package/node_modules/@nodable/entities/README.md +41 -0
- package/node_modules/@nodable/entities/package.json +54 -0
- package/node_modules/@nodable/entities/src/EntityDecoder.js +543 -0
- package/node_modules/@nodable/entities/src/EntityEncoder.js +194 -0
- package/node_modules/@nodable/entities/src/entities.js +1177 -0
- package/node_modules/@nodable/entities/src/entityTries.js +49 -0
- package/node_modules/@nodable/entities/src/index.d.ts +264 -0
- package/node_modules/@nodable/entities/src/index.js +29 -0
- package/node_modules/fast-xml-builder/CHANGELOG.md +40 -0
- package/node_modules/fast-xml-builder/LICENSE +21 -0
- package/node_modules/fast-xml-builder/README.md +74 -0
- package/node_modules/fast-xml-builder/lib/fxb.cjs +1 -0
- package/node_modules/fast-xml-builder/lib/fxb.d.cts +270 -0
- package/node_modules/fast-xml-builder/lib/fxb.min.js +2 -0
- package/node_modules/fast-xml-builder/lib/fxb.min.js.map +1 -0
- package/node_modules/fast-xml-builder/package.json +81 -0
- package/node_modules/fast-xml-builder/src/fxb.d.ts +270 -0
- package/node_modules/fast-xml-builder/src/fxb.js +599 -0
- package/node_modules/fast-xml-builder/src/ignoreAttributes.js +18 -0
- package/node_modules/fast-xml-builder/src/orderedJs2Xml.js +359 -0
- package/node_modules/fast-xml-builder/src/util.js +16 -0
- package/node_modules/fast-xml-parser/CHANGELOG.md +165 -0
- package/node_modules/fast-xml-parser/README.md +21 -44
- package/node_modules/fast-xml-parser/lib/fxbuilder.min.js +1 -1
- package/node_modules/fast-xml-parser/lib/fxbuilder.min.js.map +1 -1
- package/node_modules/fast-xml-parser/lib/fxp.cjs +1 -1
- package/node_modules/fast-xml-parser/lib/fxp.d.cts +343 -31
- package/node_modules/fast-xml-parser/lib/fxp.min.js +1 -1
- package/node_modules/fast-xml-parser/lib/fxp.min.js.map +1 -1
- package/node_modules/fast-xml-parser/lib/fxparser.min.js +1 -1
- package/node_modules/fast-xml-parser/lib/fxparser.min.js.map +1 -1
- package/node_modules/fast-xml-parser/lib/fxvalidator.min.js +1 -1
- package/node_modules/fast-xml-parser/lib/fxvalidator.min.js.map +1 -1
- package/node_modules/fast-xml-parser/package.json +13 -8
- package/node_modules/fast-xml-parser/src/fxp.d.ts +335 -30
- package/node_modules/fast-xml-parser/src/fxp.js +1 -1
- package/node_modules/fast-xml-parser/src/util.js +18 -25
- package/node_modules/fast-xml-parser/src/v6/EntitiesParser.js +89 -87
- package/node_modules/fast-xml-parser/src/v6/OptionsBuilder.js +10 -10
- package/node_modules/fast-xml-parser/src/v6/OutputBuilders/BaseOutputBuilder.js +23 -23
- package/node_modules/fast-xml-parser/src/v6/OutputBuilders/JsArrBuilder.js +29 -29
- package/node_modules/fast-xml-parser/src/v6/OutputBuilders/JsMinArrBuilder.js +1 -1
- package/node_modules/fast-xml-parser/src/v6/OutputBuilders/JsObjBuilder.js +39 -39
- package/node_modules/fast-xml-parser/src/v6/OutputBuilders/ParserOptionsBuilder.js +21 -21
- package/node_modules/fast-xml-parser/src/v6/XMLParser.js +22 -22
- package/node_modules/fast-xml-parser/src/v6/valueParsers/EntitiesParser.js +85 -85
- package/node_modules/fast-xml-parser/src/validator.js +34 -34
- package/node_modules/fast-xml-parser/src/xmlbuilder/json2xml.js +5 -284
- package/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js +335 -293
- package/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js +160 -43
- package/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js +540 -308
- package/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js +26 -26
- package/node_modules/fast-xml-parser/src/xmlparser/node2json.js +99 -41
- package/node_modules/fast-xml-parser/src/xmlparser/xmlNode.js +10 -10
- package/node_modules/path-expression-matcher/LICENSE +21 -0
- package/node_modules/path-expression-matcher/README.md +872 -0
- package/node_modules/path-expression-matcher/lib/pem.cjs +1 -0
- package/node_modules/path-expression-matcher/lib/pem.d.cts +634 -0
- package/node_modules/path-expression-matcher/lib/pem.min.js +2 -0
- package/node_modules/path-expression-matcher/lib/pem.min.js.map +1 -0
- package/node_modules/path-expression-matcher/package.json +78 -0
- package/node_modules/path-expression-matcher/src/Expression.js +232 -0
- package/node_modules/path-expression-matcher/src/ExpressionSet.js +209 -0
- package/node_modules/path-expression-matcher/src/Matcher.js +570 -0
- package/node_modules/path-expression-matcher/src/index.d.ts +523 -0
- package/node_modules/path-expression-matcher/src/index.js +29 -0
- package/node_modules/strnum/CHANGELOG.md +12 -2
- package/node_modules/strnum/README.md +1 -0
- package/node_modules/strnum/package.json +5 -4
- package/node_modules/strnum/strnum.js +99 -65
- package/node_modules/xml-naming/README.md +189 -0
- package/node_modules/xml-naming/package.json +54 -0
- package/node_modules/xml-naming/src/index.d.ts +74 -0
- package/node_modules/xml-naming/src/index.js +270 -0
- package/package.json +3 -2
- package/renovate.json5 +1 -0
- package/node_modules/fast-xml-parser/src/xmlbuilder/orderedJs2Xml.js +0 -134
- package/node_modules/strnum/.github/SECURITY.md +0 -5
- package/node_modules/strnum/.vscode/launch.json +0 -25
- package/node_modules/strnum/algo.stflow +0 -84
- package/node_modules/strnum/strnum.test.js +0 -173
- package/node_modules/strnum/test.js +0 -9
- /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
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
|
|
45
|
-
|
|
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
|
+
};
|