Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation-generated error messages get html-escaped too aggressively #7351

Closed
bensomers opened this issue Aug 14, 2012 · 1 comment
Closed

Comments

@bensomers
Copy link

Just upgraded an app from 3.0.16 to 3.0.18; have not yet gotten the chance to test for this behavior against 3.1.8 and 3.2.8. But the error messages getting automatically built by ActiveRecord are getting mangled by the better html-escaping. I don't think they're getting escaped any more than they were before, but a number of the auto-generated messages include apostrophes, which are now getting escaped. e.g.
validates_presence_of :name
produces an error that displays like:
Name can't be blank

Thoughts? I can mark the errors as #html_safe before displaying them. But I don't remember clearly if any of the other auto-generated error messages include the user input in their strings, which would make this approach insecure. And obviously, anytime a developer uses the custom error message options, they may stick user input into the message.

@rafaelfranca
Copy link
Member

They are being escaped but the browsers show they correctly. This was a security fix was you can see here: https://groups.google.com/d/topic/rubyonrails-security/kKGNeMrnmiY/discussion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants