rails xss plugin

Plugin details

A plugin for rails 2.3 apps which switches the default to escape by default

Websitehttp://github.com/NZKoz/rails_xss Repositorygit://github.com/NZKoz/rails_xss.git Author Michael Koziarski Tags EdgeRails, XSS LicenseUnknown

Documentation

Install the plugin:
ruby script/plugin install git://github.com/NZKoz/rails_xss.git

his plugin replaces the default ERB template handlers with erubis, and switches the behaviour to escape by default rather than requiring you to escape. This is consistent with the behaviour in Rails 3.0.

Strings now have a notion of "html safe", which is false by default. Whenever rails copies a string into the response body it checks whether or not the string is safe, safe strings are copied verbatim into the response body, but unsafe strings are escaped first.

All the XSS-proof helpers like link_to and form_tag now return safe strings, and will continue to work unmodified. If you have your own helpers which return strings you know are safe, you will need to explicitly tell rails that they're safe. For an example, take the following helper.

def some_helper
  (1..5).map do |i|
    "#{i}"
  end.join("\n")
end



Further Documentation

There is currently no advanced documentation for this plugin.

New documentation

Edit plugin | (0 older versions) | Last edited by: Guest, 9 months ago