selma 0.5.3 → 0.5.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.
- checksums.yaml +4 -4
- data/Cargo.lock +6 -6
- data/README.md +1 -1
- data/ext/selma/Cargo.toml +1 -1
- data/ext/selma/src/tags.rs +12 -1
- data/lib/selma/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9bad668396052252afb3ff8e14400bbe010624aa224ef4c186d52f31939c7ccc
|
|
4
|
+
data.tar.gz: 5df036f8760268c7377fd447d30196f551a8ce4c55d93a38a9318e5a40dfd86c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bbb137a5b8013274687d6122c791ec2c30efbe13f5a5b2688ea60888ecf010b0ff7f4a17eb1ab3f2691ff7527240e0428ad45d616f159cf86be7c1f41bb1cbc6
|
|
7
|
+
data.tar.gz: c80e09b3e9de266be755cdda31e3c03c91b2fd2c40b0175a741e8b70ea965e9a8f43be929a0de802254af6656b5a7c7420bbb3b17556fc4dd3a7fa34f0e28b6f
|
data/Cargo.lock
CHANGED
|
@@ -275,9 +275,9 @@ dependencies = [
|
|
|
275
275
|
|
|
276
276
|
[[package]]
|
|
277
277
|
name = "magnus"
|
|
278
|
-
version = "0.
|
|
278
|
+
version = "0.9.0"
|
|
279
279
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
280
|
-
checksum = "
|
|
280
|
+
checksum = "379d50b6eea4ca84074ccd3e551eb9b07f7865194d5b3198325317e9ef78e5e9"
|
|
281
281
|
dependencies = [
|
|
282
282
|
"magnus-macros",
|
|
283
283
|
"rb-sys",
|
|
@@ -287,9 +287,9 @@ dependencies = [
|
|
|
287
287
|
|
|
288
288
|
[[package]]
|
|
289
289
|
name = "magnus-macros"
|
|
290
|
-
version = "0.
|
|
290
|
+
version = "0.9.1"
|
|
291
291
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
292
|
-
checksum = "
|
|
292
|
+
checksum = "9dafde2eeb66f090e0f326112323eb8324b12cb32b5d1210e541d3df6b0ce77e"
|
|
293
293
|
dependencies = [
|
|
294
294
|
"proc-macro2",
|
|
295
295
|
"quote",
|
|
@@ -298,9 +298,9 @@ dependencies = [
|
|
|
298
298
|
|
|
299
299
|
[[package]]
|
|
300
300
|
name = "memchr"
|
|
301
|
-
version = "2.8.
|
|
301
|
+
version = "2.8.3"
|
|
302
302
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
303
|
-
checksum = "
|
|
303
|
+
checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
|
|
304
304
|
|
|
305
305
|
[[package]]
|
|
306
306
|
name = "mime"
|
data/README.md
CHANGED
|
@@ -207,7 +207,7 @@ Whenever a sanitizer is in use, a literal `<` in text is emitted as `<`. That
|
|
|
207
207
|
|
|
208
208
|
## Benchmarks
|
|
209
209
|
|
|
210
|
-
When `bundle exec rake benchmark`, two different benchmarks are calculated. Here are those results on my machine.
|
|
210
|
+
The benchmark gems live in an optional Bundler group, so install them first with `bundle config set --local with benchmark && bundle install`. When `bundle exec rake benchmark`, two different benchmarks are calculated. Here are those results on my machine.
|
|
211
211
|
|
|
212
212
|
### Benchmarks for just the sanitization process
|
|
213
213
|
|
data/ext/selma/Cargo.toml
CHANGED
|
@@ -8,7 +8,7 @@ publish = false
|
|
|
8
8
|
[dependencies]
|
|
9
9
|
enum-iterator = "2.3"
|
|
10
10
|
escapist = "0.0.2"
|
|
11
|
-
magnus = { version = "0.
|
|
11
|
+
magnus = { version = "0.9", features = ["rb-sys"] }
|
|
12
12
|
rb-sys = { version = "*", default-features = false, features = [
|
|
13
13
|
"stable-api-compiled-fallback",
|
|
14
14
|
] }
|
data/ext/selma/src/tags.rs
CHANGED
|
@@ -171,12 +171,23 @@ impl Tag {
|
|
|
171
171
|
pub const TAG_COUNT: usize = 151;
|
|
172
172
|
|
|
173
173
|
/// Identifies whether this is an HTML tag whose contents
|
|
174
|
-
/// are considered "text nodes", and thus, must be removed
|
|
174
|
+
/// are considered "text nodes", and thus, must be removed.
|
|
175
|
+
///
|
|
176
|
+
/// Raw-text elements (`<noscript>`, `<xmp>`, ...) belong here: their content is
|
|
177
|
+
/// tokenized as text, so markup inside it never reaches the sanitizer. Keeping that
|
|
178
|
+
/// content after removing the wrapper would re-emit it verbatim into a context where
|
|
179
|
+
/// the browser parses it as live markup.
|
|
175
180
|
pub fn has_text_content(tag: Tag) -> bool {
|
|
176
181
|
tag.index == HTMLTag::SCRIPT as usize
|
|
177
182
|
|| tag.index == HTMLTag::STYLE as usize
|
|
178
183
|
|| tag.index == HTMLTag::MATH as usize
|
|
179
184
|
|| tag.index == HTMLTag::SVG as usize
|
|
185
|
+
|| tag.index == HTMLTag::IFRAME as usize
|
|
186
|
+
|| tag.index == HTMLTag::NOEMBED as usize
|
|
187
|
+
|| tag.index == HTMLTag::NOFRAMES as usize
|
|
188
|
+
|| tag.index == HTMLTag::NOSCRIPT as usize
|
|
189
|
+
|| tag.index == HTMLTag::PLAINTEXT as usize
|
|
190
|
+
|| tag.index == HTMLTag::XMP as usize
|
|
180
191
|
}
|
|
181
192
|
|
|
182
193
|
/// Is this tag an `<iframe>`?
|
data/lib/selma/version.rb
CHANGED