acts_as_sanitiled 1.1.2 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ 1.1.3 (2011-02-10)
2
+ * Remove explicit Nokogiri dependency
3
+ * Update requirement to allow Sanitize 2.0--the future is now
4
+ * Update requirement to allow a wider range of RedCloth
5
+ * Fix spec for Sanitize 2.0.0 / Nokogiri 1.4.4 which gives the output I want
6
+
1
7
  1.1.2 (2010-05-07)
2
8
  * Make reload method more compatible (eg. with globalize2)
3
9
 
@@ -9,4 +15,4 @@
9
15
  * Add default_sanitize_options and default_textile_options class variables.
10
16
 
11
17
  1.0.0 (2009-10-14)
12
- * Initial butchering of defunkt's work.
18
+ * Initial butchering of defunkt's work.
data/README.rdoc CHANGED
@@ -2,37 +2,27 @@
2
2
 
3
3
  This plugin, based on Chris Wanstrath's venerable acts_as_textiled, extends the automatic textiling functionality to sanitization as well using as its basis Ryan Grove's powerful yet simple Sanitize gem.
4
4
 
5
- The reasoning behind this approach is simple. Filtering input before it is saved to the database (as xss_terminate and many other popular plugins do) often fails to preserve user intent. On the other hand, filtering output at the template level is error prone, and you are begging to get pwned. Short of some sort of taint mode (which Rails 3 will have!), I believe the method employed by acts_as_textiled is the next best thing: you get safe output by default, but input is never corrupted.
5
+ *Important Development Status Update* There used to be a paragraph here about why I liked this approach, but I've come to disagree with it over time. First, generally because the Rails 3 / rails_xss approach of tainted strings is ultimately better than the bandaid that this provided. But specifically because the cleverness of the solution outweighs its usefulness. It's a lot of hacking around internals simply to avoid calling a helper in a view, which while easy to forget, does not usually appear in all that many places or change all that often. Meanwhile, the internals of the model carry significantly more complexity, and suffer irredeemable breakages when you introduce something like I18n with Globalize2. Aside from that, any gains that were made are erased the minute you need to emit something other than HTML. With that in mind, I am still maintaining acts_as_sanitiled to the extent I need it, but I am no longer sanctioning the approach, and I would recommend deprecating your usage of the plugin.
6
6
 
7
7
  == Requirements
8
8
 
9
+ The officially sanctioned requirements are:
10
+
9
11
  * Sanitize >1.1.0 (prior versions had a whitespace issue)
10
- * Nokogiri >1.3.3
11
- * RedCloth (for Textile support)
12
- * ActiveRecord (tested on 2.3.4)
12
+ * RedCloth >4.1.0
13
+ * ActiveRecord (tested on 2.3.10)
13
14
 
14
- == Installation
15
+ However there are a lot of little aberrations in output when you start mixing and matching versions of the various moving parts. Most recently I am working with REE 1.8.7, Sanitize 2.0.0, RedCloth 4.2.5, and Nokogiri 1.4.4, and I make sure specs pass with that mix. With other versions things should still work but the output might be slightly different (see known issues)
15
16
 
16
- acts_as_sanitiled is distributed via Gemcutter. If you are enlightened you can simply do:
17
+ == Installation
17
18
 
18
19
  gem install acts_as_sanitiled
19
20
 
20
- If you haven't checkout out Gemcutter yet:
21
-
22
- gem install --source http://gemcutter.org acts_as_sanitiled
23
-
24
- Then in your Rails environment.rb:
25
-
26
- config.gem 'acts_as_sanitiled'
27
-
28
21
  == Known Issues
29
22
 
30
- The tests are passing for me with Sanitize 1.1.0 and Nokogiri 1.4.0 under my native ruby install of 1.8.6. However under 1.8.7 (using rvm) I get a whitespace error in the sanitized html, which results in paragraphs and line breaks not having line breaks, and thus screws up the output of attribute(:plain). I haven't been able to figure out what the problem is yet, but if you see a test failure on:
31
-
32
- ./spec/sanitiled_spec.rb:49: A standard textiled object - should properly textilize and strip html
33
-
34
- Let me know if you are able to help debug.
23
+ Line breaks sometime disappear from output which breaks the :plain output. This issue was not present under 1.8.6, Sanitize 1.1.0 and Nokogiri 1.4.0, but when I switched to 1.8.7 it appears. I never tracked down the cause, so keep an eye out for this one.
35
24
 
