govspeak 6.5.1 → 6.5.2
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 -0
- data/lib/govspeak/version.rb +1 -1
- data/lib/kramdown/parser/govuk.rb +2 -2
- data/test/html_sanitizer_test.rb +9 -0
- metadata +17 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eaa4aea2a5ad557426d34d0d17ef75ae5d538862cc293ad6d6403a663797667f
|
4
|
+
data.tar.gz: 3950f3fdd4bc77f5b00ceb5bede0ffca988f2c910739ee0906fa49431be95ae0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90a7401f005a80646a8390723c04b4e2754d39b42559189d70aab1c1214223b62e805f6cb640b4c1acc3dd37401fe059849884af56f533295fa4b24af760f7f8
|
7
|
+
data.tar.gz: 18f85c38c237de6fc51b62b15c69b7bf236e0957c218e8ee246ba7fd572102231b129f6728461b5b9e57f2884107a0c419327e8ce522e8c70fe38fd3c4b1f066
|
data/CHANGELOG.md
CHANGED
@@ -55,6 +55,7 @@ class Govspeak::HtmlSanitizer
|
|
55
55
|
attributes: {
|
56
56
|
:all => Sanitize::Config::RELAXED[:attributes][:all] + %w[role aria-label],
|
57
57
|
"a" => Sanitize::Config::RELAXED[:attributes]["a"] + [:data],
|
58
|
+
"div" => [:data],
|
58
59
|
"th" => Sanitize::Config::RELAXED[:attributes]["th"] + %w[style],
|
59
60
|
"td" => Sanitize::Config::RELAXED[:attributes]["td"] + %w[style],
|
60
61
|
"govspeak-embed-attachment" => %w[content-id],
|
data/lib/govspeak/version.rb
CHANGED
@@ -35,11 +35,11 @@ module Kramdown
|
|
35
35
|
unless host.nil? || @document_domains.compact.include?(host)
|
36
36
|
element.attr["rel"] = "external"
|
37
37
|
end
|
38
|
-
# rubocop:disable Lint/
|
38
|
+
# rubocop:disable Lint/SuppressedException
|
39
39
|
rescue Addressable::URI::InvalidURIError
|
40
40
|
# it's safe to ignore these very *specific* exceptions
|
41
41
|
end
|
42
|
-
# rubocop:enable Lint/
|
42
|
+
# rubocop:enable Lint/SuppressedException
|
43
43
|
end
|
44
44
|
super
|
45
45
|
end
|
data/test/html_sanitizer_test.rb
CHANGED
@@ -44,6 +44,15 @@ class HtmlSanitizerTest < Minitest::Test
|
|
44
44
|
)
|
45
45
|
end
|
46
46
|
|
47
|
+
test "allow data attributes on divs" do
|
48
|
+
html = "<div data-module='toggle' data-ecommerce-path='/' data-track-category='someDiv'>Test Div</div>"
|
49
|
+
|
50
|
+
assert_equal(
|
51
|
+
"<div data-module=\"toggle\" data-ecommerce-path=\"/\" data-track-category=\"someDiv\">Test Div</div>",
|
52
|
+
Govspeak::HtmlSanitizer.new(html).sanitize,
|
53
|
+
)
|
54
|
+
end
|
55
|
+
|
47
56
|
test "allows images on whitelisted domains" do
|
48
57
|
html = "<img src='http://allowed.com/image.jgp'>"
|
49
58
|
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.5.
|
4
|
+
version: 6.5.2
|
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-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionview
|
@@ -210,14 +210,14 @@ dependencies:
|
|
210
210
|
requirements:
|
211
211
|
- - "~>"
|
212
212
|
- !ruby/object:Gem::Version
|
213
|
-
version: '
|
213
|
+
version: '2'
|
214
214
|
type: :development
|
215
215
|
prerelease: false
|
216
216
|
version_requirements: !ruby/object:Gem::Requirement
|
217
217
|
requirements:
|
218
218
|
- - "~>"
|
219
219
|
- !ruby/object:Gem::Version
|
220
|
-
version: '
|
220
|
+
version: '2'
|
221
221
|
- !ruby/object:Gem::Dependency
|
222
222
|
name: simplecov
|
223
223
|
requirement: !ruby/object:Gem::Requirement
|
@@ -365,23 +365,23 @@ signing_key:
|
|
365
365
|
specification_version: 4
|
366
366
|
summary: Markup language for single domain
|
367
367
|
test_files:
|
368
|
-
- test/
|
369
|
-
- test/
|
370
|
-
- test/
|
371
|
-
- test/
|
368
|
+
- test/govspeak_link_extractor_test.rb
|
369
|
+
- test/govspeak_structured_headers_test.rb
|
370
|
+
- test/govspeak_images_bang_test.rb
|
371
|
+
- test/govspeak_button_test.rb
|
372
372
|
- test/govspeak_table_with_headers_test.rb
|
373
|
+
- test/govspeak_extract_contact_content_ids_test.rb
|
374
|
+
- test/blockquote_extra_quote_remover_test.rb
|
375
|
+
- test/govspeak_test_helper.rb
|
373
376
|
- test/govspeak_link_test.rb
|
374
|
-
- test/
|
375
|
-
- test/
|
377
|
+
- test/govspeak_images_test.rb
|
378
|
+
- test/govspeak_attachment_link_test.rb
|
376
379
|
- test/govspeak_contacts_test.rb
|
377
380
|
- test/test_helper.rb
|
381
|
+
- test/html_validator_test.rb
|
382
|
+
- test/html_sanitizer_test.rb
|
383
|
+
- test/govspeak_attachments_inline_test.rb
|
378
384
|
- test/govspeak_test.rb
|
385
|
+
- test/govspeak_attachment_test.rb
|
379
386
|
- test/govspeak_attachments_image_test.rb
|
380
|
-
- test/html_validator_test.rb
|
381
|
-
- test/govspeak_structured_headers_test.rb
|
382
|
-
- test/govspeak_extract_contact_content_ids_test.rb
|
383
|
-
- test/blockquote_extra_quote_remover_test.rb
|
384
387
|
- test/presenters/h_card_presenter_test.rb
|
385
|
-
- test/govspeak_button_test.rb
|
386
|
-
- test/govspeak_test_helper.rb
|
387
|
-
- test/html_sanitizer_test.rb
|