diff options
author | Rafael Mendonça França <rafael.franca@plataformatec.com.br> | 2014-08-17 22:51:13 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafael.franca@plataformatec.com.br> | 2014-08-17 22:51:13 -0300 |
commit | cdc00aba62ffb0f0af452f5152aafeb5e490962e (patch) | |
tree | 071ca4766dd07b9af34bbebf902c50a27c5c2b4d /guides/source/upgrading_ruby_on_rails.md | |
parent | cc9091c3e719facd0f73c8ab425a5bb9a7d0a65b (diff) | |
parent | c78da4d5c472f7254ed609ef753d7b1719732802 (diff) | |
download | rails-cdc00aba62ffb0f0af452f5152aafeb5e490962e.tar.gz rails-cdc00aba62ffb0f0af452f5152aafeb5e490962e.tar.bz2 rails-cdc00aba62ffb0f0af452f5152aafeb5e490962e.zip |
Merge branch 'loofah'
Conflicts:
Gemfile
Diffstat (limited to 'guides/source/upgrading_ruby_on_rails.md')
-rw-r--r-- | guides/source/upgrading_ruby_on_rails.md | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/guides/source/upgrading_ruby_on_rails.md b/guides/source/upgrading_ruby_on_rails.md index cc20782780..799d5f3bc9 100644 --- a/guides/source/upgrading_ruby_on_rails.md +++ b/guides/source/upgrading_ruby_on_rails.md @@ -91,6 +91,38 @@ after_bundle do end ``` +### Rails Html Sanitizer + +There's a new choice for sanitizing HTML fragments in your applications. The +venerable html-scanner approach is now officially being deprecated in favor of +[`Rails Html Sanitizer`](https://github.com/rails/rails-html-sanitizer). + +This means the methods `sanitize`, `sanitize_css`, `strip_tags` and +`strip_links` are backed by a new implementation. + +In the next major Rails version `Rails Html Sanitizer` will be the default +sanitizer. It already is for new applications. + +Include this in your Gemfile to try it out today: + +```ruby +gem 'rails-html-sanitizer' +``` + +This new sanitizer uses [Loofah](https://github.com/flavorjones/loofah) internally. Loofah in turn uses Nokogiri, which +wraps XML parsers written in both C and Java, so sanitization should be faster +no matter which Ruby version you run. + +The new version updates `sanitize`, so it can take a `Loofah::Scrubber` for +powerful scrubbing. +[See some examples of scrubbers here](https://github.com/flavorjones/loofah#loofahscrubber). + +Two new scrubbers have also been added: `PermitScrubber` and `TargetScrubber`. +Read the [gem's readme](https://github.com/rails/rails-html-sanitizer) for more information. + +The documentation for `PermitScrubber` and `TargetScrubber` explains how you +can gain complete control over when and how elements should be stripped. + Upgrading from Rails 4.0 to Rails 4.1 ------------------------------------- |