Skip to content

Commit 1b967e3

Browse files
fix: Updates fast-xml-parser to address "Prototype Pollution" vulnerability (#4477)
* Updates fast-xml-parser * rename function
1 parent da25217 commit 1b967e3

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

libraries/adaptive-expressions/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"lodash.isequal": "^4.5.0",
3737
"lru-cache": "^5.1.1",
3838
"uuid": "^8.3.2",
39-
"fast-xml-parser": "^3.19.0",
39+
"fast-xml-parser": "^4.1.2",
4040
"@xmldom/xmldom": "^0.8.6",
4141
"xpath": "^0.0.32"
4242
},

libraries/adaptive-expressions/src/builtinFunctions/xml.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
* Licensed under the MIT License.
77
*/
88

9+
import { XMLBuilder } from 'fast-xml-parser';
910
import { EvaluateExpressionDelegate, ExpressionEvaluator } from '../expressionEvaluator';
1011
import { ExpressionType } from '../expressionType';
1112
import { FunctionUtils } from '../functionUtils';
1213
import { ReturnType } from '../returnType';
13-
import { j2xParser } from 'fast-xml-parser';
1414
/**
1515
* Return the newline string according to the environment.
1616
*/
@@ -38,11 +38,11 @@ export class XML extends ExpressionEvaluator {
3838
} else if (typeof args[0] === 'object') {
3939
obj = args[0];
4040
}
41-
const parser = new j2xParser({
41+
const parser = new XMLBuilder({
4242
indentBy: ' ',
4343
format: true,
4444
});
45-
result = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n${parser.parse(obj)}`.trim();
45+
result = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n${parser.build(obj)}`.trim();
4646
} catch {
4747
error = `${args[0]} is not a valid json`;
4848
}

yarn.lock

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5771,10 +5771,12 @@ fast-safe-stringify@^2.0.7:
57715771
resolved "https://registry.yarnpkg.com/fast-safe-stringify/-/fast-safe-stringify-2.0.7.tgz#124aa885899261f68aedb42a7c080de9da608743"
57725772
integrity sha512-Utm6CdzT+6xsDk2m8S6uL8VHxNwI6Jub+e9NYTcAms28T84pTa25GJQV9j0CY0N1rM8hK4x6grpF2BQf+2qwVA==
57735773

5774-
fast-xml-parser@^3.19.0:
5775-
version "3.19.0"
5776-
resolved "https://registry.yarnpkg.com/fast-xml-parser/-/fast-xml-parser-3.19.0.tgz#cb637ec3f3999f51406dd8ff0e6fc4d83e520d01"
5777-
integrity sha512-4pXwmBplsCPv8FOY1WRakF970TjNGnGnfbOnLqjlYvMiF1SR3yOHyxMR/YCXpPTOspNF5gwudqktIP4VsWkvBg==
5774+
fast-xml-parser@^4.1.2:
5775+
version "4.2.2"
5776+
resolved "https://registry.yarnpkg.com/fast-xml-parser/-/fast-xml-parser-4.2.2.tgz#cb7310d1e9cf42d22c687b0fae41f3c926629368"
5777+
integrity sha512-DLzIPtQqmvmdq3VUKR7T6omPK/VCRNqgFlGtbESfyhcH2R4I8EzK1/K6E8PkRCK2EabWrUHK32NjYRbEFnnz0Q==
5778+
dependencies:
5779+
strnum "^1.0.5"
57785780

57795781
fastq@^1.6.0:
57805782
version "1.9.0"
@@ -8785,6 +8787,7 @@ minipass-fetch@^1.3.2:
87858787
resolved "https://registry.yarnpkg.com/minipass-fetch/-/minipass-fetch-1.3.3.tgz#34c7cea038c817a8658461bf35174551dce17a0a"
87868788
integrity sha512-akCrLDWfbdAWkMLBxJEeWTdNsjML+dt5YgOI4gJ53vuO0vrmYQkUPxa6j6V65s9CcePIr2SSWqjT2EcrNseryQ==
87878789
dependencies:
8790+
encoding "^0.1.12"
87888791
minipass "^3.1.0"
87898792
minipass-sized "^1.0.3"
87908793
minizlib "^2.0.0"
@@ -12094,6 +12097,11 @@ strip-outer@^1.0.1:
1209412097
dependencies:
1209512098
escape-string-regexp "^1.0.2"
1209612099

12100+
strnum@^1.0.5:
12101+
version "1.0.5"
12102+
resolved "https://registry.yarnpkg.com/strnum/-/strnum-1.0.5.tgz#5c4e829fe15ad4ff0d20c3db5ac97b73c9b072db"
12103+
integrity sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA==
12104+
1209712105
subarg@^1.0.0:
1209812106
version "1.0.0"
1209912107
resolved "https://registry.yarnpkg.com/subarg/-/subarg-1.0.0.tgz#f62cf17581e996b48fc965699f54c06ae268b8d2"

0 commit comments

Comments
 (0)