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

use of base64 images #270

Closed
felipenmoura opened this issue Mar 12, 2014 · 17 comments
Closed

use of base64 images #270

felipenmoura opened this issue Mar 12, 2014 · 17 comments

Comments

@felipenmoura
Copy link

Markdown in issues should(must) accept images in base64.
When using the api, we might use it to upload an image from a canvas.
Also useful when we don't want to really upload the image to anywhere in the server, but the issue(for example, a printscreen).

I believe this is not a very complex feature to apply, and it would be pretty useful.

@bkeepers
Copy link
Contributor

If I understand the issue correctly, we can't currently implement this due to security restrictions. For example, a user could embed an SVG with an inline script.

/cc @mastahyeti

@felipenmoura
Copy link
Author

I see...
the thing is...to add images to issues or comments, the user must host it somewhere!
We were trying to create a tool that allowed final users to report problems...it creates an issue with the print screen of the user's screen...the idea was to simply send a base64 image...we had then to create and maintain a server/backend system, just to store the images.
Another thing could be, embed gists into issues or comments...or maybe wikis :)

@bkeepers
Copy link
Contributor

Makes sense. Hopefully we can open up the API for our image uploads that we support on issues.

Another thing could be, embed gists into issues or comments...or maybe wikis :)

See #199

@gjtorikian
Copy link
Contributor

For example, a user could embed an SVG with an inline script.

Yes and no. <object> is dangerous to open up, while <img> is not. But I think we should theoretically be able to support any base64 encoded image. We don't currently, for whatever reason.

Here's an entry on Wikipedia for a base64 encoded red dot:

<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot" />

And here it is rendered:

Red dot

Not sure if camo or something else is interfering.

@btoews
Copy link

btoews commented May 29, 2014

@bkeepers I can't think of anything wrong with allowing the data scheme in our sanitization. SVG gives me the jeebies because it's so damned flexible/powerful. The browsers seem to be doing a good job of disabling functionality like scripting, lints, etc when SVG are rendered in image tags though.

One thing to be careful about with allowing data URIs though is that we always wrap image tags in links to the image src. I don't think we want to be linking to data URIs, so that should be stripped out.

@gjtorikian The reason why your image doesn't render is that you have the src set to http://data:image/png;base64.... In data URIs data: is the scheme, so you don't do http://.

/cc @ptoomey3 @gregose @josh Am I missing anything with allowing data URIs for images?

@ptoomey3
Copy link
Member

Yeah, so long as we restrict stuff to img tags I think we should be ok.

@gjtorikian
Copy link
Contributor

In data URIs data: is the scheme, so you don't do http://

I am copy-pasting the same <img src="data:image/png;... into comments and Markdown files, and the src attribute seems to just get slurped away.

@josh
Copy link
Contributor

josh commented May 29, 2014

Probably okay to image tags. I'm just worried about long term.

@josh
Copy link
Contributor

josh commented May 29, 2014

What happens if a data: img goes out in an email? Do most clients handle it correctly?

@catesandrew
Copy link

+1 for base64 images in markdown

@wdalrymple
Copy link

damn. i was hoping that this existed already.

@catesandrew
Copy link

@josh, according to this, looks like only apple mail displays data images. but i don't think that should be a reason for or against adding the feature.

@felipenmoura
Copy link
Author

The only thing about base:64 that makes me worried, is the length of issues and logs, once it might get bigger(specially if it is a screenshot or something like this).

@bkeepers
Copy link
Contributor

bkeepers commented Mar 4, 2015

Thanks for requesting this feature. A commit to this library can't add support for it, so I'm going to close this issue.

I'm guessing it will require a change to the SanitizationFilter in jch/html-pipeline, so you might want to try making a pull request there.

@F1LT3R
Copy link

F1LT3R commented Apr 27, 2018

Any chance we can support Base64 Encoded woff fonts in SVG?

subnode added a commit to subnode/LoungeDesktop that referenced this issue Sep 14, 2018
It seems GitHub does not support data: URI for images in markdown.
c.f. github/markup#270
@aparedero
Copy link

Year 2018 (Nearly 2019) and this feature is neither working nor implemented.

@kivikakk
Copy link
Contributor

👋 Please reach out to our support team with your feature request — this repository is just for issues for the github-markup gem, which doesn't have anything to do with whether we allow such embedded images. That's what @bkeepers meant when he said:

Thanks for requesting this feature. A commit to this library can't add support for it, so I'm going to close this issue.

If a commit to this repo can't fix it, the issue doesn't belong here. The support team keeps track of feature requests and how many people are asking for them. Thanks!

@github github locked as off-topic and limited conversation to collaborators Nov 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests