rails-html-sanitizer 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rails-html-sanitizer might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/rails-html-sanitizer.rb +40 -5
- data/lib/rails/html/sanitizer/version.rb +1 -1
- metadata +4 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0de608f734dd970b1714ac2d6e922cc481ad682b
|
4
|
+
data.tar.gz: 71d5809c45563d3a9d570d65ea3db5b0b280fb6d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77d1633dd6754c952e333102c6f0f765180c762229966fb5fb44997062e0b48d87fb7dfc7562f8edd0df29ca9a6eca17182eb6a861e9d66629c541ffd8bc4dfd
|
7
|
+
data.tar.gz: fe3f6534221bce529ad63d9f5375fcf51e3a660a33ada62dddc3244b4964e04e2c14b2b495d1c7060e273897e307f8f095a71dc02df65a8b35ff1340f96f82df
|
data/CHANGELOG.md
CHANGED
data/lib/rails-html-sanitizer.rb
CHANGED
@@ -26,12 +26,47 @@ end
|
|
26
26
|
module ActionView
|
27
27
|
module Helpers
|
28
28
|
module SanitizeHelper
|
29
|
-
|
30
|
-
|
31
|
-
|
29
|
+
module ClassMethods
|
30
|
+
# Replaces the allowed tags for the +sanitize+ helper.
|
31
|
+
#
|
32
|
+
# class Application < Rails::Application
|
33
|
+
# config.action_view.sanitized_allowed_tags = 'table', 'tr', 'td'
|
34
|
+
# end
|
35
|
+
#
|
36
|
+
def sanitized_allowed_tags=(tags)
|
37
|
+
sanitizer_vendor.white_list_sanitizer.allowed_tags = tags
|
38
|
+
end
|
39
|
+
|
40
|
+
# Replaces the allowed HTML attributes for the +sanitize+ helper.
|
41
|
+
#
|
42
|
+
# class Application < Rails::Application
|
43
|
+
# config.action_view.sanitized_allowed_attributes = ['onclick', 'longdesc']
|
44
|
+
# end
|
45
|
+
#
|
46
|
+
def sanitized_allowed_attributes=(attributes)
|
47
|
+
sanitizer_vendor.white_list_sanitizer.allowed_attributes = attributes
|
48
|
+
end
|
49
|
+
|
50
|
+
[:protocol_separator,
|
51
|
+
:uri_attributes,
|
52
|
+
:bad_tags,
|
53
|
+
:allowed_css_properties,
|
54
|
+
:allowed_css_keywords,
|
55
|
+
:shorthand_css_properties,
|
56
|
+
:allowed_protocols].each do |meth|
|
57
|
+
meth_name = "sanitized_#{meth}"
|
58
|
+
|
59
|
+
define_method(meth_name) { deprecate_option(meth_name) }
|
60
|
+
define_method("#{meth_name}=") { |_| deprecate_option("#{meth_name}=") }
|
61
|
+
end
|
32
62
|
|
33
|
-
|
34
|
-
|
63
|
+
private
|
64
|
+
def deprecate_option(name)
|
65
|
+
ActiveSupport::Deprecation.warn "The #{name} option is deprecated " \
|
66
|
+
"and has no effect. Until Rails 5 the old behavior can still be " \
|
67
|
+
"installed. To do this add the `rails-deprecated-sanitizer` to " \
|
68
|
+
"your Gemfile. Consult the Rails 4.2 upgrade guide for more information."
|
69
|
+
end
|
35
70
|
end
|
36
71
|
end
|
37
72
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-html-sanitizer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rafael Mendonça França
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-09-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: loofah
|
@@ -118,11 +118,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
118
|
version: '0'
|
119
119
|
requirements: []
|
120
120
|
rubyforge_project:
|
121
|
-
rubygems_version: 2.
|
121
|
+
rubygems_version: 2.2.1
|
122
122
|
signing_key:
|
123
123
|
specification_version: 4
|
124
|
-
summary: This gem is
|
124
|
+
summary: This gem is responsible to sanitize HTML fragments in Rails applications.
|
125
125
|
test_files:
|
126
126
|
- test/sanitizer_test.rb
|
127
127
|
- test/scrubbers_test.rb
|
128
|
-
has_rdoc:
|