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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6d6f1afa8f121b7bd01339489da71e5772d243a2
4
- data.tar.gz: 3f7ff018d2079f1e09d92922f7fbbfbd18908508
3
+ metadata.gz: 0de608f734dd970b1714ac2d6e922cc481ad682b
4
+ data.tar.gz: 71d5809c45563d3a9d570d65ea3db5b0b280fb6d
5
5
  SHA512:
6
- metadata.gz: d65dcca2b41249b2fa4a100731393d732de9ff62925bcf681a3b2cbd5498f8db3b913a6c9ce09c0952f5719370b2e610abe88442f365c8b15b456d234466e452
7
- data.tar.gz: c4a1b21ccd375a212c1be12212c23963f7075e5b22f10a8ff470c040123f90b82c69ac8ea87041e7cc5de35b8e70fced35f7fd2d453cb37cdfe96ad8ebadc747
6
+ metadata.gz: 77d1633dd6754c952e333102c6f0f765180c762229966fb5fb44997062e0b48d87fb7dfc7562f8edd0df29ca9a6eca17182eb6a861e9d66629c541ffd8bc4dfd
7
+ data.tar.gz: fe3f6534221bce529ad63d9f5375fcf51e3a660a33ada62dddc3244b4964e04e2c14b2b495d1c7060e273897e307f8f095a71dc02df65a8b35ff1340f96f82df
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 1.0.1
2
+
3
+ * Added support for Rails 4.2.0.beta2 and above
4
+
1
5
  ## 1.0.0
2
6
 
3
7
  * First release.
@@ -26,12 +26,47 @@ end
26
26
  module ActionView
27
27
  module Helpers
28
28
  module SanitizeHelper
29
- if method_defined?(:sanitizer_vendor) || private_method_defined?(:sanitizer_vendor)
30
- undef_method(:sanitizer_vendor)
31
- end
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
- def sanitizer_vendor
34
- Rails::Html::Sanitizer
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
@@ -1,7 +1,7 @@
1
1
  module Rails
2
2
  module Html
3
3
  class Sanitizer
4
- VERSION = "1.0.0"
4
+ VERSION = "1.0.1"
5
5
  end
6
6
  end
7
7
  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.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-08-19 00:00:00.000000000 Z
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.3.0
121
+ rubygems_version: 2.2.1
122
122
  signing_key:
123
123
  specification_version: 4
124
- summary: This gem is resposible to sanitize HTML fragments in Rails applications.
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: