-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
html/template: suggest to add HTMLEscape for / to / #14033
Comments
refer to owasp 2.2 RULE #1
|
If you're really worried about someone sneaking a closing tag through without |
@mikesamuel do you think it is worth doing, though? |
I'm trying to get enough credentials with my OWASP login to get the blame for that file so I can ask the author about their reasoning, but given what I know now, I wouldn't. There's no harm in doing so except file size. I can imagine inputs that have many URL attributes might blow up but not in general. I did a quick char count on some benchmark HTML files. > cat /tmp/benchmark.html | perl -pe 's/<\/|[^\/]//g' | wc -c If that file is representative then replacing with To test post-gzip I did ~ [16:10:39]> gzip -c /tmp/benchmark.html | wc -c
45283
~ [16:10:53]> cat /tmp/benchmark.html | perl -pe 's/(?<![<])\//9/g' | gzip -c | wc -c
45866 which looks like a 1.3% size increase or 1.1% with |
Actually I just noticed the rule in OWASP, and submit this suggestion to add escape for |
I traded emails with Jeff Williams. He made that list by going over an HTML grammar and enumerating meta-characters and included |
In that case, let's leave the |
Is it possible to enrich the html Escape by adding
/ --> /
conversion?code:
text/template/funcs.go - HTMLEscape()
currently there are
" ' & < >
totally 5 characters escapedThe text was updated successfully, but these errors were encountered: