sanitize-html 1.19.1 → 1.20.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 CHANGED
@@ -1,5 +1,16 @@
1
1
  ## Changelog
2
2
 
3
+ 1.20.1: Fix failing tests, add CircleCI config
4
+
5
+ 1.20.0: reduced size of npm package via the `files` key; we only need to publish what's in `dist`. Thanks to Steven. There should be zero impact on behavior, minor version bump is precautionary.
6
+
7
+ 1.19.3: reverted to `postcss` due to a [reported issue with `css-tree` that might or might not have XSS implications](https://github.com/punkave/sanitize-html/issues/269).
8
+
9
+ 1.19.2:
10
+
11
+ * Switched out the heavy `postcss` dependency for the lightweight `css-tree` module. No API changes. Thanks to Justin Braithwaite.
12
+ * Various doc updates. Thanks to Pulkit Aggarwal and Cody Robertson.
13
+
3
14
  1.19.1:
4
15
 
5
16
  * `"` characters are now entity-escaped only when they appear in attribute values, reducing the verbosity of the resulting markup.
@@ -167,4 +178,3 @@ We're rocking our tests and have been working great in production for months, so
167
178
  0.1.1: discard the text of script tags.
168
179
 
169
180
  0.1.0: initial release.
170
-
package/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # sanitize-html
2
2
 
3
- <a href="http://apostrophenow.org/"><img src="https://raw.github.com/punkave/sanitize-html/master/logos/logo-box-madefor.png" align="right" /></a>
3
+ [![CircleCI](https://circleci.com/gh/punkave/sanitize-html/tree/master.svg?style=svg)](https://circleci.com/gh/punkave/sanitize-html/tree/master)
4
+
5
+ <a href="https://apostrophecms.org/"><img src="https://raw.github.com/punkave/sanitize-html/master/logos/logo-box-madefor.png" align="right" /></a>
4
6
 
5
7
  `sanitize-html` provides a simple HTML sanitizer with a clear API.
6
8
 
@@ -110,7 +112,8 @@ allowedTags: [ 'h3', 'h4', 'h5', 'h6', 'blockquote', 'p', 'a', 'ul', 'ol',
110
112
  allowedAttributes: {
111
113
  a: [ 'href', 'name', 'target' ],
112
114
  // We don't currently allow img itself by default, but this
113
- // would make sense if we did
115
+ // would make sense if we did. You could add srcset here,
116
+ // and if you do the URL is checked for safety
114
117
  img: [ 'src' ]
115
118
  },
116
119
  // Lots of these won't come up by default because we don't allow them
@@ -119,8 +122,7 @@ selfClosing: [ 'img', 'br', 'hr', 'area', 'base', 'basefont', 'input', 'link', '
119
122
  allowedSchemes: [ 'http', 'https', 'ftp', 'mailto' ],
120
123
  allowedSchemesByTag: {},
121
124
  allowedSchemesAppliedToAttributes: [ 'href', 'src', 'cite' ],
122
- allowProtocolRelative: true,
123
- allowedIframeHostnames: ['www.youtube.com', 'player.vimeo.com']
125
+ allowProtocolRelative: true
124
126
  ```
125
127
 
126
128
  #### "What if I want to allow all tags or all attributes?"
@@ -135,11 +137,11 @@ allowedAttributes: false
135
137
 
136
138
  #### "What if I don't want to allow *any* tags?"
137
139
 
138
- Also simple! Set your `allowedTag` and `allowedAttributes` to empty arrays (`[]`).
140
+ Also simple! Set `allowedTags` to `[]` and `allowedAttributes` to `{}`.
139
141
 
140
142
  ```js
141
143
  allowedTags: [],
142
- allowedAttributes: []
144
+ allowedAttributes: {}
143
145
  ```
144
146
 
145
147
  ### "What if I want to allow only specific values on some attributes?"
package/dist/index.js CHANGED
@@ -547,9 +547,9 @@ function sanitizeHtml(html, options, _recursing) {
547
547
  */
548
548
  function stringifyStyleAttributes(filteredAST) {
549
549
  return filteredAST.nodes[0].nodes.reduce(function (extractedAttributes, attributeObject) {
550
- extractedAttributes.push(attributeObject.prop + ':' + attributeObject.value + ';');
550
+ extractedAttributes.push(attributeObject.prop + ':' + attributeObject.value);
551
551
  return extractedAttributes;
552
- }, []).join('');
552
+ }, []).join(';');
553
553
  }
554
554
 
555
555
  /**