25
+ XHTML vs HTML output. This changed when I upgraded to Sanitize 2.0.0 and Nokogiri 1.4.4. This must have become the default somewhere, which is fine with me since HTML 5 is the future. Specs upgraded accordingly.
36
26
 
37
27
  == Changes from acts_as_textiled
38
28
 
@@ -166,4 +156,4 @@ won't need to do this.
166
156
  Enjoy.
167
157
 
168
158
  * By Chris Wanstrath [ chris[at]ozmm[dot]org ]
169
- * Butchered and Sanitized by Gabe da Silveira [ gabe[at]websaviour[dot]com ]
159
+ * Butchered and Sanitized by Gabe da Silveira [ gabe[at]websaviour[dot]com ]
data/Rakefile CHANGED
@@ -11,9 +11,8 @@ begin
11
11
  gem.homepage = "http://github.com/dasil003/acts_as_sanitiled"
12
12
  gem.authors = ["Gabe da Silveira"]
13
13
 
14
- gem.add_dependency('nokogiri', '~> 1.3.3')
15
- gem.add_dependency('sanitize', '~> 1.1.0')
16
- gem.add_dependency('RedCloth')
14
+ gem.add_dependency('sanitize', '>= 1.1.0', '< 3.0.0')
15
+ gem.add_dependency('RedCloth', '>= 4.1.0', '< 4.2.6')
17
16
 
18
17
  gem.add_development_dependency "bacon"
19
18
  gem.add_development_dependency "activesupport"
@@ -59,4 +58,4 @@ Rake::RDocTask.new do |rdoc|
59
58
  rdoc.title = "acts_as_sanitiled #{version}"
60
59
  rdoc.rdoc_files.include('README*')
61
60
  rdoc.rdoc_files.include('lib/**/*.rb')
62
- end
61
+ end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.2
1
+ 1.1.3
@@ -1,65 +1,59 @@
1
1
  # Generated by jeweler
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{acts_as_sanitiled}
8
- s.version = "1.1.2"
8
+ s.version = "1.1.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Gabe da Silveira"]
12
- s.date = %q{2010-05-07}
12
+ s.date = %q{2011-02-10}
13
13
  s.description = %q{A modernized version of Chris Wansthrath's venerable acts_as_textiled. It automatically textiles and then sanitizes columns to your specification. Ryan Grove's excellent Sanitize gem with nokogiri provides the backend for speedy and robust filtering of your output in order to: restrict Textile to a subset of HTML, guarantee well-formedness, and of course prevent XSS.}
14
14
  s.email = %q{gabe@websaviour.com}
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE",
17
- "README.rdoc"
17
+ "README.rdoc"
18
18
  ]
19
19
  s.files = [
20
- ".gitignore",
21
- "CHANGELOG",
22
- "LICENSE",
23
- "README.rdoc",
24
- "Rakefile",
25
- "VERSION",
26
- "acts_as_sanitiled.gemspec",
27
- "lib/acts_as_sanitiled.rb",
28
- "rails/init.rb",
29
- "spec/sanitiled_spec.rb",
30
- "spec/spec_helper.rb"
20
+ "CHANGELOG",
21
+ "LICENSE",
22
+ "README.rdoc",
23
+ "Rakefile",
24
+ "VERSION",
25
+ "acts_as_sanitiled.gemspec",
26
+ "lib/acts_as_sanitiled.rb",
27
+ "rails/init.rb",
28
+ "spec/sanitiled_spec.rb",
29
+ "spec/spec_helper.rb"
31
30
  ]
