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

Missing forward slash escape value in hamlcoffee.js.coffee.erb #75

Closed
mrchess opened this issue Nov 1, 2012 · 4 comments
Closed

Missing forward slash escape value in hamlcoffee.js.coffee.erb #75

mrchess opened this issue Nov 1, 2012 · 4 comments

Comments

@mrchess
Copy link
Collaborator

mrchess commented Nov 1, 2012

I noticed in vendor/assets/javascripts/hamlcoffee.js.coffee.erb

That there is no escape of forward slash. OWASP suggests you escape it per https://www.owasp.org/index.php/XSS_(Cross_Site_Scripting)_Prevention_Cheat_Sheet (see RULE#1).

Is there a reason for this omission? If not, should it be added?

@netzpirat
Copy link
Collaborator

Wow, thanks for the link. The reason for the omission is that I didn't know about it, duh! It would be great to have it added.

netzpirat added a commit that referenced this issue Nov 2, 2012
Also the forward slash in escaped in the helper modules (Fixes #75)
@mrchess
Copy link
Collaborator Author

mrchess commented Nov 4, 2012

Nice!

@molily
Copy link

molily commented Feb 20, 2013

I don’t get why this is necessary. HAML doesn’t escape the slash either.

From the https://www.owasp.org/index.php/XSS_(Cross_Site_Scripting)_Prevention_Cheat_Sheet#RULE_.231_-_HTML_Escape_Before_Inserting_Untrusted_Data_into_HTML_Element_Content

forward slash is included as it helps end an HTML entity

Well, that’s right, but a space for example also ends a broken HTML entity reference. “&quot ” works in most browsers, the same goes for numerical character references. So why isn’t space escaped?

@netzpirat
Copy link
Collaborator

Agree, the quote

forward slash is included as it helps end an HTML entity

is nonsense and the OWASP minimal encoding rules lists only < and & when escaping for HTML. Escaping / is only needed when the value is used within a script and the XSS Filter Evasion Cheat Sheet lists some examples.

Just tested Backbone and it also escapes the forward slash:

> new Backbone.Model({ test: 'hello/' }).escape('test')
"hello&#x2F;"

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

3 participants