@xmldom/xmldom 0.8.0 → 0.8.1
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/CHANGELOG.md +13 -1
- package/SECURITY.md +50 -0
- package/lib/sax.js +19 -19
- package/package.json +18 -6
- package/readme.md +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,18 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [0.8.1](https://github.com/xmldom/xmldom/compare/0.8.0...0.8.1)
|
|
8
|
+
|
|
9
|
+
### Fixes
|
|
10
|
+
- Only use own properties in entityMap [`#374`](https://github.com/xmldom/xmldom/pull/374)
|
|
11
|
+
|
|
12
|
+
### Docs
|
|
13
|
+
- Add security policy [`#365`](https://github.com/xmldom/xmldom/pull/365)
|
|
14
|
+
- changelog: Correct contributor name and link [`#366`](https://github.com/xmldom/xmldom/pull/366)
|
|
15
|
+
- Describe release/publish steps [`#358`](https://github.com/xmldom/xmldom/pull/358), [`#376`](https://github.com/xmldom/xmldom/pull/376)
|
|
16
|
+
- Add snyk package health badge [`#360`](https://github.com/xmldom/xmldom/pull/360)
|
|
17
|
+
|
|
18
|
+
|
|
7
19
|
## [0.8.0](https://github.com/xmldom/xmldom/compare/0.7.5...0.8.0)
|
|
8
20
|
|
|
9
21
|
### Fixed
|
|
@@ -41,7 +53,7 @@ Thank you [@marrus-sh](https://github.com/marrus-sh), [@victorandree](https://gi
|
|
|
41
53
|
### Fixes:
|
|
42
54
|
|
|
43
55
|
- Restore ability to parse `__prototype__` attributes [`#315`](https://github.com/xmldom/xmldom/pull/315)
|
|
44
|
-
Thank you [@
|
|
56
|
+
Thank you [@dsimpsonOMF](https://github.com/dsimpsonOMF)
|
|
45
57
|
|
|
46
58
|
## 0.7.3
|
|
47
59
|
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
The most up-to-date version of this document can be found at <https://github.com/xmldom/xmldom/security/policy>.
|
|
4
|
+
|
|
5
|
+
## Supported Versions
|
|
6
|
+
|
|
7
|
+
This repository contains the code for the libraries `xmldom` and `@xmldom/xmldom` on npm.
|
|
8
|
+
|
|
9
|
+
As long as we didn't publish v1, we aim to maintain the last two minor versions with security fixes. If it is possible we provide security fixes as path versions.
|
|
10
|
+
If you think there is a good reason to also patch an earlier version let us know in a github issue or the release discussion once the fix has been provided.
|
|
11
|
+
The maintainers will consider it and if we agree and have/find the required resources, a patch for that version will be provided.
|
|
12
|
+
|
|
13
|
+
Please notice that [we are no longer able to publish the (unscoped) `xmldom` package](https://github.com/xmldom/xmldom/issues/271),
|
|
14
|
+
and that all existing versions of `xmldom` are affected by at least one security vulnerability and should be considered deprecated.
|
|
15
|
+
You can still report issues regarding `xmldom` as described below.
|
|
16
|
+
|
|
17
|
+
If you need help with migrating from `xmldom` to `@xmldom/xmldom`, file a github issue or PR in the affected repository and mention @karfau.
|
|
18
|
+
|
|
19
|
+
## Reporting vulnerabilities
|
|
20
|
+
|
|
21
|
+
Please email reports about any security related issues you find to `security@xmldom.org`, which will forward it to the list of maintainers.
|
|
22
|
+
The maintainers will try to respond within 7 calendar days. (If nobody peplies after 7 days, please us send a reminder!)
|
|
23
|
+
As part of you communication please make sure to always hit "Reply all", so all maintainers are kept in the loop.
|
|
24
|
+
|
|
25
|
+
In addition, please include the following information along with your report:
|
|
26
|
+
|
|
27
|
+
- Your name and affiliation (if any).
|
|
28
|
+
- A description of the technical details of the vulnerabilities. It is very important to let us know how we can reproduce your findings.
|
|
29
|
+
- An explanation who can exploit this vulnerability, and what they gain when doing so -- write an attack scenario. This will help us evaluate your report quickly, especially if the issue is complex.
|
|
30
|
+
- Whether this vulnerability public or known to third parties. If it is, please provide details.
|
|
31
|
+
|
|
32
|
+
If you believe that an existing (public) issue is security-related, please send an email to `security@xmldom.org`.
|
|
33
|
+
The email should include the issue URL and a short description of why it should be handled according to this security policy.
|
|
34
|
+
|
|
35
|
+
Once an issue is reported, the maintainers use the following disclosure process:
|
|
36
|
+
|
|
37
|
+
- When a report is received, we confirm the issue, determine its severity and the affected versions.
|
|
38
|
+
- If we know of specific third-party services or software based on xmldom that require mitigation before publication, those projects will be notified.
|
|
39
|
+
- A [github security advisory](https://docs.github.com/en/code-security/security-advisories/about-github-security-advisories) is [created](https://docs.github.com/en/code-security/security-advisories/creating-a-security-advisory) (but not published) which details the problem and steps for mitigation.
|
|
40
|
+
- If the reporter provides a github account and agrees to it, we (add that github account as a collaborator on the advisuory)[https://docs.github.com/en/code-security/security-advisories/adding-a-collaborator-to-a-security-advisory].
|
|
41
|
+
- The vulnerability is fixed in a [private fork](https://docs.github.com/en/code-security/security-advisories/collaborating-in-a-temporary-private-fork-to-resolve-a-security-vulnerability) and potential workarounds are identified.
|
|
42
|
+
- The maintainers audit the existing code to find any potential similar problems.
|
|
43
|
+
- The release for the current minor version and the [security advisory are published](https://docs.github.com/en/code-security/security-advisories/publishing-a-security-advisory).
|
|
44
|
+
- The release(s) for previous minor version(s) are published.
|
|
45
|
+
|
|
46
|
+
We credit reporters for identifying security issues, if they confirm that they want to.
|
|
47
|
+
|
|
48
|
+
## Known vulnerabilities
|
|
49
|
+
|
|
50
|
+
See https://github.com/xmldom/xmldom/security/advisories?state=published
|
package/lib/sax.js
CHANGED
|
@@ -12,7 +12,7 @@ var tagNamePattern = new RegExp('^'+nameStartChar.source+nameChar.source+'*(?:\:
|
|
|
12
12
|
//S_TAG, S_ATTR, S_EQ, S_ATTR_NOQUOT_VALUE
|
|
13
13
|
//S_ATTR_SPACE, S_ATTR_END, S_TAG_SPACE, S_TAG_CLOSE
|
|
14
14
|
var S_TAG = 0;//tag name offerring
|
|
15
|
-
var S_ATTR = 1;//attr name offerring
|
|
15
|
+
var S_ATTR = 1;//attr name offerring
|
|
16
16
|
var S_ATTR_SPACE=2;//attr name end and space offer
|
|
17
17
|
var S_EQ = 3;//=space?
|
|
18
18
|
var S_ATTR_NOQUOT_VALUE = 4;//attr value(no quot value only)
|
|
@@ -36,7 +36,7 @@ ParseError.prototype = new Error();
|
|
|
36
36
|
ParseError.prototype.name = ParseError.name
|
|
37
37
|
|
|
38
38
|
function XMLReader(){
|
|
39
|
-
|
|
39
|
+
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
XMLReader.prototype = {
|
|
@@ -65,8 +65,8 @@ function parse(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){
|
|
|
65
65
|
}
|
|
66
66
|
function entityReplacer(a){
|
|
67
67
|
var k = a.slice(1,-1);
|
|
68
|
-
if(k
|
|
69
|
-
return entityMap[k];
|
|
68
|
+
if (Object.hasOwnProperty.call(entityMap, k)) {
|
|
69
|
+
return entityMap[k];
|
|
70
70
|
}else if(k.charAt(0) === '#'){
|
|
71
71
|
return fixedFromCharCode(parseInt(k.substr(1).replace('x','0x')))
|
|
72
72
|
}else{
|
|
@@ -95,7 +95,7 @@ function parse(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){
|
|
|
95
95
|
var lineEnd = 0;
|
|
96
96
|
var linePattern = /.*(?:\r\n?|\n)|.*$/g
|
|
97
97
|
var locator = domBuilder.locator;
|
|
98
|
-
|
|
98
|
+
|
|
99
99
|
var parseStack = [{currentNSMap:defaultNSMapCopy}]
|
|
100
100
|
var closeMap = {};
|
|
101
101
|
var start = 0;
|
|
@@ -120,7 +120,7 @@ function parse(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){
|
|
|
120
120
|
var tagName = source.substring(tagStart + 2, end).replace(/[ \t\n\r]+$/g, '');
|
|
121
121
|
var config = parseStack.pop();
|
|
122
122
|
if(end<0){
|
|
123
|
-
|
|
123
|
+
|
|
124
124
|
tagName = source.substring(tagStart+2).replace(/[\s<].*/,'');
|
|
125
125
|
errorHandler.error("end tag name: "+tagName+' is not complete:'+config.tagName);
|
|
126
126
|
end = tagStart+1+tagName.length;
|
|
@@ -145,7 +145,7 @@ function parse(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){
|
|
|
145
145
|
}else{
|
|
146
146
|
parseStack.push(config)
|
|
147
147
|
}
|
|
148
|
-
|
|
148
|
+
|
|
149
149
|
end++;
|
|
150
150
|
break;
|
|
151
151
|
// end elment
|
|
@@ -164,8 +164,8 @@ function parse(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){
|
|
|
164
164
|
//elStartEnd
|
|
165
165
|
var end = parseElementStartPart(source,tagStart,el,currentNSMap,entityReplacer,errorHandler);
|
|
166
166
|
var len = el.length;
|
|
167
|
-
|
|
168
|
-
|
|
167
|
+
|
|
168
|
+
|
|
169
169
|
if(!el.closed && fixSelfClosed(source,end,el.tagName,closeMap)){
|
|
170
170
|
el.closed = true;
|
|
171
171
|
if(!entityMap.nbsp){
|
|
@@ -435,7 +435,7 @@ function appendElement(el,domBuilder,currentNSMap){
|
|
|
435
435
|
}
|
|
436
436
|
//can not set prefix,because prefix !== ''
|
|
437
437
|
a.localName = localName ;
|
|
438
|
-
//prefix == null for no ns prefix attribute
|
|
438
|
+
//prefix == null for no ns prefix attribute
|
|
439
439
|
if(nsPrefix !== false){//hack!!
|
|
440
440
|
if(localNSMap == null){
|
|
441
441
|
localNSMap = {}
|
|
@@ -445,7 +445,7 @@ function appendElement(el,domBuilder,currentNSMap){
|
|
|
445
445
|
}
|
|
446
446
|
currentNSMap[nsPrefix] = localNSMap[nsPrefix] = value;
|
|
447
447
|
a.uri = NAMESPACE.XMLNS
|
|
448
|
-
domBuilder.startPrefixMapping(nsPrefix, value)
|
|
448
|
+
domBuilder.startPrefixMapping(nsPrefix, value)
|
|
449
449
|
}
|
|
450
450
|
}
|
|
451
451
|
var i = el.length;
|
|
@@ -457,7 +457,7 @@ function appendElement(el,domBuilder,currentNSMap){
|
|
|
457
457
|
a.uri = NAMESPACE.XML;
|
|
458
458
|
}if(prefix !== 'xmlns'){
|
|
459
459
|
a.uri = currentNSMap[prefix || '']
|
|
460
|
-
|
|
460
|
+
|
|
461
461
|
//{console.log('###'+a.qName,domBuilder.locator.systemId+'',currentNSMap,a.uri)}
|
|
462
462
|
}
|
|
463
463
|
}
|
|
@@ -479,7 +479,7 @@ function appendElement(el,domBuilder,currentNSMap){
|
|
|
479
479
|
domBuilder.endElement(ns,localName,tagName);
|
|
480
480
|
if(localNSMap){
|
|
481
481
|
for(prefix in localNSMap){
|
|
482
|
-
domBuilder.endPrefixMapping(prefix)
|
|
482
|
+
domBuilder.endPrefixMapping(prefix)
|
|
483
483
|
}
|
|
484
484
|
}
|
|
485
485
|
}else{
|
|
@@ -506,7 +506,7 @@ function parseHtmlSpecialContent(source,elStartEnd,tagName,entityReplacer,domBui
|
|
|
506
506
|
domBuilder.characters(text,0,text.length);
|
|
507
507
|
return elEndStart;
|
|
508
508
|
//}
|
|
509
|
-
|
|
509
|
+
|
|
510
510
|
}
|
|
511
511
|
}
|
|
512
512
|
return elStartEnd+1;
|
|
@@ -523,7 +523,7 @@ function fixSelfClosed(source,elStartEnd,tagName,closeMap){
|
|
|
523
523
|
closeMap[tagName] =pos
|
|
524
524
|
}
|
|
525
525
|
return pos<elStartEnd;
|
|
526
|
-
//}
|
|
526
|
+
//}
|
|
527
527
|
}
|
|
528
528
|
function _copy(source,target){
|
|
529
529
|
for(var n in source){target[n] = source[n]}
|
|
@@ -551,11 +551,11 @@ function parseDCC(source,start,domBuilder,errorHandler){//sure start with '<!'
|
|
|
551
551
|
var end = source.indexOf(']]>',start+9);
|
|
552
552
|
domBuilder.startCDATA();
|
|
553
553
|
domBuilder.characters(source,start+9,end-start-9);
|
|
554
|
-
domBuilder.endCDATA()
|
|
554
|
+
domBuilder.endCDATA()
|
|
555
555
|
return end+3;
|
|
556
556
|
}
|
|
557
557
|
//<!DOCTYPE
|
|
558
|
-
//startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
|
|
558
|
+
//startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
|
|
559
559
|
var matchs = split(source,start);
|
|
560
560
|
var len = matchs.length;
|
|
561
561
|
if(len>1 && /!doctype/i.test(matchs[0][0])){
|
|
@@ -573,7 +573,7 @@ function parseDCC(source,start,domBuilder,errorHandler){//sure start with '<!'
|
|
|
573
573
|
var lastMatch = matchs[len-1]
|
|
574
574
|
domBuilder.startDTD(name, pubid, sysid);
|
|
575
575
|
domBuilder.endDTD();
|
|
576
|
-
|
|
576
|
+
|
|
577
577
|
return lastMatch.index+lastMatch[0].length
|
|
578
578
|
}
|
|
579
579
|
}
|
|
@@ -622,7 +622,7 @@ ElementAttributes.prototype = {
|
|
|
622
622
|
getValue:function(i){return this[i].value}
|
|
623
623
|
// ,getIndex:function(uri, localName)){
|
|
624
624
|
// if(localName){
|
|
625
|
-
//
|
|
625
|
+
//
|
|
626
626
|
// }else{
|
|
627
627
|
// var qName = uri
|
|
628
628
|
// }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xmldom/xmldom",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "A pure JavaScript W3C standard-based (XML DOM Level 2 Core) DOMParser and XMLSerializer module.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"w3c",
|
|
@@ -23,29 +23,35 @@
|
|
|
23
23
|
"CHANGELOG.md",
|
|
24
24
|
"LICENSE",
|
|
25
25
|
"readme.md",
|
|
26
|
+
"SECURITY.md",
|
|
26
27
|
"index.d.ts",
|
|
27
28
|
"lib"
|
|
28
29
|
],
|
|
29
30
|
"scripts": {
|
|
30
31
|
"lint": "eslint lib test",
|
|
32
|
+
"changelog": "auto-changelog --unreleased-only",
|
|
31
33
|
"start": "nodemon --watch package.json --watch lib --watch test --exec 'npm --silent run test && npm --silent run lint'",
|
|
32
34
|
"stryker": "stryker run",
|
|
33
35
|
"stryker:dry-run": "stryker run -m '' --reporters progress",
|
|
34
|
-
"test": "jest"
|
|
36
|
+
"test": "jest",
|
|
37
|
+
"version": "./changelog-has-version.sh",
|
|
38
|
+
"release": "np --no-yarn"
|
|
35
39
|
},
|
|
36
40
|
"engines": {
|
|
37
41
|
"node": ">=10.0.0"
|
|
38
42
|
},
|
|
39
43
|
"dependencies": {},
|
|
40
44
|
"devDependencies": {
|
|
41
|
-
"@stryker-mutator/core": "5.
|
|
42
|
-
"
|
|
45
|
+
"@stryker-mutator/core": "5.6.1",
|
|
46
|
+
"auto-changelog": "2.4.0",
|
|
47
|
+
"eslint": "8.9.0",
|
|
43
48
|
"eslint-config-prettier": "8.3.0",
|
|
44
49
|
"eslint-plugin-es5": "1.5.0",
|
|
45
50
|
"eslint-plugin-prettier": "4.0.0",
|
|
46
51
|
"get-stream": "6.0.1",
|
|
47
|
-
"jest": "27.
|
|
52
|
+
"jest": "27.5.1",
|
|
48
53
|
"nodemon": "2.0.15",
|
|
54
|
+
"np": "7.6.0",
|
|
49
55
|
"prettier": "2.5.1",
|
|
50
56
|
"xmltest": "1.5.0",
|
|
51
57
|
"yauzl": "2.10.0"
|
|
@@ -53,5 +59,11 @@
|
|
|
53
59
|
"bugs": {
|
|
54
60
|
"url": "https://github.com/xmldom/xmldom/issues"
|
|
55
61
|
},
|
|
56
|
-
"license": "MIT"
|
|
62
|
+
"license": "MIT",
|
|
63
|
+
"auto-changelog": {
|
|
64
|
+
"prepend": true,
|
|
65
|
+
"remote": "upstream",
|
|
66
|
+
"tagPrefix": "",
|
|
67
|
+
"template": "./auto-changelog.hbs"
|
|
68
|
+
}
|
|
57
69
|
}
|
package/readme.md
CHANGED
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
***Since version 0.7.0 this package is published to npm as [`@xmldom/xmldom`](https://www.npmjs.com/package/@xmldom/xmldom) and no longer as [`xmldom`](https://www.npmjs.com/package/xmldom), because [we are no longer able to publish `xmldom`](https://github.com/xmldom/xmldom/issues/271).***
|
|
4
4
|
*For better readability in the docs we will continue to talk about this library as "xmldom".*
|
|
5
5
|
|
|
6
|
-
[](LICENSE)
|
|
6
|
+
[](https://github.com/xmldom/xmldom/blob/master/LICENSE)
|
|
7
7
|
[](https://www.npmjs.com/package/@xmldom/xmldom)
|
|
8
|
+
[](https://snyk.io/advisor/npm-package/@xmldom/xmldom)
|
|
8
9
|
[](https://github.com/xmldom/xmldom/issues?q=is%3Aissue+is%3Aopen+label%3Abug)
|
|
9
10
|
[](https://github.com/xmldom/xmldom/issues?q=is%3Aissue+is%3Aopen+label%3Ahelp-wanted)
|
|
10
11
|
[](https://dashboard.stryker-mutator.io/reports/github.com/xmldom/xmldom/master)
|