32
31
  s.homepage = %q{http://github.com/dasil003/acts_as_sanitiled}
33
- s.rdoc_options = ["--charset=UTF-8"]
34
32
  s.require_paths = ["lib"]
35
- s.rubygems_version = %q{1.3.6}
33
+ s.rubygems_version = %q{1.4.2}
36
34
  s.summary = %q{Automatically textiles and/or sanitizes ActiveRecord columns}
37
35
  s.test_files = [
38
36
  "spec/sanitiled_spec.rb",
39
- "spec/spec_helper.rb"
37
+ "spec/spec_helper.rb"
40
38
  ]
41
39
 
42
40
  if s.respond_to? :specification_version then
43
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
44
41
  s.specification_version = 3
45
42
 
46
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
47
- s.add_runtime_dependency(%q<nokogiri>, ["~> 1.3.3"])
48
- s.add_runtime_dependency(%q<sanitize>, ["~> 1.1.0"])
49
- s.add_runtime_dependency(%q<RedCloth>, [">= 0"])
43
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
44
+ s.add_runtime_dependency(%q<sanitize>, [">= 1.1.0", "< 3.0.0"])
45
+ s.add_runtime_dependency(%q<RedCloth>, [">= 4.1.0", "< 4.2.6"])
50
46
  s.add_development_dependency(%q<bacon>, [">= 0"])
51
47
  s.add_development_dependency(%q<activesupport>, [">= 0"])
52
48
  else
53
- s.add_dependency(%q<nokogiri>, ["~> 1.3.3"])
54
- s.add_dependency(%q<sanitize>, ["~> 1.1.0"])
55
- s.add_dependency(%q<RedCloth>, [">= 0"])
49
+ s.add_dependency(%q<sanitize>, [">= 1.1.0", "< 3.0.0"])
50
+ s.add_dependency(%q<RedCloth>, [">= 4.1.0", "< 4.2.6"])
56
51
  s.add_dependency(%q<bacon>, [">= 0"])
57
52
  s.add_dependency(%q<activesupport>, [">= 0"])
58
53
  end
59
54
  else
60
- s.add_dependency(%q<nokogiri>, ["~> 1.3.3"])
61
- s.add_dependency(%q<sanitize>, ["~> 1.1.0"])
62
- s.add_dependency(%q<RedCloth>, [">= 0"])
55
+ s.add_dependency(%q<sanitize>, [">= 1.1.0", "< 3.0.0"])
56
+ s.add_dependency(%q<RedCloth>, [">= 4.1.0", "< 4.2.6"])
63
57
  s.add_dependency(%q<bacon>, [">= 0"])
64
58
  s.add_dependency(%q<activesupport>, [">= 0"])
65
59
  end
@@ -37,7 +37,7 @@ EOF
37
37
  @desc_html = '_why announces <i>Sandbox</i>'
38
38
  @desc_plain = '_why announces Sandbox'
39
39
 
40
- @body_html = "<p>First line<br />\nSecond line with <strong>bold</strong></p>\n<p>Second paragraph with special char\342\204\242, <a>XSS attribute</a>,<br />\nscript&gt;script tag, and <b>unclosed tag.</b></p>"
40
+ @body_html = "<p>First line<br>\nSecond line with <strong>bold</strong></p>\n<p>Second paragraph with special char\342\204\242, <a>XSS attribute</a>,<br>\nscript&gt;script tag, and <b>unclosed tag.</b></p>"
41
41
  @body_plain = "First line\nSecond line with bold\n\nSecond paragraph with special char™, XSS attribute,\nscript>script tag, and unclosed tag."
42
42
  end
43
43
 
@@ -116,4 +116,4 @@ describe 'Defining fields on an ActiveRecord object' do
116
116
  end
117
117
  end.should.raise
118
118
  end
119
- end
119
+ end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_sanitiled
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
4
+ hash: 21
5
+ prerelease:
5
6
  segments:
6
7
  - 1
7
8
  - 1
8
- - 2
9
- version: 1.1.2
9
+ - 3
10
+ version: 1.1.3
10
11
  platform: ruby
11
12
  authors:
12
13
  - Gabe da Silveira
@@ -14,73 +15,85 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-05-07 00:00:00 -07:00
18
+ date: 2011-02-10 00:00:00 -08:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
- name: nokogiri
22
+ name: sanitize
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
24
26
  requirements:
25
- - - ~>
27
+ - - ">="
26
28
  - !ruby/object:Gem::Version
29
+ hash: 19
27
30
  segments:
28
31
  - 1
32
+ - 1
33
+ - 0
34
+ version: 1.1.0
35
+ - - <
36
+ - !ruby/object:Gem::Version
37
+ hash: 7
38
+ segments:
29
39
  - 3
30
- - 3
31
- version: 1.3.3
40
+ - 0
41
+ - 0
42
+ version: 3.0.0
32
43
  type: :runtime
33
44
  version_requirements: *id001
34
45
  - !ruby/object:Gem::Dependency
35
- name: sanitize
46
+ name: RedCloth
36
47
  prerelease: false
37
48
  requirement: &id002 !ruby/object:Gem::Requirement
49
+ none: false
38
50
  requirements:
39
- - - ~>
51
+ - - ">="
40
52
  - !ruby/object:Gem::Version
53
+ hash: 59
41
54
  segments:
42
- - 1
55
+ - 4
43
56
  - 1
44
57
  - 0
45
- version: 1.1.0
46
- type: :runtime
47
- version_requirements: *id002
48
- - !ruby/object:Gem::Dependency
49
- name: RedCloth
50
- prerelease: false
51
- requirement: &id003 !ruby/object:Gem::Requirement
52
- requirements:
53
- - - ">="
58
+ version: 4.1.0
59
+ - - <
54
60
  - !ruby/object:Gem::Version
61
+ hash: 59
55
62
  segments:
56
- - 0
57
- version: "0"
63
+ - 4
64
+ - 2
65
+ - 6
66
+ version: 4.2.6
58
67
  type: :runtime
59
- version_requirements: *id003
68
+ version_requirements: *id002
60
69
  - !ruby/object:Gem::Dependency
61
70
  name: bacon
62
71
  prerelease: false
63
- requirement: &id004 !ruby/object:Gem::Requirement
72
+ requirement: &id003 !ruby/object:Gem::Requirement
73
+ none: false
64
74
  requirements:
65
75
  - - ">="
66
76
  - !ruby/object:Gem::Version
77
+ hash: 3
67
78
  segments:
68
79
  - 0
69
80
  version: "0"
70
81
  type: :development
71
- version_requirements: *id004
82
+ version_requirements: *id003
72
83
  - !ruby/object:Gem::Dependency
73
84
  name: activesupport
74
85
  prerelease: false
75
- requirement: &id005 !ruby/object:Gem::Requirement
86
+ requirement: &id004 !ruby/object:Gem::Requirement
87
+ none: false
76
88
  requirements:
77
89
  - - ">="
78
90
  - !ruby/object:Gem::Version
91
+ hash: 3
79
92
  segments:
80
93
  - 0
81
94
  version: "0"
82
95
  type: :development
83
- version_requirements: *id005
96
+ version_requirements: *id004
84
97
  description: "A modernized version of Chris Wansthrath's venerable acts_as_textiled. It automatically textiles and then sanitizes columns to your specification. Ryan Grove's excellent Sanitize gem with nokogiri provides the backend for speedy and robust filtering of your output in order to: restrict Textile to a subset of HTML, guarantee well-formedness, and of course prevent XSS."
85
98
  email: gabe@websaviour.com
86
99
  executables: []
@@ -91,7 +104,6 @@ extra_rdoc_files:
91
104
  - LICENSE
92
105
  - README.rdoc
93
106
  files:
94
- - .gitignore
95
107
  - CHANGELOG
96
108
  - LICENSE
97
109
  - README.rdoc
@@ -107,28 +119,32 @@ homepage: http://github.com/dasil003/acts_as_sanitiled
107
119
  licenses: []
108
120
 
109
121
  post_install_message:
110
- rdoc_options:
111
- - --charset=UTF-8
122
+ rdoc_options: []
123
+
112
124
  require_paths:
113
125
  - lib
114
126
  required_ruby_version: !ruby/object:Gem::Requirement
127
+ none: false
115
128
  requirements:
116
129
  - - ">="
117
130
  - !ruby/object:Gem::Version
131
+ hash: 3
118
132
  segments:
119
133
  - 0
120
134
  version: "0"
121
135
  required_rubygems_version: !ruby/object:Gem::Requirement
136
+ none: false
122
137
  requirements:
123
138
  - - ">="
124
139
  - !ruby/object:Gem::Version
140
+ hash: 3
125
141
  segments:
126
142
  - 0
127
143
  version: "0"
128
144
  requirements: []
129
145
 
130
146
  rubyforge_project:
131
- rubygems_version: 1.3.6
147
+ rubygems_version: 1.4.2
132
148
  signing_key:
133
149
  specification_version: 3
134
150
  summary: Automatically textiles and/or sanitizes ActiveRecord columns
data/.gitignore DELETED
@@ -1,2 +0,0 @@
1
- coverage
2
- pkg