chore(deps): bump fast-xml-parser from 5.11.2 to 5.12.0 (#1323)

* chore(deps): bump fast-xml-parser from 5.11.2 to 5.12.0

Bumps [fast-xml-parser](https://github.com/NaturalIntelligence/fast-xml-parser) from 5.11.2 to 5.12.0.
- [Release notes](https://github.com/NaturalIntelligence/fast-xml-parser/releases)
- [Changelog](https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/NaturalIntelligence/fast-xml-parser/compare/v5.11.2...v5.12.0)

---
updated-dependencies:
- dependency-name: fast-xml-parser
  dependency-version: 5.12.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fix generated dist and license records

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Bruno Borges <brborges@microsoft.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
dependabot[bot]
2026-11-13 23:15:48 -05:00
committed by GitHub
parent 9ce5b12cb9
commit a3c8068301
13 changed files with 63642 additions and 67 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
---
name: fast-xml-builder
version: 1.3.0
version: 1.3.1
type: npm
summary: Build XML from JSON without C/C++ based libraries
homepage:
+1 -1
View File
@@ -1,6 +1,6 @@
---
name: fast-xml-parser
version: 5.11.2
version: 5.12.0
type: npm
summary: Validate XML, Parse XML, Build XML without C/C++ based libraries
homepage:
+1 -1
View File
@@ -1,6 +1,6 @@
---
name: is-unsafe
version: 2.0.0
version: 2.0.3
type: npm
summary: Zero-dependency, DOM-free, pure predicate for detecting unsafe strings across
HTML, XML, SVG, SQL, SHELL, and REGEX contexts
+1 -1
View File
@@ -1,6 +1,6 @@
---
name: strnum
version: 2.4.2
version: 2.5.1
type: npm
summary: Parse String to Number based on configuration
homepage:
+63446
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -21,8 +21,8 @@ var external_fs_default = /*#__PURE__*/__webpack_require__.n(external_fs_);
// EXTERNAL MODULE: external "path"
var external_path_ = __webpack_require__(6928);
var external_path_default = /*#__PURE__*/__webpack_require__.n(external_path_);
// EXTERNAL MODULE: ./node_modules/@actions/cache/lib/cache.js + 322 modules
var lib_cache = __webpack_require__(6080);
// EXTERNAL MODULE: ./node_modules/@actions/cache/lib/cache.js + 323 modules
var lib_cache = __webpack_require__(8230);
// EXTERNAL MODULE: ./node_modules/@actions/core/lib/core.js + 7 modules
var lib_core = __webpack_require__(3838);
// EXTERNAL MODULE: ./src/util.ts
+1 -1
View File
@@ -15,7 +15,7 @@ export const modules = {
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6928);
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _actions_cache__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6080);
/* harmony import */ var _actions_cache__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(8230);
/* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(3838);
+1 -1
View File
@@ -13,7 +13,7 @@ export const modules = {
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var os__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(857);
/* harmony import */ var os__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(os__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _actions_cache__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6080);
/* harmony import */ var _actions_cache__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8230);
/* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(3838);
/* harmony import */ var _actions_glob__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(2377);
/**
+3 -3
View File
@@ -36343,12 +36343,12 @@ async function saveCaches() {
}
const saves = [];
if (cache) {
const { save } = await Promise.all(/* import() */[__nccwpck_require__.e(80), __nccwpck_require__.e(377)]).then(__nccwpck_require__.bind(__nccwpck_require__, 7377));
const { save } = await Promise.all(/* import() */[__nccwpck_require__.e(230), __nccwpck_require__.e(377)]).then(__nccwpck_require__.bind(__nccwpck_require__, 7377));
saves.push(save(cache));
}
if (cacheJdk) {
const { saveJdkCaches } = await Promise.all(/* import() */[__nccwpck_require__.e(80), __nccwpck_require__.e(314)]).then(__nccwpck_require__.bind(__nccwpck_require__, 2314));
const { saveJdkResolutionCaches } = await Promise.all(/* import() */[__nccwpck_require__.e(80), __nccwpck_require__.e(348)]).then(__nccwpck_require__.bind(__nccwpck_require__, 967));
const { saveJdkCaches } = await Promise.all(/* import() */[__nccwpck_require__.e(230), __nccwpck_require__.e(314)]).then(__nccwpck_require__.bind(__nccwpck_require__, 2314));
const { saveJdkResolutionCaches } = await Promise.all(/* import() */[__nccwpck_require__.e(230), __nccwpck_require__.e(348)]).then(__nccwpck_require__.bind(__nccwpck_require__, 967));
saves.push(saveJdkCaches());
saves.push(saveJdkResolutionCaches());
}
+27 -14
View File
@@ -15686,19 +15686,26 @@ var Matcher = __webpack_require__(8257);
;// CONCATENATED MODULE: ./node_modules/fast-xml-builder/src/util.js
// String(val)/val.toString() drop the sign of -0 (e.g. String(-0) === '0'), silently
// corrupting a round-tripped negative-zero value. XML has no separate int/float syntax,
// so this is the single place every raw value gets turned into text.
function valToStr(val) {
return typeof val === 'number' && Object.is(val, -0) ? '-0' : String(val)
}
function safeComment(val) {
return String(val)
return valToStr(val)
.replace(/--/g, '- -') // -- is illegal anywhere in comment content
.replace(/--/g, '- -') // handle the scenario when 2 consiucative dashes appears
.replace(/-$/, '- '); // trailing - would form -- with the closing -->
}
function safeCdata(val) {
return String(val).replace(/\]\]>/g, ']]]]><![CDATA[>')
return valToStr(val).replace(/\]\]>/g, ']]]]><![CDATA[>')
}
function escapeAttribute(val) {
return String(val).replace(/"/g, '&quot;').replace(/'/g, '&apos;')
return valToStr(val).replace(/"/g, '&quot;').replace(/'/g, '&apos;')
}
// EXTERNAL MODULE: ./node_modules/xml-naming/src/index.js
var src = __webpack_require__(4658);
@@ -15793,7 +15800,7 @@ function arrToStr(arr, options, indentation, matcher, stopNodeExpressions, qName
if (!Array.isArray(arr)) {
// Non-array values (e.g. string tag values) should be treated as text content
if (arr !== undefined && arr !== null) {
let text = arr.toString();
let text = valToStr(arr);
text = replaceEntitiesValue(text, options);
return text;
}
@@ -15832,6 +15839,7 @@ function arrToStr(arr, options, indentation, matcher, stopNodeExpressions, qName
tagText = options.tagValueProcessor(tagName, tagText);
tagText = replaceEntitiesValue(tagText, options);
}
tagText = valToStr(tagText);
if (isPreviousElementTag) {
xmlStr += indentation;
}
@@ -15940,7 +15948,7 @@ function orderedJs2Xml_getRawContent(arr, options) {
if (!Array.isArray(arr)) {
// Non-array values return as-is
if (arr !== undefined && arr !== null) {
return arr.toString();
return valToStr(arr);
}
return "";
}
@@ -15952,7 +15960,7 @@ function orderedJs2Xml_getRawContent(arr, options) {
if (tagName === options.textNodeName) {
// Raw text content - NO processing, NO entity replacement
content += item[tagName];
content += valToStr(item[tagName]);
} else if (tagName === options.cdataPropName) {
// CDATA content
content += item[tagName][0][options.textNodeName];
@@ -16293,11 +16301,11 @@ Builder.prototype.j2x = function (jObj, level, matcher, qNameValidator) {
if (attr && !this.ignoreAttributesFn(attr, jPath)) {
// Resolve the attribute name through sanitizeName
const resolvedAttr = fxb_resolveTagName(attr, true, this.options, matcher, qNameValidator);
attrStr += this.buildAttrPairStr(resolvedAttr, '' + jObj[key], isCurrentStopNode);
attrStr += this.buildAttrPairStr(resolvedAttr, valToStr(jObj[key]), isCurrentStopNode);
} else if (!attr) {
//tag value
if (key === this.options.textNodeName) {
let newval = this.options.tagValueProcessor(key, '' + jObj[key]);
let newval = this.options.tagValueProcessor(key, valToStr(jObj[key]));
val += this.replaceEntitiesValue(newval);
} else {
// Check if this is a stopNode before building
@@ -16307,7 +16315,7 @@ Builder.prototype.j2x = function (jObj, level, matcher, qNameValidator) {
if (isStopNode) {
// Build as raw content without encoding
const textValue = '' + jObj[key];
const textValue = valToStr(jObj[key]);
if (textValue === '') {
val += this.indentate(level) + '<' + resolvedKey + this.closeTag(resolvedKey) + this.tagEndChar;
} else {
@@ -16349,6 +16357,7 @@ Builder.prototype.j2x = function (jObj, level, matcher, qNameValidator) {
if (this.options.oneListGroup) {
let textValue = this.options.tagValueProcessor(resolvedKey, item);
textValue = this.replaceEntitiesValue(textValue);
textValue = valToStr(textValue);
listTagVal += textValue;
} else {
// Check if this is a stopNode before building
@@ -16358,7 +16367,7 @@ Builder.prototype.j2x = function (jObj, level, matcher, qNameValidator) {
if (isStopNode) {
// Build as raw content without encoding
const textValue = '' + item;
const textValue = valToStr(item);
if (textValue === '') {
listTagVal += this.indentate(level) + '<' + resolvedKey + this.closeTag(resolvedKey) + this.tagEndChar;
} else {
@@ -16382,7 +16391,7 @@ Builder.prototype.j2x = function (jObj, level, matcher, qNameValidator) {
for (let j = 0; j < L; j++) {
// Resolve attribute names inside attributesGroupName
const resolvedAttr = fxb_resolveTagName(Ks[j], true, this.options, matcher, qNameValidator);
attrStr += this.buildAttrPairStr(resolvedAttr, '' + jObj[key][Ks[j]], isCurrentStopNode);
attrStr += this.buildAttrPairStr(resolvedAttr, valToStr(jObj[key][Ks[j]]), isCurrentStopNode);
}
} else {
val += this.processTextOrObjNode(jObj[key], resolvedKey, level, matcher, qNameValidator)
@@ -16394,7 +16403,7 @@ Builder.prototype.j2x = function (jObj, level, matcher, qNameValidator) {
Builder.prototype.buildAttrPairStr = function (attrName, val, isStopNode) {
if (!isStopNode) {
val = this.options.attributeValueProcessor(attrName, '' + val);
val = this.options.attributeValueProcessor(attrName, valToStr(val));
val = this.replaceEntitiesValue(val);
}
if (this.options.suppressBooleanAttributes && val === "true") {
@@ -16654,6 +16663,10 @@ Builder.prototype.buildTextValNode = function (val, key, attrStr, level, matcher
// Normal processing: apply tagValueProcessor and entity replacement
let textValue = this.options.tagValueProcessor(key, val);
textValue = this.replaceEntitiesValue(textValue);
// tagValueProcessor may return the raw value unchanged (default is identity), and
// replaceEntitiesValue no-ops on non-strings, so a plain number can still reach here;
// stringify it now, sign-preserving, before it's implicitly ToString'd below.
textValue = valToStr(textValue);
if (textValue === '') {
return this.indentate(level) + '<' + key + attrStr + this.closeTag(key) + this.tagEndChar;
@@ -16695,8 +16708,8 @@ function isAttribute(name /*, options*/) {
// EXTERNAL MODULE: ./node_modules/fast-xml-parser/src/fxp.js
var fxp = __webpack_require__(5824);
// EXTERNAL MODULE: ./node_modules/fast-xml-parser/src/xmlparser/XMLParser.js + 22 modules
var XMLParser = __webpack_require__(6009);
// EXTERNAL MODULE: ./node_modules/fast-xml-parser/src/xmlparser/XMLParser.js + 23 modules
var XMLParser = __webpack_require__(1143);
;// CONCATENATED MODULE: ./node_modules/@azure/core-xml/dist/esm/xml.common.js
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
+140 -24
View File
@@ -10,7 +10,7 @@ export const modules = {
/* harmony export */ i: () => (/* binding */ XMLValidator)
/* harmony export */ });
/* harmony import */ var _validator_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1176);
/* harmony import */ var _xmlparser_XMLParser_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6009);
/* harmony import */ var _xmlparser_XMLParser_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1143);
@@ -627,7 +627,7 @@ function getPositionFromMatch(match) {
/***/ }),
/***/ 6009:
/***/ 1143:
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
@@ -1582,8 +1582,10 @@ function toNumber(str, options = {}) {
return parse_int(trimmedStr, 2);
} else if (options.octal && octRegex.test(trimmedStr)) {
return parse_int(trimmedStr, 8);
} else if (!isFinite(trimmedStr)) { //Infinity
return handleInfinity(str, Number(trimmedStr), options);
} else if (!isFinite(trimmedStr)) { //Infinity or not a number
const num = Number(trimmedStr);
if (Number.isNaN(num)) return str; //not a number: always the original string
return handleInfinity(str, num, options); //only +/-Infinity reaches here
} else if (trimmedStr.includes('e') || trimmedStr.includes('E')) { //eNotation
return resolveEnotation(str, trimmedStr, options);
} else {
@@ -1595,8 +1597,8 @@ function toNumber(str, options = {}) {
const leadingZeros = match[2];
let numTrimmedByZeros = trimZeros(match[3]); //complete num without leading zeros
const decimalAdjacentToLeadingZeros = sign ? // 0., -00., 000.
str[leadingZeros.length + 1] === "."
: str[leadingZeros.length] === ".";
trimmedStr[leadingZeros.length + 1] === "."
: trimmedStr[leadingZeros.length] === ".";
//trim ending zeros for floating number
if (!options.leadingZeros //leading zeros are not allowed
@@ -1644,8 +1646,8 @@ function resolveEnotation(str, trimmedStr, options) {
const eChar = notation[3].indexOf("e") === -1 ? "E" : "e";
const leadingZeros = notation[2];
const eAdjacentToLeadingZeros = sign ? // 0E.
str[leadingZeros.length + 1] === eChar
: str[leadingZeros.length] === eChar;
trimmedStr[leadingZeros.length + 1] === eChar
: trimmedStr[leadingZeros.length] === eChar;
if (leadingZeros.length > 1 && eAdjacentToLeadingZeros) return str;
else if (leadingZeros.length === 1
@@ -1654,8 +1656,7 @@ function resolveEnotation(str, trimmedStr, options) {
} else if (leadingZeros.length > 0) {
// Has leading zeros — only accept if leadingZeros option allows it
if (options.leadingZeros && !eAdjacentToLeadingZeros) {
trimmedStr = (notation[1] || "") + notation[3];
return Number(trimmedStr);
return Number(trimmedStr); // Number() accepts leading zeros; stripping can leave a mantissa-less ".e0"
} else return str;
} else {
// No leading zeros — always valid e-notation, parse it
@@ -1718,6 +1719,7 @@ function handleInfinity(str, num, options) {
return str; // Return original string like "1e1000"
}
}
;// CONCATENATED MODULE: ./node_modules/fast-xml-parser/src/ignoreAttributes.js
function getIgnoreAttributesFn(ignoreAttributes) {
if (typeof ignoreAttributes === 'function') {
@@ -3899,6 +3901,56 @@ const SQL_STRICT_PATTERNS = [...sql, ...SQL_STRICT_EXTRA];
/* harmony default export */ const sql_strict = (SQL_STRICT_PATTERNS);
;// CONCATENATED MODULE: ./node_modules/is-unsafe/src/util/decode-entities.js
/**
* Decode the HTML character references that matter for markup-context
* detection.
*
* Browsers decode character references in attribute values before they
* interpret a URL, so `javascript&#58;alert(1)` in an href is the
* `javascript:` scheme. The HTML/XML/SVG rules match literal characters, so
* without this step such payloads slip through.
*
* Deliberately NOT a full entity decoder. It decodes only:
* - decimal refs &#58; &#058; &#00000058; &#58 (any leading zeros,
* trailing ; optional — browsers accept both)
* - hex refs &#x3a; &#X3A; &#x0000003a; &#x3a (same)
* - named refs &colon; &Tab; &NewLine;
* Named refs are CASE-SENSITIVE and REQUIRE the trailing ';', exactly
* like a browser (so `&COLON;` and `&colon` are not decoded).
* &Tab; / &NewLine; matter because the URL parser strips tab/newline,
* so `java&Tab;script:` is still a javascript: URL.
*
* It does NOT decode &amp; (single pass only), so double-encoded text such as
* "&amp;lt;script&amp;gt;" stays literal — a browser renders that as text.
*
* All quantifiers are bounded; no ReDoS risk.
*
* @param {string} input
* @returns {string}
*/
const NAMED = Object.freeze({
colon: ':',
Tab: '\t',
NewLine: '\n',
});
const ENTITY_RE =
/&(?:#[xX]0*([0-9a-fA-F]{1,6});?|#0*([0-9]{1,7});?|([a-zA-Z][a-zA-Z0-9]{1,15});)/g;
function decodeEntities(input) {
if (input.indexOf('&') === -1) return input;
return input.replace(ENTITY_RE, (match, hex, dec, name) => {
if (name !== undefined) {
return Object.prototype.hasOwnProperty.call(NAMED, name) ? NAMED[name] : match;
}
const cp = hex !== undefined ? parseInt(hex, 16) : parseInt(dec, 10);
if (!Number.isFinite(cp) || cp > 0x10ffff) return match;
return String.fromCodePoint(cp);
});
}
;// CONCATENATED MODULE: ./node_modules/is-unsafe/src/contexts/html.js
/**
* HTML context patterns.
@@ -4062,7 +4114,8 @@ const XML_PATTERNS = [
{
id: 'xml-namespace-confusion',
description: 'xmlns: attribute injection — can redefine namespaces to confuse parsers',
pattern: /\bxmlns\s*(?::\w{1,40})?\s*=/i,
// pattern: /\bxmlns\s*(?::\w{1,40})?\s*=/i,
pattern: /\bxmlns(?::\w{1,40})?\s*=/i,
},
{
id: 'xml-comment-injection',
@@ -4581,6 +4634,11 @@ const LOG_PATTERNS = [
// Markup contexts are also matched against an entity-decoded copy of the input,
// because browsers decode HTML character references before interpreting a URL
// scheme (e.g. javascript&#58;… is a javascript: URL).
// ─── VALID_CONTEXTS convenience re-export ─────────────────────────────────
// Importing this pulls in ALL contexts. Use it only when you need all of them
// (e.g. for validation UI, tooling, or exhaustive audits).
@@ -4603,6 +4661,12 @@ const LOG_PATTERNS = [
html.label = 'HTML';
xml.label = 'XML';
svg.label = 'SVG';
// Markup contexts: also test an entity-decoded copy (see util/decode-entities.js).
// Non-markup contexts (SQL, SHELL, LOG, …) are matched byte-for-byte as supplied.
html.decodeEntities = true;
xml.decodeEntities = true;
svg.decodeEntities = true;
sql.label = 'SQL';
sql_strict.label = 'SQL-STRICT';
shell.label = 'SHELL';
@@ -4697,6 +4761,20 @@ function normalise(context) {
return { lists: [context], regex: null };
}
/**
* For markup contexts, return an entity-decoded copy of `value` to test
* alongside the raw input, or null when there is nothing extra to test.
*
* @param {string} value
* @param {Rule[]} list
* @returns {string|null}
*/
function decodedCopy(value, list) {
if (!list.decodeEntities) return null;
const decoded = decodeEntities(value);
return decoded === value ? null : decoded;
}
/**
* Test value against a single PatternList. Returns the first MatchResult or null.
*
@@ -4706,8 +4784,9 @@ function normalise(context) {
*/
function matchList(value, list) {
const label = list.label ?? 'CUSTOM';
const decoded = decodedCopy(value, list);
for (const rule of list) {
if (rule.pattern.test(value)) {
if (rule.pattern.test(value) || (decoded !== null && rule.pattern.test(decoded))) {
return { context: label, id: rule.id, description: rule.description, pattern: rule.pattern };
}
}
@@ -4805,8 +4884,9 @@ function allUnsafe(value, context) {
for (const list of lists) {
const label = list.label ?? 'CUSTOM';
const decoded = decodedCopy(value, list);
for (const rule of list) {
if (rule.pattern.test(value)) {
if (rule.pattern.test(value) || (decoded !== null && rule.pattern.test(decoded))) {
results.push({ context: label, id: rule.id, description: rule.description, pattern: rule.pattern });
}
}
@@ -5104,7 +5184,15 @@ function buildAttributesMap(attrStr, jPath, tagName, force = false) {
}
}
const parseXml = function (xmlData) {
xmlData = xmlData.replace(/\r\n?/g, "\n"); //TODO: remove this line
const options = this.options;
const crlfPositions = options.captureMetaData ? [] : undefined;
xmlData = xmlData.replace(/\r\n?/g, options.captureMetaData ? (newline, index) => {
if (newline.length === 2) {
// Store the position after earlier CRLF pairs have been normalized.
crlfPositions.push(index - crlfPositions.length);
}
return "\n";
} : "\n");
const xmlObj = new XmlNode('!xml');
let currentNode = xmlObj;
let textData = "";
@@ -5117,7 +5205,6 @@ const parseXml = function (xmlData) {
this.entityExpansionCount = 0;
this.currentExpandedLength = 0;
this.doctypefound = false;
const options = this.options;
const docTypeReader = new DocTypeReader(options.processEntities);
const xmlLen = xmlData.length;
for (let i = 0; i < xmlLen; i++) {//for each char in XML data
@@ -5161,7 +5248,7 @@ const parseXml = function (xmlData) {
currentNode = this.tagsNodeStack.pop() || xmlObj;//avoid recursion, set the parent tag scope
if (options.captureMetaData && currentNode) {
currentNode.addEndIndex(closeIndex + 1);
currentNode.addEndIndex(getOriginalIndex(closeIndex + 1, crlfPositions));
}
textData = "";
i = closeIndex;
@@ -5187,11 +5274,12 @@ const parseXml = function (xmlData) {
if (tagData.tagName !== tagData.tagExp && tagData.attrExpPresent && options.ignoreAttributes !== true) {
childNode[":@"] = attsMap
}
this.addChild(currentNode, childNode, this.readonlyMatcher, i);
const startIndex = options.captureMetaData ? getOriginalIndex(i, crlfPositions) : i;
this.addChild(currentNode, childNode, this.readonlyMatcher, startIndex);
if (options.captureMetaData) {
// closeIndex points at '?' of the closing '?>'
currentNode.addEndIndex(tagData.closeIndex + 2);
currentNode.addEndIndex(getOriginalIndex(tagData.closeIndex + 2, crlfPositions));
}
}
@@ -5323,7 +5411,7 @@ const parseXml = function (xmlData) {
this.isCurrentNodeStopNode = this.isItStopNode();
}
const startIndex = i;
const startIndex = options.captureMetaData ? getOriginalIndex(i, crlfPositions) : i;
if (this.isCurrentNodeStopNode) {
let tagContent = "";
@@ -5359,7 +5447,7 @@ const parseXml = function (xmlData) {
this.addChild(currentNode, childNode, this.readonlyMatcher, startIndex);
if (options.captureMetaData) {
currentNode.addEndIndex(i + 1);
currentNode.addEndIndex(getOriginalIndex(i + 1, crlfPositions));
}
} else {
//selfClosing tag
@@ -5373,7 +5461,7 @@ const parseXml = function (xmlData) {
this.addChild(currentNode, childNode, this.readonlyMatcher, startIndex);
if (options.captureMetaData) {
currentNode.addEndIndex(closeIndex + 1);
currentNode.addEndIndex(getOriginalIndex(closeIndex + 1, crlfPositions));
}
this.matcher.pop(); // Pop self-closing tag
this.isCurrentNodeStopNode = false; // Reset flag
@@ -5386,7 +5474,7 @@ const parseXml = function (xmlData) {
this.addChild(currentNode, childNode, this.readonlyMatcher, startIndex);
if (options.captureMetaData) {
currentNode.addEndIndex(result.closeIndex + 1);
currentNode.addEndIndex(getOriginalIndex(result.closeIndex + 1, crlfPositions));
}
this.matcher.pop(); // Pop unpaired tag
this.isCurrentNodeStopNode = false; // Reset flag
@@ -5419,6 +5507,17 @@ const parseXml = function (xmlData) {
return xmlObj.child;
}
function getOriginalIndex(index, crlfPositions) {
let low = 0;
let high = crlfPositions.length;
while (low < high) {
const middle = Math.floor((low + high) / 2);
if (crlfPositions[middle] < index) low = middle + 1;
else high = middle;
}
return index + low;
}
function addChild(currentNode, childNode, matcher, startIndex) {
// unset startIndex if not requested
if (!this.options.captureMetaData) startIndex = undefined;
@@ -5597,6 +5696,8 @@ function readStopNodeData(xmlData, tagName, i) {
const startIndex = i;
// Starting at 1 since we already have an open tag
let openTagCount = 1;
let lenient = false; // set once a quote-aware tag scan fails
let nextGt = -1; // cached index of the next '>'
const xmllen = xmlData.length;
for (; i < xmllen; i++) {
@@ -5628,14 +5729,29 @@ function readStopNodeData(xmlData, tagName, i) {
const closeIndex = findClosingIndex(xmlData, "]]>", i, "StopNode is not closed.") - 2;
i = closeIndex;
} else {
const tagData = readTagExp(xmlData, i, false)
const tagData = lenient ? undefined : readTagExp(xmlData, i, false);
if (tagData) {
const openTagName = tagData && tagData.tagName;
const openTagName = tagData.tagName;
if (openTagName === tagName && tagData.tagExp[tagData.tagExp.length - 1] !== "/") {
openTagCount++;
}
i = tagData.closeIndex;
} else {
// no closing '>'. use lenient approach to find '<' instead of readTagExp, to avoid repeated rescans.
lenient = true;
if (nextGt < i) {
nextGt = xmlData.indexOf(">", i);
if (nextGt === -1) return; // no '>' left, so no closing tag can follow
}
const nextLt = xmlData.indexOf("<", i + 1);
if (nextLt === -1 || nextLt > nextGt) { // looks like a real tag
const exp = xmlData.substring(i + 1, nextGt);
const sep = exp.search(/\s/);
const name = sep === -1 ? exp : exp.substring(0, sep);
if (name === tagName && exp[exp.length - 1] !== "/") openTagCount++;
i = nextGt;
} // else: treat this '<' as plain text
}
}
}
+17 -17
View File
@@ -16,7 +16,7 @@
"@actions/http-client": "^4.0.1",
"@actions/io": "^3.0.2",
"@actions/tool-cache": "^4.0.0",
"fast-xml-parser": "^5.11.2",
"fast-xml-parser": "^5.12.0",
"semver": "^7.8.5"
},
"devDependencies": {
@@ -3903,9 +3903,9 @@
"license": "MIT"
},
"node_modules/fast-xml-builder": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/fast-xml-builder/-/fast-xml-builder-1.3.0.tgz",
"integrity": "sha512-F74cZEdCvuw9P41GAC3rod4X04jjWGM1JPEv/GWSqFTWLsdyMSBMBMlm9Hk3GLBgLBbdBNY8yee0pQh2RBVESQ==",
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/fast-xml-builder/-/fast-xml-builder-1.3.1.tgz",
"integrity": "sha512-pIM/1n3ntFXKYrUZwW7QCK0gAW7XY+wzj1YMIV3tLDvPj/V+zTGJK5e3/4WJfwj0qWw2ElNXiTixda/R+3YSug==",
"funding": [
{
"type": "github",
@@ -3919,9 +3919,9 @@
}
},
"node_modules/fast-xml-parser": {
"version": "5.11.2",
"resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-5.11.2.tgz",
"integrity": "sha512-R9iDuNrQYeQut46cn2r2wHKn4HYzVDvDm5J1wW+koZewykv0yuO2HChTYeZtrULyHIDM9cj9TUXloCsueCQUog==",
"version": "5.12.0",
"resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-5.12.0.tgz",
"integrity": "sha512-/pXxRBtwxY9w8z7YbgsvIPPcPvFDsTbIkWwTQJhzNJPokj+TbN6ftmcv4j/pEQDvOCNnKGDzuk5Bo2oogIOiFg==",
"funding": [
{
"type": "github",
@@ -3930,11 +3930,11 @@
],
"license": "MIT",
"dependencies": {
"@nodable/entities": "^3.0.1",
"fast-xml-builder": "^1.2.0",
"is-unsafe": "^2.0.0",
"@nodable/entities": "^3.1.0",
"fast-xml-builder": "^1.3.1",
"is-unsafe": "^2.0.3",
"path-expression-matcher": "^1.6.2",
"strnum": "^2.4.2",
"strnum": "^2.5.1",
"xml-naming": "^0.3.0"
},
"bin": {
@@ -4368,9 +4368,9 @@
}
},
"node_modules/is-unsafe": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/is-unsafe/-/is-unsafe-2.0.0.tgz",
"integrity": "sha512-2LdV822R+wmI86unXA93WCFpL6g+av8ynWk0nrHyJqGop5VoocYsSLFgN8jrfalT6iGeLNM4KXuVSsULP53kEA==",
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/is-unsafe/-/is-unsafe-2.0.3.tgz",
"integrity": "sha512-ZBllczCCO267vgdFb6Tq3pv+LhHaCiGMdr+ZsuL+OopruAg7S+3ZDs1vD0RPC0uSrkjzbraxaGjtX1YBxjPeFQ==",
"funding": [
{
"type": "github",
@@ -5951,9 +5951,9 @@
}
},
"node_modules/strnum": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/strnum/-/strnum-2.4.2.tgz",
"integrity": "sha512-rDG3Ah4TV0k1hWvLSzkZtMmLN9+eS+h3knq4MP6A42Y3Yh5qGNnOUs1jJkoSr8FG5dsL28c7KgkIBzSEykqtuw==",
"version": "2.5.1",
"resolved": "https://registry.npmjs.org/strnum/-/strnum-2.5.1.tgz",
"integrity": "sha512-UM4nTLWzQiDBseVxUGxN0wJzIk0UU89Qi7pKXz9qISo+lhviJikTuikBsK/oFRlpvYHvSdz0TVoLyQ+sEpYwxA==",
"funding": [
{
"type": "github",
+1 -1
View File
@@ -49,7 +49,7 @@
"@actions/http-client": "^4.0.1",
"@actions/io": "^3.0.2",
"@actions/tool-cache": "^4.0.0",
"fast-xml-parser": "^5.11.2",
"fast-xml-parser": "^5.12.0",
"semver": "^7.8.5"
},
"devDependencies": {