-
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: base64 html images in image tag are unsafe #20536
Comments
Also when I use |
This is working as intended. It's not the base64 that is unsafe, it is the "data:" URL. If Closing. Please comment if you disagree. |
Howdy, okay, I just read this: https://html5sec.org/ , got it: if we do But shouldn't it be that Edit: may be also |
What do you think @ianlancetaylor ? |
Bump @ianlancetaylor . It seems I'm reaching your spams. |
Sorry, reopening. Offhand I don't know the answer to your question. Is there a real problem here, or is this just theoretical? CC @stjj89 |
Right, certain media MIME types (e.g. data:image/* and data:video/*) are probably safe. However, html/template's URL filter is conservative by design, and accepts only the http, https, and mailto schemes. You can get around the URL filter by passing your URL to html/template as a template.URL rather than a plain string. This tells html/template that your URL is known to be safe, and therefore does not need to be filtered. See example at https://play.golang.org/p/cSORJiFSdI. |
Ah okay thanks @stjj89 , so I guess making |
Closing since it seems there is nothing to do. |
😆 |
I think it generally pays to remain conservative about our assumptions, but we could consider this in the future if enough users are running into this issue. |
Hello there
Is there a way to print that image ? Is normal that it is unsafe ?
What did you do?
https://play.golang.org/p/dOQHc3Y-n8
What did you expect to see?
A bottle icon !
What did you see instead?
Thoughts
I also tried with
template.URLQueryEscaper
, navigator doesnt get string as an image andtemplate.HTMLEscapeString
gets me the#ZgotmplZ
System details
The text was updated successfully, but these errors were encountered: