sanitize-html 2.3.1 → 2.3.2
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 +5 -1
- package/README.md +1 -1
- package/index.js +4 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.3.2 (2021-01-26):
|
|
4
|
+
- Additional fixes for iframe validation exploits. Prevent exploits based on browsers' tolerance of the use of "\" rather than "/" and the presence of whitespace at this point in the URL. Thanks to Ron Masas of [Checkmarx](https://www.checkmarx.com/) for pointing out the issue and writing unit tests.
|
|
5
|
+
- Documentation correction for `yarn` users. Thanks to Tagir Khadzhiev.
|
|
6
|
+
|
|
3
7
|
## 2.3.1 (2021-01-22):
|
|
4
|
-
- Uses the standard WHATWG URL parser to stop IDNA (Internationalized Domain Name) attacks on the iframe hostname validator. Thanks to Ron Masas of Checkmarx for pointing out the issue and suggesting the use of the WHATWG parser.
|
|
8
|
+
- Uses the standard WHATWG URL parser to stop IDNA (Internationalized Domain Name) attacks on the iframe hostname validator. Thanks to Ron Masas of [Checkmarx](https://www.checkmarx.com/) for pointing out the issue and suggesting the use of the WHATWG parser.
|
|
5
9
|
|
|
6
10
|
## 2.3.0 (2020-12-16):
|
|
7
11
|
- Upgrades `htmlparser2` to new major version `^6.0.0`. Thanks to [Bogdan Chadkin](https://github.com/TrySound) for the contribution.
|
package/README.md
CHANGED
|
@@ -42,7 +42,7 @@ But, perhaps you'd like to display sanitized HTML immediately in the browser for
|
|
|
42
42
|
* Run npm install and:
|
|
43
43
|
|
|
44
44
|
```bash
|
|
45
|
-
npm install sanitize-html # yarn
|
|
45
|
+
npm install sanitize-html # yarn add sanitize-html
|
|
46
46
|
```
|
|
47
47
|
|
|
48
48
|
The primary change in the 2.x version of sanitize-html is that it no longer includes a build that is ready for browser use. Developers are expected to include sanitize-html in their project builds (e.g., webpack) as they would any other dependency. So while sanitize-html is no longer ready to link to directly in HTML, developers can now more easily process it according to their needs.
|
package/index.js
CHANGED
|
@@ -304,6 +304,10 @@ function sanitizeHtml(html, options, _recursing) {
|
|
|
304
304
|
if (name === 'iframe' && a === 'src') {
|
|
305
305
|
let allowed = true;
|
|
306
306
|
try {
|
|
307
|
+
// Chrome accepts \ as a substitute for / in the // at the
|
|
308
|
+
// start of a URL, so rewrite accordingly to prevent exploit.
|
|
309
|
+
// Also drop any whitespace at that point in the URL
|
|
310
|
+
value = value.replace(/^(\w+:)?\s*[\\/]\s*[\\/]/, '$1//');
|
|
307
311
|
if (value.startsWith('relative:')) {
|
|
308
312
|
// An attempt to exploit our workaround for base URLs being
|
|
309
313
|
// mandatory for relative URL validation in the WHATWG
|
package/package.json
CHANGED