govspeak 6.4.0 → 6.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/govspeak/html_sanitizer.rb +1 -9
- data/lib/govspeak/version.rb +1 -1
- data/test/html_sanitizer_test.rb +9 -0
- metadata +16 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 691092344fa56f8643bda4f29f8f0a18344515254b042fb15771375489395015
|
4
|
+
data.tar.gz: 529021924ad18fccfabda572204e59b33867578e548816ab093e2d51b30e059f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a870b551730a2a07f5a85bdb06df18b56018f3a700d21469d8c1804fe51d044ae7beb5455a8d1e332f44e003ed2d6231eb9f36fd72b0578de19cc408973074f0
|
7
|
+
data.tar.gz: d0b4ca4cf824216c139094d33fdd1a9ddf98800db9aa94b077b454cfce35e98713b1b6e850c63817242f5cc3e381aaa9633062d1b01c3a7450ec6a64876632ee
|
data/CHANGELOG.md
CHANGED
@@ -48,21 +48,13 @@ class Govspeak::HtmlSanitizer
|
|
48
48
|
Sanitize.clean(@dirty_html, Sanitize::Config.merge(sanitize_config, transformers: transformers))
|
49
49
|
end
|
50
50
|
|
51
|
-
def button_sanitize_config
|
52
|
-
%w[
|
53
|
-
data-module
|
54
|
-
data-tracking-code
|
55
|
-
data-tracking-name
|
56
|
-
]
|
57
|
-
end
|
58
|
-
|
59
51
|
def sanitize_config
|
60
52
|
Sanitize::Config.merge(
|
61
53
|
Sanitize::Config::RELAXED,
|
62
54
|
elements: Sanitize::Config::RELAXED[:elements] + %w[govspeak-embed-attachment govspeak-embed-attachment-link],
|
63
55
|
attributes: {
|
64
56
|
:all => Sanitize::Config::RELAXED[:attributes][:all] + %w[role aria-label],
|
65
|
-
"a" => Sanitize::Config::RELAXED[:attributes]["a"] +
|
57
|
+
"a" => Sanitize::Config::RELAXED[:attributes]["a"] + [:data],
|
66
58
|
"th" => Sanitize::Config::RELAXED[:attributes]["th"] + %w[style],
|
67
59
|
"td" => Sanitize::Config::RELAXED[:attributes]["td"] + %w[style],
|
68
60
|
"govspeak-embed-attachment" => %w[content-id],
|
data/lib/govspeak/version.rb
CHANGED
data/test/html_sanitizer_test.rb
CHANGED
@@ -35,6 +35,15 @@ class HtmlSanitizerTest < Minitest::Test
|
|
35
35
|
)
|
36
36
|
end
|
37
37
|
|
38
|
+
test "allow data attributes on links" do
|
39
|
+
html = "<a href='/' data-module='track-click' data-ecommerce-path='/' data-track-category='linkClicked'>Test Link</a>"
|
40
|
+
|
41
|
+
assert_equal(
|
42
|
+
"<a href=\"/\" data-module=\"track-click\" data-ecommerce-path=\"/\" data-track-category=\"linkClicked\">Test Link</a>",
|
43
|
+
Govspeak::HtmlSanitizer.new(html).sanitize
|
44
|
+
)
|
45
|
+
end
|
46
|
+
|
38
47
|
test "allows images on whitelisted domains" do
|
39
48
|
html = "<img src='http://allowed.com/image.jgp'>"
|
40
49
|
sanitized_html = Govspeak::HtmlSanitizer.new(html, allowed_image_hosts: ['allowed.com']).sanitize
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: govspeak
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.
|
4
|
+
version: 6.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GOV.UK Dev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionview
|
@@ -359,23 +359,23 @@ signing_key:
|
|
359
359
|
specification_version: 4
|
360
360
|
summary: Markup language for single domain
|
361
361
|
test_files:
|
362
|
-
- test/govspeak_attachments_inline_test.rb
|
363
|
-
- test/govspeak_attachment_test.rb
|
364
362
|
- test/govspeak_attachment_link_test.rb
|
365
|
-
- test/govspeak_images_test.rb
|
366
|
-
- test/govspeak_table_with_headers_test.rb
|
367
|
-
- test/govspeak_link_test.rb
|
368
|
-
- test/govspeak_images_bang_test.rb
|
369
|
-
- test/govspeak_link_extractor_test.rb
|
370
|
-
- test/govspeak_contacts_test.rb
|
371
363
|
- test/test_helper.rb
|
364
|
+
- test/govspeak_button_test.rb
|
372
365
|
- test/govspeak_test.rb
|
373
|
-
- test/govspeak_attachments_image_test.rb
|
374
366
|
- test/html_validator_test.rb
|
375
|
-
- test/
|
376
|
-
- test/
|
377
|
-
- test/blockquote_extra_quote_remover_test.rb
|
378
|
-
- test/presenters/h_card_presenter_test.rb
|
379
|
-
- test/govspeak_button_test.rb
|
367
|
+
- test/govspeak_attachment_test.rb
|
368
|
+
- test/govspeak_contacts_test.rb
|
380
369
|
- test/govspeak_test_helper.rb
|
370
|
+
- test/blockquote_extra_quote_remover_test.rb
|
371
|
+
- test/govspeak_table_with_headers_test.rb
|
372
|
+
- test/govspeak_attachments_image_test.rb
|
381
373
|
- test/html_sanitizer_test.rb
|
374
|
+
- test/govspeak_link_test.rb
|
375
|
+
- test/govspeak_extract_contact_content_ids_test.rb
|
376
|
+
- test/govspeak_structured_headers_test.rb
|
377
|
+
- test/govspeak_images_test.rb
|
378
|
+
- test/presenters/h_card_presenter_test.rb
|
379
|
+
- test/govspeak_images_bang_test.rb
|
380
|
+
- test/govspeak_link_extractor_test.rb
|
381
|
+
- test/govspeak_attachments_inline_test.rb
|