This site is the archived OWASP Foundation Wiki and is no longer accepting Account Requests.
To view the new OWASP Foundation website, please visit https://owasp.org

CRV2 RevCodeStoredAntiPatternRuby

From OWASP
Revision as of 20:28, 3 May 2014 by Johanna Curiel (talk | contribs) (Created page with "=Ruby On Rails Stored Anti-pattern= Ruby on rails, version 3.0 has an in built function to validate input, especially any attempt to submit XSS code, however, if the develope...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Ruby On Rails Stored Anti-pattern

Ruby on rails, version 3.0 has an in built function to validate input, especially any attempt to submit XSS code, however, if the developer decides to bypass this validation mechanism, by passing variables to the front end with tags intact, the developer will change the .erb file (ruby markup)with the following (similar) code.

  <%= raw @product.name %>   
  <%= @product.name.html_safe %>  These are examples of how NOT to do it!
  <%= content_tag @product.name %>

Unfortunately, any field that uses raw like this will be a potential XSS target

Reference

https://www.owasp.org/index.php/Ruby_on_Rails_Cheatsheet