canvas-lms/gems/canvas_sanitize
Brad Humphrey 60e60a8688 add allowfullscreen tags to the rce
test plan:
- add add a video in an iframe in the rich content editor
- it should be able to become full screen

fixes PLAT-647

Change-Id: I05ad81fdebc32353af9746605e9847947e614582
Reviewed-on: https://gerrit.instructure.com/41728
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Nathan Mills <nathanm@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: Brad Humphrey <brad@instructure.com>
2014-09-26 15:20:45 +00:00
..
lib add allowfullscreen tags to the rce 2014-09-26 15:20:45 +00:00
Gemfile spec: canvas rspec rake task for vendored_gems 2014-02-24 05:47:34 +00:00
README.md convert sanitize field plugin into proper gem: CanvasSanitize 2014-01-28 22:36:18 +00:00
Rakefile convert sanitize field plugin into proper gem: CanvasSanitize 2014-01-28 22:36:18 +00:00
canvas_sanitize.gemspec align rspec version in gems with parent 2014-08-12 22:27:39 +00:00

README.md

SanitizeField

We want to be able to mix model fields with Sanitize configuration and implement a sanitization in a before_save callback.

An alternative to this plugin might be using a Rails whitelist. This isn't developed, but is an idea on http://wonko.com/post/sanitize

Rails::Initializer.run do |config| config.action_view.white_list_sanitizer = Sanitizer.new config.action_view.sanitized_allowed_tags = table, tr, td config.action_view.sanitized_allowed_attributes = id, class, style end

Our approach is finer-grained, and should work better for now at least. There is also talk about an alternative 1.9/nokogiri approach to the Sanitizer gem for more optimal performance. Keeping our eyes open about these issues.

Example

class BasicExample < ActiveRecord::Base sanitize :body, Sanitize::Config::RELAXED end

class Whatever < ActiveRecord::Base sanitize :body, :title, :elements => ['a', 'span'], :attributes => {'a' => ['href', 'title'], 'span' => ['class']}, :protocols => {'a' => {'href' => ['http', 'https', 'mailto']}} end

License

Copyright (C) 2011 Instructure, Inc.

This file is part of Canvas.

Canvas is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, version 3 of the License.

Canvas is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see http://www.gnu.org/licenses/.