@xmldom/xmldom 0.9.0-beta.2 → 0.9.0-beta.4

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 CHANGED
@@ -4,14 +4,64 @@ 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.9.0-beta.2](https://github.com/xmldom/xmldom/compare/0.9.0-beta.1...0.9.0-beta.2)
7
+ ## [0.9.0-beta.4](https://github.com/xmldom/xmldom/compare/0.9.0-beta.3...0.9.0-beta.4)
8
+
9
+ ### Fixed
10
+
11
+ - Security: Prevent inserting DOM nodes when they are not well-formed [`CVE-2022-39353`](https://github.com/xmldom/xmldom/security/advisories/GHSA-crh6-fp67-6883)
12
+ In case such a DOM would be created, the part that is not well-formed will be transformed into text nodes, in which xml specific characters like `<` and `>` are encoded accordingly.
13
+ In the upcoming version 0.9.0 those text nodes will no longer be added and an error will be thrown instead.
14
+ This change can break your code, if you relied on this behavior, e.g. multiple root elements in the past. We consider it more important to align with the specs that we want to be aligned with, considering the potential security issues that might derive from people not being aware of the difference in behavior.
15
+ Related Spec: <https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity>
16
+
17
+ ### Chore
18
+
19
+ - update multiple devDependencies
20
+ - Add eslint-plugin-node for `lib` [`#448`](https://github.com/xmldom/xmldom/pull/448) / [`#190`](https://github.com/xmldom/xmldom/issues/190)
21
+ - style: Apply prettier to all code [`#447`](https://github.com/xmldom/xmldom/pull/447) / [`#29`](https://github.com/xmldom/xmldom/issues/29) / [`#130`](https://github.com/xmldom/xmldom/issues/130)
22
+
23
+ Thank you, [@XhmikosR](https://github.com/XhmikosR), [@awwright](https://github.com/awwright), [@frumioj](https://github.com/frumioj), [@cjbarth](https://github.com/cjbarth), [@markgollnick](https://github.com/markgollnick) for your contributions
8
24
 
25
+ ## [0.9.0-beta.3](https://github.com/xmldom/xmldom/compare/0.9.0-beta.2...0.9.0-beta.3)
26
+
27
+ ### Fixed
28
+
29
+ - fix: Stop adding tags after incomplete closing tag [`#445`](https://github.com/xmldom/xmldom/pull/445) / [`#416`](https://github.com/xmldom/xmldom/pull/416)
30
+ BREAKING CHANGE: It no longer reports an error when parsing HTML containing incomplete closing tags, to align the behavior with the one in the browser.
31
+ BREAKING CHANGE: If your code relied on not well-formed XML to be parsed and include subsequent tags, this will no longer work.
32
+ - fix: Avoid bidirectional characters in source code [`#440`](https://github.com/xmldom/xmldom/pull/440)
33
+
34
+ ### Other
35
+
36
+ - ci: Add CodeQL scan [`#444`](https://github.com/xmldom/xmldom/pull/444)
37
+
38
+ Thank you, [@ACN-kck](https://github.com/ACN-kck), [@mgerlach](https://github.com/mgerlach) for your contributions
39
+
40
+
41
+ ## [0.7.6](https://github.com/xmldom/xmldom/compare/0.7.5...0.7.6)
42
+
43
+ ### Fixed
44
+ - Avoid iterating over prototype properties [`#441`](https://github.com/xmldom/xmldom/pull/441) / [`#437`](https://github.com/xmldom/xmldom/pull/437) / [`#436`](https://github.com/xmldom/xmldom/issues/436)
45
+
46
+ Thank you, [@jftanner](https://github.com/jftanner), [@Supraja9726](https://github.com/Supraja9726) for your contributions
47
+
48
+
49
+ ## [0.8.3](https://github.com/xmldom/xmldom/compare/0.8.3...0.8.2)
50
+
51
+ ### Fixed
52
+ - Avoid iterating over prototype properties [`#437`](https://github.com/xmldom/xmldom/pull/437) / [`#436`](https://github.com/xmldom/xmldom/issues/436)
53
+
54
+ Thank you, [@Supraja9726](https://github.com/Supraja9726) for your contributions
55
+
56
+
57
+ ## [0.9.0-beta.2](https://github.com/xmldom/xmldom/compare/0.9.0-beta.1...0.9.0-beta.2)
9
58
 
10
59
  ### Fixed
11
60
  - Avoid iterating over prototype properties [`#437`](https://github.com/xmldom/xmldom/pull/437) / [`#436`](https://github.com/xmldom/xmldom/issues/436)
12
61
 
13
62
  Thank you, [@Supraja9726](https://github.com/Supraja9726) for your contributions
14
63
 
64
+
15
65
  ## [0.9.0-beta.1](https://github.com/xmldom/xmldom/compare/0.8.2...0.9.0-beta.1)
16
66
 
17
67
  ### Fixed
@@ -55,6 +105,7 @@ Thank you [@weiwu-zhang](https://github.com/weiwu-zhang) for your contributions
55
105
 
56
106
  - update multiple devDependencies
57
107
 
108
+
58
109
  ## [0.8.2](https://github.com/xmldom/xmldom/compare/0.8.1...0.8.2)
59
110
 
60
111
  ### Fixed
package/SECURITY.md CHANGED
@@ -6,20 +6,20 @@ The most up-to-date version of this document can be found at <https://github.com
6
6
 
7
7
  This repository contains the code for the libraries `xmldom` and `@xmldom/xmldom` on npm.
8
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.
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 patch 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
12
 
13
13
  Please notice that [we are no longer able to publish the (unscoped) `xmldom` package](https://github.com/xmldom/xmldom/issues/271),
14
14
  and that all existing versions of `xmldom` are affected by at least one security vulnerability and should be considered deprecated.
15
15
  You can still report issues regarding `xmldom` as described below.
16
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.
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
18
 
19
19
  ## Reporting vulnerabilities
20
20
 
21
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!)
22
+ The maintainers will try to respond within 7 calendar days. (If nobody replies after 7 days, please us send a reminder!)
23
23
  As part of you communication please make sure to always hit "Reply all", so all maintainers are kept in the loop.
24
24
 
25
25
  In addition, please include the following information along with your report:
@@ -29,15 +29,15 @@ In addition, please include the following information along with your report:
29
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
30
  - Whether this vulnerability public or known to third parties. If it is, please provide details.
31
31
 
32
- If you believe that an existing (public) issue is security-related, please send an email to `security@xmldom.org`.
32
+ If you believe that an existing (public) issue is security-related, please email `security@xmldom.org`.
33
33
  The email should include the issue URL and a short description of why it should be handled according to this security policy.
34
34
 
35
35
  Once an issue is reported, the maintainers use the following disclosure process:
36
36
 
37
37
  - When a report is received, we confirm the issue, determine its severity and the affected versions.
38
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].
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 advisory](https://docs.github.com/en/code-security/security-advisories/adding-a-collaborator-to-a-security-advisory).
41
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
42
  - The maintainers audit the existing code to find any potential similar problems.
43
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).
package/lib/.eslintrc.yml CHANGED
@@ -1,2 +1,3 @@
1
1
  extends:
2
2
  - 'plugin:es5/no-es2015'
3
+ - 'plugin:node/recommended'
@@ -1,4 +1,4 @@
1
- 'use strict'
1
+ 'use strict';
2
2
 
3
3
  /**
4
4
  * "Shallow freezes" an object to render it immutable.
@@ -17,9 +17,9 @@
17
17
  */
18
18
  function freeze(object, oc) {
19
19
  if (oc === undefined) {
20
- oc = Object
20
+ oc = Object;
21
21
  }
22
- return oc && typeof oc.freeze === 'function' ? oc.freeze(object) : object
22
+ return oc && typeof oc.freeze === 'function' ? oc.freeze(object) : object;
23
23
  }
24
24
 
25
25
  /**
@@ -37,14 +37,14 @@ function freeze(object, oc) {
37
37
  */
38
38
  function assign(target, source) {
39
39
  if (target === null || typeof target !== 'object') {
40
- throw new TypeError('target is not an object')
40
+ throw new TypeError('target is not an object');
41
41
  }
42
42
  for (var key in source) {
43
43
  if (Object.prototype.hasOwnProperty.call(source, key)) {
44
- target[key] = source[key]
44
+ target[key] = source[key];
45
45
  }
46
46
  }
47
- return target
47
+ return target;
48
48
  }
49
49
 
50
50
  /**
@@ -87,7 +87,7 @@ var HTML_BOOLEAN_ATTRIBUTES = freeze({
87
87
  required: true,
88
88
  reversed: true,
89
89
  selected: true,
90
- })
90
+ });
91
91
 
92
92
  /**
93
93
  * Check if `name` is matching one of the HTML boolean attribute names.
@@ -100,7 +100,7 @@ var HTML_BOOLEAN_ATTRIBUTES = freeze({
100
100
  * @see https://html.spec.whatwg.org/#attributes-3
101
101
  */
102
102
  function isHTMLBooleanAttribute(name) {
103
- return HTML_BOOLEAN_ATTRIBUTES.hasOwnProperty(name.toLowerCase())
103
+ return HTML_BOOLEAN_ATTRIBUTES.hasOwnProperty(name.toLowerCase());
104
104
  }
105
105
 
106
106
  /**
@@ -131,7 +131,7 @@ var HTML_VOID_ELEMENTS = freeze({
131
131
  source: true,
132
132
  track: true,
133
133
  wbr: true,
134
- })
134
+ });
135
135
 
136
136
  /**
137
137
  * Check if `tagName` is matching one of the HTML void element names.
@@ -144,7 +144,7 @@ var HTML_VOID_ELEMENTS = freeze({
144
144
  * @see https://html.spec.whatwg.org/#void-elements
145
145
  */
146
146
  function isHTMLVoidElement(tagName) {
147
- return HTML_VOID_ELEMENTS.hasOwnProperty(tagName.toLowerCase())
147
+ return HTML_VOID_ELEMENTS.hasOwnProperty(tagName.toLowerCase());
148
148
  }
149
149
 
150
150
  /**
@@ -161,7 +161,7 @@ var HTML_RAW_TEXT_ELEMENTS = freeze({
161
161
  style: false,
162
162
  textarea: true,
163
163
  title: true,
164
- })
164
+ });
165
165
 
166
166
  /**
167
167
  * Check if `tagName` is matching one of the HTML raw text element names.
@@ -227,7 +227,7 @@ var MIME_TYPE = freeze({
227
227
  * @see [`DOMParser.parseFromString` @ HTML Specification](https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring)
228
228
  */
229
229
  isHTML: function (value) {
230
- return value === MIME_TYPE.HTML
230
+ return value === MIME_TYPE.HTML;
231
231
  },
232
232
 
233
233
  /**
@@ -242,9 +242,7 @@ var MIME_TYPE = freeze({
242
242
  * @see https://dom.spec.whatwg.org/#dom-domimplementation-createhtmldocument
243
243
  */
244
244
  hasDefaultHTMLNamespace: function (mimeType) {
245
- return (
246
- MIME_TYPE.isHTML(mimeType) || mimeType === MIME_TYPE.XML_XHTML_APPLICATION
247
- )
245
+ return MIME_TYPE.isHTML(mimeType) || mimeType === MIME_TYPE.XML_XHTML_APPLICATION;
248
246
  },
249
247
 
250
248
  /**
@@ -283,7 +281,7 @@ var MIME_TYPE = freeze({
283
281
  * @see https://en.wikipedia.org/wiki/Scalable_Vector_Graphics Wikipedia
284
282
  */
285
283
  XML_SVG_IMAGE: 'image/svg+xml',
286
- })
284
+ });
287
285
 
288
286
  /**
289
287
  * Namespaces that are used in this code base.
@@ -306,7 +304,7 @@ var NAMESPACE = freeze({
306
304
  * @see NAMESPACE.HTML
307
305
  */
308
306
  isHTML: function (uri) {
309
- return uri === NAMESPACE.HTML
307
+ return uri === NAMESPACE.HTML;
310
308
  },
311
309
 
312
310
  /**
@@ -329,16 +327,16 @@ var NAMESPACE = freeze({
329
327
  * @see https://www.w3.org/2000/xmlns/
330
328
  */
331
329
  XMLNS: 'http://www.w3.org/2000/xmlns/',
332
- })
330
+ });
333
331
 
334
- exports.assign = assign
335
- exports.freeze = freeze
336
- exports.HTML_BOOLEAN_ATTRIBUTES = HTML_BOOLEAN_ATTRIBUTES
337
- exports.HTML_RAW_TEXT_ELEMENTS = HTML_RAW_TEXT_ELEMENTS
338
- exports.HTML_VOID_ELEMENTS = HTML_VOID_ELEMENTS
339
- exports.isHTMLBooleanAttribute = isHTMLBooleanAttribute
340
- exports.isHTMLRawTextElement = isHTMLRawTextElement
341
- exports.isHTMLEscapableRawTextElement = isHTMLEscapableRawTextElement
342
- exports.isHTMLVoidElement = isHTMLVoidElement
343
- exports.MIME_TYPE = MIME_TYPE
344
- exports.NAMESPACE = NAMESPACE
332
+ exports.assign = assign;
333
+ exports.freeze = freeze;
334
+ exports.HTML_BOOLEAN_ATTRIBUTES = HTML_BOOLEAN_ATTRIBUTES;
335
+ exports.HTML_RAW_TEXT_ELEMENTS = HTML_RAW_TEXT_ELEMENTS;
336
+ exports.HTML_VOID_ELEMENTS = HTML_VOID_ELEMENTS;
337
+ exports.isHTMLBooleanAttribute = isHTMLBooleanAttribute;
338
+ exports.isHTMLRawTextElement = isHTMLRawTextElement;
339
+ exports.isHTMLEscapableRawTextElement = isHTMLEscapableRawTextElement;
340
+ exports.isHTMLVoidElement = isHTMLVoidElement;
341
+ exports.MIME_TYPE = MIME_TYPE;
342
+ exports.NAMESPACE = NAMESPACE;