@jjrawlins/cdk-diff-pr-github-action 1.9.13 → 1.9.15
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 +3 -3
- package/cdkdiffprgithubaction/jsii/jsii.go +2 -2
- package/cdkdiffprgithubaction/version +1 -1
- package/lib/CdkDiffIamTemplate.js +2 -2
- package/lib/CdkDiffIamTemplateStackSet.js +2 -2
- package/lib/CdkDiffStackWorkflow.js +1 -1
- package/lib/CdkDriftDetectionWorkflow.js +1 -1
- package/lib/CdkDriftIamTemplate.js +2 -2
- package/node_modules/@aws-sdk/client-cloudformation/package.json +13 -13
- package/node_modules/@aws-sdk/core/package.json +4 -4
- package/node_modules/@aws-sdk/credential-provider-env/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-http/package.json +5 -5
- package/node_modules/@aws-sdk/credential-provider-ini/package.json +9 -9
- package/node_modules/@aws-sdk/credential-provider-login/package.json +3 -3
- package/node_modules/@aws-sdk/credential-provider-node/package.json +7 -7
- package/node_modules/@aws-sdk/credential-provider-process/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-sso/package.json +4 -4
- package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +3 -3
- package/node_modules/@aws-sdk/middleware-user-agent/package.json +3 -3
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/cognito-identity/CognitoIdentity.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/cognito-identity/CognitoIdentity.d.ts +2 -2
- package/node_modules/@aws-sdk/nested-clients/package.json +12 -12
- package/node_modules/@aws-sdk/token-providers/package.json +3 -3
- package/node_modules/@aws-sdk/util-user-agent-node/package.json +2 -2
- package/node_modules/@aws-sdk/xml-builder/dist-cjs/index.js +21 -11
- package/node_modules/@aws-sdk/xml-builder/dist-cjs/xml-parser.js +5 -1
- package/node_modules/@aws-sdk/xml-builder/dist-es/escape-attribute.js +8 -1
- package/node_modules/@aws-sdk/xml-builder/dist-es/escape-element.js +13 -10
- package/node_modules/@aws-sdk/xml-builder/dist-es/xml-parser.js +5 -1
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/CHANGELOG.md +33 -4
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/README.md +8 -7
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxbuilder.min.js +1 -1
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxbuilder.min.js.map +1 -1
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxp.cjs +1 -1
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxp.d.cts +73 -19
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxp.min.js +1 -1
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxp.min.js.map +1 -1
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxparser.min.js +1 -1
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxparser.min.js.map +1 -1
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxvalidator.min.js.map +1 -1
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/package.json +3 -2
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/fxp.d.ts +73 -19
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/util.js +18 -0
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js +12 -2
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js +71 -0
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js +291 -115
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js +1 -1
- package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/xmlparser/node2json.js +65 -14
- package/node_modules/@aws-sdk/xml-builder/package.json +2 -2
- package/node_modules/@smithy/config-resolver/dist-cjs/index.js +12 -0
- package/node_modules/@smithy/config-resolver/dist-es/endpointsConfig/NodeUseDualstackEndpointConfigOptions.js +5 -0
- package/node_modules/@smithy/config-resolver/dist-es/endpointsConfig/NodeUseFipsEndpointConfigOptions.js +5 -0
- package/node_modules/@smithy/config-resolver/dist-types/endpointsConfig/NodeUseDualstackEndpointConfigOptions.d.ts +6 -0
- package/node_modules/@smithy/config-resolver/dist-types/endpointsConfig/NodeUseFipsEndpointConfigOptions.d.ts +6 -0
- package/node_modules/@smithy/config-resolver/dist-types/ts3.4/endpointsConfig/NodeUseDualstackEndpointConfigOptions.d.ts +6 -0
- package/node_modules/@smithy/config-resolver/dist-types/ts3.4/endpointsConfig/NodeUseFipsEndpointConfigOptions.d.ts +6 -0
- package/node_modules/@smithy/config-resolver/package.json +1 -1
- package/node_modules/@smithy/middleware-endpoint/dist-types/resolveEndpointConfig.d.ts +2 -2
- package/node_modules/@smithy/middleware-endpoint/dist-types/ts3.4/resolveEndpointConfig.d.ts +2 -2
- package/node_modules/@smithy/middleware-endpoint/package.json +1 -1
- package/node_modules/@smithy/middleware-retry/package.json +2 -2
- package/node_modules/@smithy/smithy-client/package.json +2 -2
- package/node_modules/@smithy/util-defaults-mode-browser/package.json +2 -2
- package/node_modules/@smithy/util-defaults-mode-node/package.json +3 -3
- package/node_modules/strnum/CHANGELOG.md +5 -2
- package/node_modules/strnum/package.json +1 -1
- package/node_modules/strnum/strnum.js +9 -4
- package/node_modules/strnum/tests/strnum_test.js +2 -0
- package/node_modules/strnum/tests/temp.js +8 -0
- package/package.json +2 -2
package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxvalidator.min.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"./lib/fxvalidator.min.js","mappings":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Validator/webpack/bootstrap","webpack://XMLValidator/webpack/runtime/define property getters","webpack://XMLValidator/webpack/runtime/hasOwnProperty shorthand","webpack://XMLValidator/webpack/runtime/make namespace object","webpack://XMLValidator/./src/util.js","webpack://XMLValidator/./src/validator.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"XMLValidator\"] = factory();\n\telse\n\t\troot[\"XMLValidator\"] = factory();\n})(this, () => {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","'use strict';\n\nconst nameStartChar = ':A-Za-z_\\\\u00C0-\\\\u00D6\\\\u00D8-\\\\u00F6\\\\u00F8-\\\\u02FF\\\\u0370-\\\\u037D\\\\u037F-\\\\u1FFF\\\\u200C-\\\\u200D\\\\u2070-\\\\u218F\\\\u2C00-\\\\u2FEF\\\\u3001-\\\\uD7FF\\\\uF900-\\\\uFDCF\\\\uFDF0-\\\\uFFFD';\nconst nameChar = nameStartChar + '\\\\-.\\\\d\\\\u00B7\\\\u0300-\\\\u036F\\\\u203F-\\\\u2040';\nexport const nameRegexp = '[' + nameStartChar + '][' + nameChar + ']*';\nconst regexName = new RegExp('^' + nameRegexp + '$');\n\nexport function getAllMatches(string, regex) {\n const matches = [];\n let match = regex.exec(string);\n while (match) {\n const allmatches = [];\n allmatches.startIndex = regex.lastIndex - match[0].length;\n const len = match.length;\n for (let index = 0; index < len; index++) {\n allmatches.push(match[index]);\n }\n matches.push(allmatches);\n match = regex.exec(string);\n }\n return matches;\n}\n\nexport const isName = function (string) {\n const match = regexName.exec(string);\n return !(match === null || typeof match === 'undefined');\n}\n\nexport function isExist(v) {\n return typeof v !== 'undefined';\n}\n\nexport function isEmptyObject(obj) {\n return Object.keys(obj).length === 0;\n}\n\nexport function getValue(v) {\n if (exports.isExist(v)) {\n return v;\n } else {\n return '';\n }\n}\n","'use strict';\n\nimport { getAllMatches, isName } from './util.js';\n\nconst defaultOptions = {\n allowBooleanAttributes: false, //A tag can have attributes without any value\n unpairedTags: []\n};\n\n//const tagsPattern = new RegExp(\"<\\\\/?([\\\\w:\\\\-_\\.]+)\\\\s*\\/?>\",\"g\");\nexport function validate(xmlData, options) {\n options = Object.assign({}, defaultOptions, options);\n\n //xmlData = xmlData.replace(/(\\r\\n|\\n|\\r)/gm,\"\");//make it single line\n //xmlData = xmlData.replace(/(^\\s*<\\?xml.*?\\?>)/g,\"\");//Remove XML starting tag\n //xmlData = xmlData.replace(/(<!DOCTYPE[\\s\\w\\\"\\.\\/\\-\\:]+(\\[.*\\])*\\s*>)/g,\"\");//Remove DOCTYPE\n const tags = [];\n let tagFound = false;\n\n //indicates that the root tag has been closed (aka. depth 0 has been reached)\n let reachedRoot = false;\n\n if (xmlData[0] === '\\ufeff') {\n // check for byte order mark (BOM)\n xmlData = xmlData.substr(1);\n }\n\n for (let i = 0; i < xmlData.length; i++) {\n\n if (xmlData[i] === '<' && xmlData[i + 1] === '?') {\n i += 2;\n i = readPI(xmlData, i);\n if (i.err) return i;\n } else if (xmlData[i] === '<') {\n //starting of tag\n //read until you reach to '>' avoiding any '>' in attribute value\n let tagStartPos = i;\n i++;\n\n if (xmlData[i] === '!') {\n i = readCommentAndCDATA(xmlData, i);\n continue;\n } else {\n let closingTag = false;\n if (xmlData[i] === '/') {\n //closing tag\n closingTag = true;\n i++;\n }\n //read tagname\n let tagName = '';\n for (; i < xmlData.length &&\n xmlData[i] !== '>' &&\n xmlData[i] !== ' ' &&\n xmlData[i] !== '\\t' &&\n xmlData[i] !== '\\n' &&\n xmlData[i] !== '\\r'; i++\n ) {\n tagName += xmlData[i];\n }\n tagName = tagName.trim();\n //console.log(tagName);\n\n if (tagName[tagName.length - 1] === '/') {\n //self closing tag without attributes\n tagName = tagName.substring(0, tagName.length - 1);\n //continue;\n i--;\n }\n if (!validateTagName(tagName)) {\n let msg;\n if (tagName.trim().length === 0) {\n msg = \"Invalid space after '<'.\";\n } else {\n msg = \"Tag '\" + tagName + \"' is an invalid name.\";\n }\n return getErrorObject('InvalidTag', msg, getLineNumberForPosition(xmlData, i));\n }\n\n const result = readAttributeStr(xmlData, i);\n if (result === false) {\n return getErrorObject('InvalidAttr', \"Attributes for '\" + tagName + \"' have open quote.\", getLineNumberForPosition(xmlData, i));\n }\n let attrStr = result.value;\n i = result.index;\n\n if (attrStr[attrStr.length - 1] === '/') {\n //self closing tag\n const attrStrStart = i - attrStr.length;\n attrStr = attrStr.substring(0, attrStr.length - 1);\n const isValid = validateAttributeString(attrStr, options);\n if (isValid === true) {\n tagFound = true;\n //continue; //text may presents after self closing tag\n } else {\n //the result from the nested function returns the position of the error within the attribute\n //in order to get the 'true' error line, we need to calculate the position where the attribute begins (i - attrStr.length) and then add the position within the attribute\n //this gives us the absolute index in the entire xml, which we can use to find the line at last\n return getErrorObject(isValid.err.code, isValid.err.msg, getLineNumberForPosition(xmlData, attrStrStart + isValid.err.line));\n }\n } else if (closingTag) {\n if (!result.tagClosed) {\n return getErrorObject('InvalidTag', \"Closing tag '\" + tagName + \"' doesn't have proper closing.\", getLineNumberForPosition(xmlData, i));\n } else if (attrStr.trim().length > 0) {\n return getErrorObject('InvalidTag', \"Closing tag '\" + tagName + \"' can't have attributes or invalid starting.\", getLineNumberForPosition(xmlData, tagStartPos));\n } else if (tags.length === 0) {\n return getErrorObject('InvalidTag', \"Closing tag '\" + tagName + \"' has not been opened.\", getLineNumberForPosition(xmlData, tagStartPos));\n } else {\n const otg = tags.pop();\n if (tagName !== otg.tagName) {\n let openPos = getLineNumberForPosition(xmlData, otg.tagStartPos);\n return getErrorObject('InvalidTag',\n \"Expected closing tag '\" + otg.tagName + \"' (opened in line \" + openPos.line + \", col \" + openPos.col + \") instead of closing tag '\" + tagName + \"'.\",\n getLineNumberForPosition(xmlData, tagStartPos));\n }\n\n //when there are no more tags, we reached the root level.\n if (tags.length == 0) {\n reachedRoot = true;\n }\n }\n } else {\n const isValid = validateAttributeString(attrStr, options);\n if (isValid !== true) {\n //the result from the nested function returns the position of the error within the attribute\n //in order to get the 'true' error line, we need to calculate the position where the attribute begins (i - attrStr.length) and then add the position within the attribute\n //this gives us the absolute index in the entire xml, which we can use to find the line at last\n return getErrorObject(isValid.err.code, isValid.err.msg, getLineNumberForPosition(xmlData, i - attrStr.length + isValid.err.line));\n }\n\n //if the root level has been reached before ...\n if (reachedRoot === true) {\n return getErrorObject('InvalidXml', 'Multiple possible root nodes found.', getLineNumberForPosition(xmlData, i));\n } else if (options.unpairedTags.indexOf(tagName) !== -1) {\n //don't push into stack\n } else {\n tags.push({ tagName, tagStartPos });\n }\n tagFound = true;\n }\n\n //skip tag text value\n //It may include comments and CDATA value\n for (i++; i < xmlData.length; i++) {\n if (xmlData[i] === '<') {\n if (xmlData[i + 1] === '!') {\n //comment or CADATA\n i++;\n i = readCommentAndCDATA(xmlData, i);\n continue;\n } else if (xmlData[i + 1] === '?') {\n i = readPI(xmlData, ++i);\n if (i.err) return i;\n } else {\n break;\n }\n } else if (xmlData[i] === '&') {\n const afterAmp = validateAmpersand(xmlData, i);\n if (afterAmp == -1)\n return getErrorObject('InvalidChar', \"char '&' is not expected.\", getLineNumberForPosition(xmlData, i));\n i = afterAmp;\n } else {\n if (reachedRoot === true && !isWhiteSpace(xmlData[i])) {\n return getErrorObject('InvalidXml', \"Extra text at the end\", getLineNumberForPosition(xmlData, i));\n }\n }\n } //end of reading tag text value\n if (xmlData[i] === '<') {\n i--;\n }\n }\n } else {\n if (isWhiteSpace(xmlData[i])) {\n continue;\n }\n return getErrorObject('InvalidChar', \"char '\" + xmlData[i] + \"' is not expected.\", getLineNumberForPosition(xmlData, i));\n }\n }\n\n if (!tagFound) {\n return getErrorObject('InvalidXml', 'Start tag expected.', 1);\n } else if (tags.length == 1) {\n return getErrorObject('InvalidTag', \"Unclosed tag '\" + tags[0].tagName + \"'.\", getLineNumberForPosition(xmlData, tags[0].tagStartPos));\n } else if (tags.length > 0) {\n return getErrorObject('InvalidXml', \"Invalid '\" +\n JSON.stringify(tags.map(t => t.tagName), null, 4).replace(/\\r?\\n/g, '') +\n \"' found.\", { line: 1, col: 1 });\n }\n\n return true;\n};\n\nfunction isWhiteSpace(char) {\n return char === ' ' || char === '\\t' || char === '\\n' || char === '\\r';\n}\n/**\n * Read Processing insstructions and skip\n * @param {*} xmlData\n * @param {*} i\n */\nfunction readPI(xmlData, i) {\n const start = i;\n for (; i < xmlData.length; i++) {\n if (xmlData[i] == '?' || xmlData[i] == ' ') {\n //tagname\n const tagname = xmlData.substr(start, i - start);\n if (i > 5 && tagname === 'xml') {\n return getErrorObject('InvalidXml', 'XML declaration allowed only at the start of the document.', getLineNumberForPosition(xmlData, i));\n } else if (xmlData[i] == '?' && xmlData[i + 1] == '>') {\n //check if valid attribut string\n i++;\n break;\n } else {\n continue;\n }\n }\n }\n return i;\n}\n\nfunction readCommentAndCDATA(xmlData, i) {\n if (xmlData.length > i + 5 && xmlData[i + 1] === '-' && xmlData[i + 2] === '-') {\n //comment\n for (i += 3; i < xmlData.length; i++) {\n if (xmlData[i] === '-' && xmlData[i + 1] === '-' && xmlData[i + 2] === '>') {\n i += 2;\n break;\n }\n }\n } else if (\n xmlData.length > i + 8 &&\n xmlData[i + 1] === 'D' &&\n xmlData[i + 2] === 'O' &&\n xmlData[i + 3] === 'C' &&\n xmlData[i + 4] === 'T' &&\n xmlData[i + 5] === 'Y' &&\n xmlData[i + 6] === 'P' &&\n xmlData[i + 7] === 'E'\n ) {\n let angleBracketsCount = 1;\n for (i += 8; i < xmlData.length; i++) {\n if (xmlData[i] === '<') {\n angleBracketsCount++;\n } else if (xmlData[i] === '>') {\n angleBracketsCount--;\n if (angleBracketsCount === 0) {\n break;\n }\n }\n }\n } else if (\n xmlData.length > i + 9 &&\n xmlData[i + 1] === '[' &&\n xmlData[i + 2] === 'C' &&\n xmlData[i + 3] === 'D' &&\n xmlData[i + 4] === 'A' &&\n xmlData[i + 5] === 'T' &&\n xmlData[i + 6] === 'A' &&\n xmlData[i + 7] === '['\n ) {\n for (i += 8; i < xmlData.length; i++) {\n if (xmlData[i] === ']' && xmlData[i + 1] === ']' && xmlData[i + 2] === '>') {\n i += 2;\n break;\n }\n }\n }\n\n return i;\n}\n\nconst doubleQuote = '\"';\nconst singleQuote = \"'\";\n\n/**\n * Keep reading xmlData until '<' is found outside the attribute value.\n * @param {string} xmlData\n * @param {number} i\n */\nfunction readAttributeStr(xmlData, i) {\n let attrStr = '';\n let startChar = '';\n let tagClosed = false;\n for (; i < xmlData.length; i++) {\n if (xmlData[i] === doubleQuote || xmlData[i] === singleQuote) {\n if (startChar === '') {\n startChar = xmlData[i];\n } else if (startChar !== xmlData[i]) {\n //if vaue is enclosed with double quote then single quotes are allowed inside the value and vice versa\n } else {\n startChar = '';\n }\n } else if (xmlData[i] === '>') {\n if (startChar === '') {\n tagClosed = true;\n break;\n }\n }\n attrStr += xmlData[i];\n }\n if (startChar !== '') {\n return false;\n }\n\n return {\n value: attrStr,\n index: i,\n tagClosed: tagClosed\n };\n}\n\n/**\n * Select all the attributes whether valid or invalid.\n */\nconst validAttrStrRegxp = new RegExp('(\\\\s*)([^\\\\s=]+)(\\\\s*=)?(\\\\s*([\\'\"])(([\\\\s\\\\S])*?)\\\\5)?', 'g');\n\n//attr, =\"sd\", a=\"amit's\", a=\"sd\"b=\"saf\", ab cd=\"\"\n\nfunction validateAttributeString(attrStr, options) {\n //console.log(\"start:\"+attrStr+\":end\");\n\n //if(attrStr.trim().length === 0) return true; //empty string\n\n const matches = getAllMatches(attrStr, validAttrStrRegxp);\n const attrNames = {};\n\n for (let i = 0; i < matches.length; i++) {\n if (matches[i][1].length === 0) {\n //nospace before attribute name: a=\"sd\"b=\"saf\"\n return getErrorObject('InvalidAttr', \"Attribute '\" + matches[i][2] + \"' has no space in starting.\", getPositionFromMatch(matches[i]))\n } else if (matches[i][3] !== undefined && matches[i][4] === undefined) {\n return getErrorObject('InvalidAttr', \"Attribute '\" + matches[i][2] + \"' is without value.\", getPositionFromMatch(matches[i]));\n } else if (matches[i][3] === undefined && !options.allowBooleanAttributes) {\n //independent attribute: ab\n return getErrorObject('InvalidAttr', \"boolean attribute '\" + matches[i][2] + \"' is not allowed.\", getPositionFromMatch(matches[i]));\n }\n /* else if(matches[i][6] === undefined){//attribute without value: ab=\n return { err: { code:\"InvalidAttr\",msg:\"attribute \" + matches[i][2] + \" has no value assigned.\"}};\n } */\n const attrName = matches[i][2];\n if (!validateAttrName(attrName)) {\n return getErrorObject('InvalidAttr', \"Attribute '\" + attrName + \"' is an invalid name.\", getPositionFromMatch(matches[i]));\n }\n if (!Object.prototype.hasOwnProperty.call(attrNames, attrName)) {\n //check for duplicate attribute.\n attrNames[attrName] = 1;\n } else {\n return getErrorObject('InvalidAttr', \"Attribute '\" + attrName + \"' is repeated.\", getPositionFromMatch(matches[i]));\n }\n }\n\n return true;\n}\n\nfunction validateNumberAmpersand(xmlData, i) {\n let re = /\\d/;\n if (xmlData[i] === 'x') {\n i++;\n re = /[\\da-fA-F]/;\n }\n for (; i < xmlData.length; i++) {\n if (xmlData[i] === ';')\n return i;\n if (!xmlData[i].match(re))\n break;\n }\n return -1;\n}\n\nfunction validateAmpersand(xmlData, i) {\n // https://www.w3.org/TR/xml/#dt-charref\n i++;\n if (xmlData[i] === ';')\n return -1;\n if (xmlData[i] === '#') {\n i++;\n return validateNumberAmpersand(xmlData, i);\n }\n let count = 0;\n for (; i < xmlData.length; i++, count++) {\n if (xmlData[i].match(/\\w/) && count < 20)\n continue;\n if (xmlData[i] === ';')\n break;\n return -1;\n }\n return i;\n}\n\nfunction getErrorObject(code, message, lineNumber) {\n return {\n err: {\n code: code,\n msg: message,\n line: lineNumber.line || lineNumber,\n col: lineNumber.col,\n },\n };\n}\n\nfunction validateAttrName(attrName) {\n return isName(attrName);\n}\n\n// const startsWithXML = /^xml/i;\n\nfunction validateTagName(tagname) {\n return isName(tagname) /* && !tagname.match(startsWithXML) */;\n}\n\n//this function returns the line number for the character at the given index\nfunction getLineNumberForPosition(xmlData, index) {\n const lines = xmlData.substring(0, index).split(/\\r?\\n/);\n return {\n line: lines.length,\n\n // column number is last line's length + 1, because column numbering starts at 1:\n col: lines[lines.length - 1].length + 1\n };\n}\n\n//this function returns the position of the first character of match within attrStr\nfunction getPositionFromMatch(match) {\n return match.startIndex + match[1].length;\n}\n"],"names":["root","factory","exports","module","define","amd","this","__webpack_require__","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","nameStartChar","regexName","RegExp","isName","string","exec","defaultOptions","allowBooleanAttributes","unpairedTags","validate","xmlData","options","assign","tags","tagFound","reachedRoot","substr","i","length","readPI","err","isWhiteSpace","getErrorObject","getLineNumberForPosition","tagStartPos","readCommentAndCDATA","closingTag","tagName","trim","substring","validateTagName","result","readAttributeStr","attrStr","index","attrStrStart","isValid","validateAttributeString","code","msg","line","tagClosed","otg","pop","openPos","col","indexOf","push","afterAmp","validateAmpersand","JSON","stringify","map","t","replace","char","start","tagname","angleBracketsCount","doubleQuote","singleQuote","startChar","validAttrStrRegxp","matches","regex","match","allmatches","startIndex","lastIndex","len","getAllMatches","attrNames","getPositionFromMatch","undefined","attrName","validateAttrName","re","validateNumberAmpersand","count","message","lineNumber","lines","split"],"sourceRoot":""}
|
|
1
|
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pack://XMLValidator/webpack/universalModuleDefinition","webpack://XMLValidator/webpack/bootstrap","webpack://XMLValidator/webpack/runtime/define property getters","webpack://XMLValidator/webpack/runtime/hasOwnProperty shorthand","webpack://XMLValidator/webpack/runtime/make namespace object","webpack://XMLValidator/./src/util.js","webpack://XMLValidator/./src/validator.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"XMLValidator\"] = factory();\n\telse\n\t\troot[\"XMLValidator\"] = factory();\n})(this, () => {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","'use strict';\n\nconst nameStartChar = ':A-Za-z_\\\\u00C0-\\\\u00D6\\\\u00D8-\\\\u00F6\\\\u00F8-\\\\u02FF\\\\u0370-\\\\u037D\\\\u037F-\\\\u1FFF\\\\u200C-\\\\u200D\\\\u2070-\\\\u218F\\\\u2C00-\\\\u2FEF\\\\u3001-\\\\uD7FF\\\\uF900-\\\\uFDCF\\\\uFDF0-\\\\uFFFD';\nconst nameChar = nameStartChar + '\\\\-.\\\\d\\\\u00B7\\\\u0300-\\\\u036F\\\\u203F-\\\\u2040';\nexport const nameRegexp = '[' + nameStartChar + '][' + nameChar + ']*';\nconst regexName = new RegExp('^' + nameRegexp + '$');\n\nexport function getAllMatches(string, regex) {\n const matches = [];\n let match = regex.exec(string);\n while (match) {\n const allmatches = [];\n allmatches.startIndex = regex.lastIndex - match[0].length;\n const len = match.length;\n for (let index = 0; index < len; index++) {\n allmatches.push(match[index]);\n }\n matches.push(allmatches);\n match = regex.exec(string);\n }\n return matches;\n}\n\nexport const isName = function (string) {\n const match = regexName.exec(string);\n return !(match === null || typeof match === 'undefined');\n}\n\nexport function isExist(v) {\n return typeof v !== 'undefined';\n}\n\nexport function isEmptyObject(obj) {\n return Object.keys(obj).length === 0;\n}\n\nexport function getValue(v) {\n if (exports.isExist(v)) {\n return v;\n } else {\n return '';\n }\n}\n\n/**\n * Dangerous property names that could lead to prototype pollution or security issues\n */\nexport const DANGEROUS_PROPERTY_NAMES = [\n // '__proto__',\n // 'constructor',\n // 'prototype',\n 'hasOwnProperty',\n 'toString',\n 'valueOf',\n '__defineGetter__',\n '__defineSetter__',\n '__lookupGetter__',\n '__lookupSetter__'\n];\n\nexport const criticalProperties = [\"__proto__\", \"constructor\", \"prototype\"];","'use strict';\n\nimport { getAllMatches, isName } from './util.js';\n\nconst defaultOptions = {\n allowBooleanAttributes: false, //A tag can have attributes without any value\n unpairedTags: []\n};\n\n//const tagsPattern = new RegExp(\"<\\\\/?([\\\\w:\\\\-_\\.]+)\\\\s*\\/?>\",\"g\");\nexport function validate(xmlData, options) {\n options = Object.assign({}, defaultOptions, options);\n\n //xmlData = xmlData.replace(/(\\r\\n|\\n|\\r)/gm,\"\");//make it single line\n //xmlData = xmlData.replace(/(^\\s*<\\?xml.*?\\?>)/g,\"\");//Remove XML starting tag\n //xmlData = xmlData.replace(/(<!DOCTYPE[\\s\\w\\\"\\.\\/\\-\\:]+(\\[.*\\])*\\s*>)/g,\"\");//Remove DOCTYPE\n const tags = [];\n let tagFound = false;\n\n //indicates that the root tag has been closed (aka. depth 0 has been reached)\n let reachedRoot = false;\n\n if (xmlData[0] === '\\ufeff') {\n // check for byte order mark (BOM)\n xmlData = xmlData.substr(1);\n }\n\n for (let i = 0; i < xmlData.length; i++) {\n\n if (xmlData[i] === '<' && xmlData[i + 1] === '?') {\n i += 2;\n i = readPI(xmlData, i);\n if (i.err) return i;\n } else if (xmlData[i] === '<') {\n //starting of tag\n //read until you reach to '>' avoiding any '>' in attribute value\n let tagStartPos = i;\n i++;\n\n if (xmlData[i] === '!') {\n i = readCommentAndCDATA(xmlData, i);\n continue;\n } else {\n let closingTag = false;\n if (xmlData[i] === '/') {\n //closing tag\n closingTag = true;\n i++;\n }\n //read tagname\n let tagName = '';\n for (; i < xmlData.length &&\n xmlData[i] !== '>' &&\n xmlData[i] !== ' ' &&\n xmlData[i] !== '\\t' &&\n xmlData[i] !== '\\n' &&\n xmlData[i] !== '\\r'; i++\n ) {\n tagName += xmlData[i];\n }\n tagName = tagName.trim();\n //console.log(tagName);\n\n if (tagName[tagName.length - 1] === '/') {\n //self closing tag without attributes\n tagName = tagName.substring(0, tagName.length - 1);\n //continue;\n i--;\n }\n if (!validateTagName(tagName)) {\n let msg;\n if (tagName.trim().length === 0) {\n msg = \"Invalid space after '<'.\";\n } else {\n msg = \"Tag '\" + tagName + \"' is an invalid name.\";\n }\n return getErrorObject('InvalidTag', msg, getLineNumberForPosition(xmlData, i));\n }\n\n const result = readAttributeStr(xmlData, i);\n if (result === false) {\n return getErrorObject('InvalidAttr', \"Attributes for '\" + tagName + \"' have open quote.\", getLineNumberForPosition(xmlData, i));\n }\n let attrStr = result.value;\n i = result.index;\n\n if (attrStr[attrStr.length - 1] === '/') {\n //self closing tag\n const attrStrStart = i - attrStr.length;\n attrStr = attrStr.substring(0, attrStr.length - 1);\n const isValid = validateAttributeString(attrStr, options);\n if (isValid === true) {\n tagFound = true;\n //continue; //text may presents after self closing tag\n } else {\n //the result from the nested function returns the position of the error within the attribute\n //in order to get the 'true' error line, we need to calculate the position where the attribute begins (i - attrStr.length) and then add the position within the attribute\n //this gives us the absolute index in the entire xml, which we can use to find the line at last\n return getErrorObject(isValid.err.code, isValid.err.msg, getLineNumberForPosition(xmlData, attrStrStart + isValid.err.line));\n }\n } else if (closingTag) {\n if (!result.tagClosed) {\n return getErrorObject('InvalidTag', \"Closing tag '\" + tagName + \"' doesn't have proper closing.\", getLineNumberForPosition(xmlData, i));\n } else if (attrStr.trim().length > 0) {\n return getErrorObject('InvalidTag', \"Closing tag '\" + tagName + \"' can't have attributes or invalid starting.\", getLineNumberForPosition(xmlData, tagStartPos));\n } else if (tags.length === 0) {\n return getErrorObject('InvalidTag', \"Closing tag '\" + tagName + \"' has not been opened.\", getLineNumberForPosition(xmlData, tagStartPos));\n } else {\n const otg = tags.pop();\n if (tagName !== otg.tagName) {\n let openPos = getLineNumberForPosition(xmlData, otg.tagStartPos);\n return getErrorObject('InvalidTag',\n \"Expected closing tag '\" + otg.tagName + \"' (opened in line \" + openPos.line + \", col \" + openPos.col + \") instead of closing tag '\" + tagName + \"'.\",\n getLineNumberForPosition(xmlData, tagStartPos));\n }\n\n //when there are no more tags, we reached the root level.\n if (tags.length == 0) {\n reachedRoot = true;\n }\n }\n } else {\n const isValid = validateAttributeString(attrStr, options);\n if (isValid !== true) {\n //the result from the nested function returns the position of the error within the attribute\n //in order to get the 'true' error line, we need to calculate the position where the attribute begins (i - attrStr.length) and then add the position within the attribute\n //this gives us the absolute index in the entire xml, which we can use to find the line at last\n return getErrorObject(isValid.err.code, isValid.err.msg, getLineNumberForPosition(xmlData, i - attrStr.length + isValid.err.line));\n }\n\n //if the root level has been reached before ...\n if (reachedRoot === true) {\n return getErrorObject('InvalidXml', 'Multiple possible root nodes found.', getLineNumberForPosition(xmlData, i));\n } else if (options.unpairedTags.indexOf(tagName) !== -1) {\n //don't push into stack\n } else {\n tags.push({ tagName, tagStartPos });\n }\n tagFound = true;\n }\n\n //skip tag text value\n //It may include comments and CDATA value\n for (i++; i < xmlData.length; i++) {\n if (xmlData[i] === '<') {\n if (xmlData[i + 1] === '!') {\n //comment or CADATA\n i++;\n i = readCommentAndCDATA(xmlData, i);\n continue;\n } else if (xmlData[i + 1] === '?') {\n i = readPI(xmlData, ++i);\n if (i.err) return i;\n } else {\n break;\n }\n } else if (xmlData[i] === '&') {\n const afterAmp = validateAmpersand(xmlData, i);\n if (afterAmp == -1)\n return getErrorObject('InvalidChar', \"char '&' is not expected.\", getLineNumberForPosition(xmlData, i));\n i = afterAmp;\n } else {\n if (reachedRoot === true && !isWhiteSpace(xmlData[i])) {\n return getErrorObject('InvalidXml', \"Extra text at the end\", getLineNumberForPosition(xmlData, i));\n }\n }\n } //end of reading tag text value\n if (xmlData[i] === '<') {\n i--;\n }\n }\n } else {\n if (isWhiteSpace(xmlData[i])) {\n continue;\n }\n return getErrorObject('InvalidChar', \"char '\" + xmlData[i] + \"' is not expected.\", getLineNumberForPosition(xmlData, i));\n }\n }\n\n if (!tagFound) {\n return getErrorObject('InvalidXml', 'Start tag expected.', 1);\n } else if (tags.length == 1) {\n return getErrorObject('InvalidTag', \"Unclosed tag '\" + tags[0].tagName + \"'.\", getLineNumberForPosition(xmlData, tags[0].tagStartPos));\n } else if (tags.length > 0) {\n return getErrorObject('InvalidXml', \"Invalid '\" +\n JSON.stringify(tags.map(t => t.tagName), null, 4).replace(/\\r?\\n/g, '') +\n \"' found.\", { line: 1, col: 1 });\n }\n\n return true;\n};\n\nfunction isWhiteSpace(char) {\n return char === ' ' || char === '\\t' || char === '\\n' || char === '\\r';\n}\n/**\n * Read Processing insstructions and skip\n * @param {*} xmlData\n * @param {*} i\n */\nfunction readPI(xmlData, i) {\n const start = i;\n for (; i < xmlData.length; i++) {\n if (xmlData[i] == '?' || xmlData[i] == ' ') {\n //tagname\n const tagname = xmlData.substr(start, i - start);\n if (i > 5 && tagname === 'xml') {\n return getErrorObject('InvalidXml', 'XML declaration allowed only at the start of the document.', getLineNumberForPosition(xmlData, i));\n } else if (xmlData[i] == '?' && xmlData[i + 1] == '>') {\n //check if valid attribut string\n i++;\n break;\n } else {\n continue;\n }\n }\n }\n return i;\n}\n\nfunction readCommentAndCDATA(xmlData, i) {\n if (xmlData.length > i + 5 && xmlData[i + 1] === '-' && xmlData[i + 2] === '-') {\n //comment\n for (i += 3; i < xmlData.length; i++) {\n if (xmlData[i] === '-' && xmlData[i + 1] === '-' && xmlData[i + 2] === '>') {\n i += 2;\n break;\n }\n }\n } else if (\n xmlData.length > i + 8 &&\n xmlData[i + 1] === 'D' &&\n xmlData[i + 2] === 'O' &&\n xmlData[i + 3] === 'C' &&\n xmlData[i + 4] === 'T' &&\n xmlData[i + 5] === 'Y' &&\n xmlData[i + 6] === 'P' &&\n xmlData[i + 7] === 'E'\n ) {\n let angleBracketsCount = 1;\n for (i += 8; i < xmlData.length; i++) {\n if (xmlData[i] === '<') {\n angleBracketsCount++;\n } else if (xmlData[i] === '>') {\n angleBracketsCount--;\n if (angleBracketsCount === 0) {\n break;\n }\n }\n }\n } else if (\n xmlData.length > i + 9 &&\n xmlData[i + 1] === '[' &&\n xmlData[i + 2] === 'C' &&\n xmlData[i + 3] === 'D' &&\n xmlData[i + 4] === 'A' &&\n xmlData[i + 5] === 'T' &&\n xmlData[i + 6] === 'A' &&\n xmlData[i + 7] === '['\n ) {\n for (i += 8; i < xmlData.length; i++) {\n if (xmlData[i] === ']' && xmlData[i + 1] === ']' && xmlData[i + 2] === '>') {\n i += 2;\n break;\n }\n }\n }\n\n return i;\n}\n\nconst doubleQuote = '\"';\nconst singleQuote = \"'\";\n\n/**\n * Keep reading xmlData until '<' is found outside the attribute value.\n * @param {string} xmlData\n * @param {number} i\n */\nfunction readAttributeStr(xmlData, i) {\n let attrStr = '';\n let startChar = '';\n let tagClosed = false;\n for (; i < xmlData.length; i++) {\n if (xmlData[i] === doubleQuote || xmlData[i] === singleQuote) {\n if (startChar === '') {\n startChar = xmlData[i];\n } else if (startChar !== xmlData[i]) {\n //if vaue is enclosed with double quote then single quotes are allowed inside the value and vice versa\n } else {\n startChar = '';\n }\n } else if (xmlData[i] === '>') {\n if (startChar === '') {\n tagClosed = true;\n break;\n }\n }\n attrStr += xmlData[i];\n }\n if (startChar !== '') {\n return false;\n }\n\n return {\n value: attrStr,\n index: i,\n tagClosed: tagClosed\n };\n}\n\n/**\n * Select all the attributes whether valid or invalid.\n */\nconst validAttrStrRegxp = new RegExp('(\\\\s*)([^\\\\s=]+)(\\\\s*=)?(\\\\s*([\\'\"])(([\\\\s\\\\S])*?)\\\\5)?', 'g');\n\n//attr, =\"sd\", a=\"amit's\", a=\"sd\"b=\"saf\", ab cd=\"\"\n\nfunction validateAttributeString(attrStr, options) {\n //console.log(\"start:\"+attrStr+\":end\");\n\n //if(attrStr.trim().length === 0) return true; //empty string\n\n const matches = getAllMatches(attrStr, validAttrStrRegxp);\n const attrNames = {};\n\n for (let i = 0; i < matches.length; i++) {\n if (matches[i][1].length === 0) {\n //nospace before attribute name: a=\"sd\"b=\"saf\"\n return getErrorObject('InvalidAttr', \"Attribute '\" + matches[i][2] + \"' has no space in starting.\", getPositionFromMatch(matches[i]))\n } else if (matches[i][3] !== undefined && matches[i][4] === undefined) {\n return getErrorObject('InvalidAttr', \"Attribute '\" + matches[i][2] + \"' is without value.\", getPositionFromMatch(matches[i]));\n } else if (matches[i][3] === undefined && !options.allowBooleanAttributes) {\n //independent attribute: ab\n return getErrorObject('InvalidAttr', \"boolean attribute '\" + matches[i][2] + \"' is not allowed.\", getPositionFromMatch(matches[i]));\n }\n /* else if(matches[i][6] === undefined){//attribute without value: ab=\n return { err: { code:\"InvalidAttr\",msg:\"attribute \" + matches[i][2] + \" has no value assigned.\"}};\n } */\n const attrName = matches[i][2];\n if (!validateAttrName(attrName)) {\n return getErrorObject('InvalidAttr', \"Attribute '\" + attrName + \"' is an invalid name.\", getPositionFromMatch(matches[i]));\n }\n if (!Object.prototype.hasOwnProperty.call(attrNames, attrName)) {\n //check for duplicate attribute.\n attrNames[attrName] = 1;\n } else {\n return getErrorObject('InvalidAttr', \"Attribute '\" + attrName + \"' is repeated.\", getPositionFromMatch(matches[i]));\n }\n }\n\n return true;\n}\n\nfunction validateNumberAmpersand(xmlData, i) {\n let re = /\\d/;\n if (xmlData[i] === 'x') {\n i++;\n re = /[\\da-fA-F]/;\n }\n for (; i < xmlData.length; i++) {\n if (xmlData[i] === ';')\n return i;\n if (!xmlData[i].match(re))\n break;\n }\n return -1;\n}\n\nfunction validateAmpersand(xmlData, i) {\n // https://www.w3.org/TR/xml/#dt-charref\n i++;\n if (xmlData[i] === ';')\n return -1;\n if (xmlData[i] === '#') {\n i++;\n return validateNumberAmpersand(xmlData, i);\n }\n let count = 0;\n for (; i < xmlData.length; i++, count++) {\n if (xmlData[i].match(/\\w/) && count < 20)\n continue;\n if (xmlData[i] === ';')\n break;\n return -1;\n }\n return i;\n}\n\nfunction getErrorObject(code, message, lineNumber) {\n return {\n err: {\n code: code,\n msg: message,\n line: lineNumber.line || lineNumber,\n col: lineNumber.col,\n },\n };\n}\n\nfunction validateAttrName(attrName) {\n return isName(attrName);\n}\n\n// const startsWithXML = /^xml/i;\n\nfunction validateTagName(tagname) {\n return isName(tagname) /* && !tagname.match(startsWithXML) */;\n}\n\n//this function returns the line number for the character at the given index\nfunction getLineNumberForPosition(xmlData, index) {\n const lines = xmlData.substring(0, index).split(/\\r?\\n/);\n return {\n line: lines.length,\n\n // column number is last line's length + 1, because column numbering starts at 1:\n col: lines[lines.length - 1].length + 1\n };\n}\n\n//this function returns the position of the first character of match within attrStr\nfunction getPositionFromMatch(match) {\n return match.startIndex + match[1].length;\n}\n"],"names":["root","factory","exports","module","define","amd","this","__webpack_require__","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","nameStartChar","regexName","RegExp","isName","string","exec","defaultOptions","allowBooleanAttributes","unpairedTags","validate","xmlData","options","assign","tags","tagFound","reachedRoot","substr","i","length","readPI","err","isWhiteSpace","getErrorObject","getLineNumberForPosition","tagStartPos","readCommentAndCDATA","closingTag","tagName","trim","substring","validateTagName","result","readAttributeStr","attrStr","index","attrStrStart","isValid","validateAttributeString","code","msg","line","tagClosed","otg","pop","openPos","col","indexOf","push","afterAmp","validateAmpersand","JSON","stringify","map","t","replace","char","start","tagname","angleBracketsCount","doubleQuote","singleQuote","startChar","validAttrStrRegxp","matches","regex","match","allmatches","startIndex","lastIndex","len","getAllMatches","attrNames","getPositionFromMatch","undefined","attrName","validateAttrName","re","validateNumberAmpersand","count","message","lineNumber","lines","split"],"sourceRoot":""}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fast-xml-parser",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.5.6",
|
|
4
4
|
"description": "Validate XML, Parse XML, Build XML without C/C++ based libraries",
|
|
5
5
|
"main": "./lib/fxp.cjs",
|
|
6
6
|
"type": "module",
|
|
@@ -87,7 +87,8 @@
|
|
|
87
87
|
}
|
|
88
88
|
],
|
|
89
89
|
"dependencies": {
|
|
90
|
-
"fast-xml-builder": "^1.
|
|
90
|
+
"fast-xml-builder": "^1.1.4",
|
|
91
|
+
"path-expression-matcher": "^1.1.3",
|
|
91
92
|
"strnum": "^2.1.2"
|
|
92
93
|
}
|
|
93
94
|
}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
//import type { Matcher, Expression } from 'path-expression-matcher';
|
|
2
|
+
|
|
3
|
+
type Matcher = unknown;
|
|
4
|
+
type Expression = unknown;
|
|
5
|
+
|
|
1
6
|
export type ProcessEntitiesOptions = {
|
|
2
7
|
/**
|
|
3
8
|
* Whether to enable entity processing
|
|
@@ -34,6 +39,13 @@ export type ProcessEntitiesOptions = {
|
|
|
34
39
|
*/
|
|
35
40
|
maxExpandedLength?: number;
|
|
36
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Maximum number of entities allowed in the XML
|
|
44
|
+
*
|
|
45
|
+
* Defaults to `100`
|
|
46
|
+
*/
|
|
47
|
+
maxEntityCount?: number;
|
|
48
|
+
|
|
37
49
|
/**
|
|
38
50
|
* Array of tag names where entity replacement is allowed.
|
|
39
51
|
* If null, entities are replaced in all tags.
|
|
@@ -46,12 +58,12 @@ export type ProcessEntitiesOptions = {
|
|
|
46
58
|
* Custom filter function to determine if entities should be replaced in a tag
|
|
47
59
|
*
|
|
48
60
|
* @param tagName - The name of the current tag
|
|
49
|
-
* @param
|
|
61
|
+
* @param jPathOrMatcher - The jPath string (if jPath: true) or Matcher instance (if jPath: false)
|
|
50
62
|
* @returns `true` to allow entity replacement, `false` to skip
|
|
51
63
|
*
|
|
52
64
|
* Defaults to `null`
|
|
53
65
|
*/
|
|
54
|
-
tagFilter?: ((tagName: string,
|
|
66
|
+
tagFilter?: ((tagName: string, jPathOrMatcher: string | Matcher) => boolean) | null;
|
|
55
67
|
};
|
|
56
68
|
|
|
57
69
|
export type X2jOptions = {
|
|
@@ -96,7 +108,7 @@ export type X2jOptions = {
|
|
|
96
108
|
*
|
|
97
109
|
* Defaults to `true`
|
|
98
110
|
*/
|
|
99
|
-
ignoreAttributes?: boolean | (string | RegExp)[] | ((attrName: string,
|
|
111
|
+
ignoreAttributes?: boolean | (string | RegExp)[] | ((attrName: string, jPathOrMatcher: string | Matcher) => boolean);
|
|
100
112
|
|
|
101
113
|
/**
|
|
102
114
|
* Whether to remove namespace string from tag and attribute names
|
|
@@ -150,28 +162,33 @@ export type X2jOptions = {
|
|
|
150
162
|
/**
|
|
151
163
|
* Control how tag value should be parsed. Called only if tag value is not empty
|
|
152
164
|
*
|
|
165
|
+
* @param tagName - The name of the tag
|
|
166
|
+
* @param tagValue - The value of the tag
|
|
167
|
+
* @param jPathOrMatcher - The jPath string (if jPath: true) or Matcher instance (if jPath: false)
|
|
168
|
+
* @param hasAttributes - Whether the tag has attributes
|
|
169
|
+
* @param isLeafNode - Whether the tag is a leaf node
|
|
153
170
|
* @returns {undefined|null} `undefined` or `null` to set original value.
|
|
154
171
|
* @returns {unknown}
|
|
155
172
|
*
|
|
156
173
|
* 1. Different value or value with different data type to set new value.
|
|
157
174
|
* 2. Same value to set parsed value if `parseTagValue: true`.
|
|
158
175
|
*
|
|
159
|
-
* Defaults to `(tagName, val,
|
|
176
|
+
* Defaults to `(tagName, val, jPathOrMatcher, hasAttributes, isLeafNode) => val`
|
|
160
177
|
*/
|
|
161
|
-
tagValueProcessor?: (tagName: string, tagValue: string,
|
|
178
|
+
tagValueProcessor?: (tagName: string, tagValue: string, jPathOrMatcher: string | Matcher, hasAttributes: boolean, isLeafNode: boolean) => unknown;
|
|
162
179
|
|
|
163
180
|
/**
|
|
164
181
|
* Control how attribute value should be parsed
|
|
165
182
|
*
|
|
166
|
-
* @param attrName
|
|
167
|
-
* @param attrValue
|
|
168
|
-
* @param jPath
|
|
183
|
+
* @param attrName - The name of the attribute
|
|
184
|
+
* @param attrValue - The value of the attribute
|
|
185
|
+
* @param jPathOrMatcher - The jPath string (if jPath: true) or Matcher instance (if jPath: false)
|
|
169
186
|
* @returns {undefined|null} `undefined` or `null` to set original value
|
|
170
187
|
* @returns {unknown}
|
|
171
188
|
*
|
|
172
|
-
* Defaults to `(attrName, val,
|
|
189
|
+
* Defaults to `(attrName, val, jPathOrMatcher) => val`
|
|
173
190
|
*/
|
|
174
|
-
attributeValueProcessor?: (attrName: string, attrValue: string,
|
|
191
|
+
attributeValueProcessor?: (attrName: string, attrValue: string, jPathOrMatcher: string | Matcher) => unknown;
|
|
175
192
|
|
|
176
193
|
/**
|
|
177
194
|
* Options to pass to `strnum` for parsing numbers
|
|
@@ -183,9 +200,13 @@ export type X2jOptions = {
|
|
|
183
200
|
/**
|
|
184
201
|
* Nodes to stop parsing at
|
|
185
202
|
*
|
|
203
|
+
* Accepts string patterns or Expression objects from path-expression-matcher
|
|
204
|
+
*
|
|
205
|
+
* String patterns starting with "*." are automatically converted to ".." for backward compatibility
|
|
206
|
+
*
|
|
186
207
|
* Defaults to `[]`
|
|
187
208
|
*/
|
|
188
|
-
stopNodes?: string[];
|
|
209
|
+
stopNodes?: (string | Expression)[];
|
|
189
210
|
|
|
190
211
|
/**
|
|
191
212
|
* List of tags without closing tags
|
|
@@ -204,15 +225,15 @@ export type X2jOptions = {
|
|
|
204
225
|
/**
|
|
205
226
|
* Determine whether a tag should be parsed as an array
|
|
206
227
|
*
|
|
207
|
-
* @param tagName
|
|
208
|
-
* @param jPath
|
|
209
|
-
* @param isLeafNode
|
|
210
|
-
* @param isAttribute
|
|
228
|
+
* @param tagName - The name of the tag
|
|
229
|
+
* @param jPathOrMatcher - The jPath string (if jPath: true) or Matcher instance (if jPath: false)
|
|
230
|
+
* @param isLeafNode - Whether the tag is a leaf node
|
|
231
|
+
* @param isAttribute - Whether this is an attribute
|
|
211
232
|
* @returns {boolean}
|
|
212
233
|
*
|
|
213
234
|
* Defaults to `() => false`
|
|
214
235
|
*/
|
|
215
|
-
isArray?: (tagName: string,
|
|
236
|
+
isArray?: (tagName: string, jPathOrMatcher: string | Matcher, isLeafNode: boolean, isAttribute: boolean) => boolean;
|
|
216
237
|
|
|
217
238
|
/**
|
|
218
239
|
* Whether to process default and DOCTYPE entities
|
|
@@ -266,12 +287,15 @@ export type X2jOptions = {
|
|
|
266
287
|
* Change the tag name when a different name is returned. Skip the tag from parsed result when false is returned.
|
|
267
288
|
* Modify `attrs` object to control attributes for the given tag.
|
|
268
289
|
*
|
|
290
|
+
* @param tagName - The name of the tag
|
|
291
|
+
* @param jPathOrMatcher - The jPath string (if jPath: true) or Matcher instance (if jPath: false)
|
|
292
|
+
* @param attrs - The attributes object
|
|
269
293
|
* @returns {string} new tag name.
|
|
270
294
|
* @returns false to skip the tag
|
|
271
295
|
*
|
|
272
|
-
* Defaults to `(tagName,
|
|
296
|
+
* Defaults to `(tagName, jPathOrMatcher, attrs) => tagName`
|
|
273
297
|
*/
|
|
274
|
-
updateTag?: (tagName: string,
|
|
298
|
+
updateTag?: (tagName: string, jPathOrMatcher: string | Matcher, attrs: { [k: string]: string }) => string | boolean;
|
|
275
299
|
|
|
276
300
|
/**
|
|
277
301
|
* If true, adds a Symbol to all object nodes, accessible by {@link XMLParser.getMetaDataSymbol} with
|
|
@@ -292,6 +316,27 @@ export type X2jOptions = {
|
|
|
292
316
|
* Defaults to `true`
|
|
293
317
|
*/
|
|
294
318
|
strictReservedNames?: boolean;
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* Controls whether callbacks receive jPath as string or Matcher instance
|
|
322
|
+
*
|
|
323
|
+
* When `true` - callbacks receive jPath as string (backward compatible)
|
|
324
|
+
*
|
|
325
|
+
* When `false` - callbacks receive Matcher instance for advanced pattern matching
|
|
326
|
+
*
|
|
327
|
+
* Defaults to `true`
|
|
328
|
+
*/
|
|
329
|
+
jPath?: boolean;
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Function to sanitize dangerous property names
|
|
333
|
+
*
|
|
334
|
+
* @param name - The name of the property
|
|
335
|
+
* @returns {string} The sanitized name
|
|
336
|
+
*
|
|
337
|
+
* Defaults to `(name) => __name`
|
|
338
|
+
*/
|
|
339
|
+
onDangerousProperty?: (name: string) => string;
|
|
295
340
|
};
|
|
296
341
|
|
|
297
342
|
|
|
@@ -430,9 +475,11 @@ export type XmlBuilderOptions = {
|
|
|
430
475
|
/**
|
|
431
476
|
* Nodes to stop parsing at
|
|
432
477
|
*
|
|
478
|
+
* Accepts string patterns or Expression objects from path-expression-matcher
|
|
479
|
+
*
|
|
433
480
|
* Defaults to `[]`
|
|
434
481
|
*/
|
|
435
|
-
stopNodes?: string[];
|
|
482
|
+
stopNodes?: (string | Expression)[];
|
|
436
483
|
|
|
437
484
|
/**
|
|
438
485
|
* Control how tag value should be parsed. Called only if tag value is not empty
|
|
@@ -469,6 +516,13 @@ export type XmlBuilderOptions = {
|
|
|
469
516
|
|
|
470
517
|
|
|
471
518
|
oneListGroup?: boolean;
|
|
519
|
+
|
|
520
|
+
/**
|
|
521
|
+
* Maximum number of nested tags
|
|
522
|
+
*
|
|
523
|
+
* Defaults to `100`
|
|
524
|
+
*/
|
|
525
|
+
maxNestedTags?: number;
|
|
472
526
|
};
|
|
473
527
|
|
|
474
528
|
type ESchema = string | object | Array<string | object>;
|
|
@@ -41,3 +41,21 @@ export function getValue(v) {
|
|
|
41
41
|
return '';
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Dangerous property names that could lead to prototype pollution or security issues
|
|
47
|
+
*/
|
|
48
|
+
export const DANGEROUS_PROPERTY_NAMES = [
|
|
49
|
+
// '__proto__',
|
|
50
|
+
// 'constructor',
|
|
51
|
+
// 'prototype',
|
|
52
|
+
'hasOwnProperty',
|
|
53
|
+
'toString',
|
|
54
|
+
'valueOf',
|
|
55
|
+
'__defineGetter__',
|
|
56
|
+
'__defineSetter__',
|
|
57
|
+
'__lookupGetter__',
|
|
58
|
+
'__lookupSetter__'
|
|
59
|
+
];
|
|
60
|
+
|
|
61
|
+
export const criticalProperties = ["__proto__", "constructor", "prototype"];
|
|
@@ -7,8 +7,9 @@ export default class DocTypeReader {
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
readDocType(xmlData, i) {
|
|
10
|
-
|
|
11
10
|
const entities = Object.create(null);
|
|
11
|
+
let entityCount = 0;
|
|
12
|
+
|
|
12
13
|
if (xmlData[i + 3] === 'O' &&
|
|
13
14
|
xmlData[i + 4] === 'C' &&
|
|
14
15
|
xmlData[i + 5] === 'T' &&
|
|
@@ -26,11 +27,20 @@ export default class DocTypeReader {
|
|
|
26
27
|
let entityName, val;
|
|
27
28
|
[entityName, val, i] = this.readEntityExp(xmlData, i + 1, this.suppressValidationErr);
|
|
28
29
|
if (val.indexOf("&") === -1) { //Parameter entities are not supported
|
|
29
|
-
|
|
30
|
+
if (this.options.enabled !== false &&
|
|
31
|
+
this.options.maxEntityCount &&
|
|
32
|
+
entityCount >= this.options.maxEntityCount) {
|
|
33
|
+
throw new Error(
|
|
34
|
+
`Entity count (${entityCount + 1}) exceeds maximum allowed (${this.options.maxEntityCount})`
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
//const escaped = entityName.replace(/[.\-+*:]/g, '\\.');
|
|
38
|
+
const escaped = entityName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
30
39
|
entities[entityName] = {
|
|
31
40
|
regx: RegExp(`&${escaped};`, "g"),
|
|
32
41
|
val: val
|
|
33
42
|
};
|
|
43
|
+
entityCount++;
|
|
34
44
|
}
|
|
35
45
|
}
|
|
36
46
|
else if (hasBody && hasSeq(xmlData, "!ELEMENT", i)) {
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
import { DANGEROUS_PROPERTY_NAMES, criticalProperties } from "../util.js";
|
|
2
|
+
|
|
3
|
+
const defaultOnDangerousProperty = (name) => {
|
|
4
|
+
if (DANGEROUS_PROPERTY_NAMES.includes(name)) {
|
|
5
|
+
return "__" + name;
|
|
6
|
+
}
|
|
7
|
+
return name;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
|
|
1
11
|
export const defaultOptions = {
|
|
2
12
|
preserveOrder: false,
|
|
3
13
|
attributeNamePrefix: '@_',
|
|
@@ -40,8 +50,36 @@ export const defaultOptions = {
|
|
|
40
50
|
captureMetaData: false,
|
|
41
51
|
maxNestedTags: 100,
|
|
42
52
|
strictReservedNames: true,
|
|
53
|
+
jPath: true, // if true, pass jPath string to callbacks; if false, pass matcher instance
|
|
54
|
+
onDangerousProperty: defaultOnDangerousProperty
|
|
43
55
|
};
|
|
44
56
|
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Validates that a property name is safe to use
|
|
60
|
+
* @param {string} propertyName - The property name to validate
|
|
61
|
+
* @param {string} optionName - The option field name (for error message)
|
|
62
|
+
* @throws {Error} If property name is dangerous
|
|
63
|
+
*/
|
|
64
|
+
function validatePropertyName(propertyName, optionName) {
|
|
65
|
+
if (typeof propertyName !== 'string') {
|
|
66
|
+
return; // Only validate string property names
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const normalized = propertyName.toLowerCase();
|
|
70
|
+
if (DANGEROUS_PROPERTY_NAMES.some(dangerous => normalized === dangerous.toLowerCase())) {
|
|
71
|
+
throw new Error(
|
|
72
|
+
`[SECURITY] Invalid ${optionName}: "${propertyName}" is a reserved JavaScript keyword that could cause prototype pollution`
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (criticalProperties.some(dangerous => normalized === dangerous.toLowerCase())) {
|
|
77
|
+
throw new Error(
|
|
78
|
+
`[SECURITY] Invalid ${optionName}: "${propertyName}" is a reserved JavaScript keyword that could cause prototype pollution`
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
45
83
|
/**
|
|
46
84
|
* Normalizes processEntities option for backward compatibility
|
|
47
85
|
* @param {boolean|object} value
|
|
@@ -56,6 +94,7 @@ function normalizeProcessEntities(value) {
|
|
|
56
94
|
maxExpansionDepth: 10,
|
|
57
95
|
maxTotalExpansions: 1000,
|
|
58
96
|
maxExpandedLength: 100000,
|
|
97
|
+
maxEntityCount: 100,
|
|
59
98
|
allowedTags: null,
|
|
60
99
|
tagFilter: null
|
|
61
100
|
};
|
|
@@ -69,6 +108,7 @@ function normalizeProcessEntities(value) {
|
|
|
69
108
|
maxExpansionDepth: value.maxExpansionDepth ?? 10,
|
|
70
109
|
maxTotalExpansions: value.maxTotalExpansions ?? 1000,
|
|
71
110
|
maxExpandedLength: value.maxExpandedLength ?? 100000,
|
|
111
|
+
maxEntityCount: value.maxEntityCount ?? 100,
|
|
72
112
|
allowedTags: value.allowedTags ?? null,
|
|
73
113
|
tagFilter: value.tagFilter ?? null
|
|
74
114
|
};
|
|
@@ -81,8 +121,39 @@ function normalizeProcessEntities(value) {
|
|
|
81
121
|
export const buildOptions = function (options) {
|
|
82
122
|
const built = Object.assign({}, defaultOptions, options);
|
|
83
123
|
|
|
124
|
+
// Validate property names to prevent prototype pollution
|
|
125
|
+
const propertyNameOptions = [
|
|
126
|
+
{ value: built.attributeNamePrefix, name: 'attributeNamePrefix' },
|
|
127
|
+
{ value: built.attributesGroupName, name: 'attributesGroupName' },
|
|
128
|
+
{ value: built.textNodeName, name: 'textNodeName' },
|
|
129
|
+
{ value: built.cdataPropName, name: 'cdataPropName' },
|
|
130
|
+
{ value: built.commentPropName, name: 'commentPropName' }
|
|
131
|
+
];
|
|
132
|
+
|
|
133
|
+
for (const { value, name } of propertyNameOptions) {
|
|
134
|
+
if (value) {
|
|
135
|
+
validatePropertyName(value, name);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (built.onDangerousProperty === null) {
|
|
140
|
+
built.onDangerousProperty = defaultOnDangerousProperty;
|
|
141
|
+
}
|
|
142
|
+
|
|
84
143
|
// Always normalize processEntities for backward compatibility and validation
|
|
85
144
|
built.processEntities = normalizeProcessEntities(built.processEntities);
|
|
145
|
+
|
|
146
|
+
// Convert old-style stopNodes for backward compatibility
|
|
147
|
+
if (built.stopNodes && Array.isArray(built.stopNodes)) {
|
|
148
|
+
built.stopNodes = built.stopNodes.map(node => {
|
|
149
|
+
if (typeof node === 'string' && node.startsWith('*.')) {
|
|
150
|
+
// Old syntax: *.tagname meant "tagname anywhere"
|
|
151
|
+
// Convert to new syntax: ..tagname
|
|
152
|
+
return '..' + node.substring(2);
|
|
153
|
+
}
|
|
154
|
+
return node;
|
|
155
|
+
});
|
|
156
|
+
}
|
|
86
157
|
//console.debug(built.processEntities)
|
|
87
158
|
return built;
|
|
88
159
|
};
|