5 ms·
So, how do I manage a website where I allow users to embed arbitrary URLs as image, so I don’t even know which protocol they’ll use, but where I want HTTPS for
by kuschku 10y ago
So, how do I manage a website where I allow users to embed arbitrary URLs as image, so I don’t even know which protocol they’ll use, but where I want HTTPS for the page itself?
Will I just have to deal with the yellow "mixed content! insecure!" warning? Will I have to proxy requests?
There’s many forums like that in the web.
- hughes 10y agoYou can try adding `upgrade-insecure-requests`[1] to your page [1] https://developers.google.com/web/fundamentals/security/prevent-mixed-content/fixing-mixed-content https://developers.google.com/web/fundamentals/security/prev...
- tantalor 10y agoWho cares about warnings? Do your users browse with devtools open? At worst the users see the grey "i" in circle icon: https://googlesamples.github.io/web-fundamentals/fundamentals/security/prevent-mixed-content/passive-mixed-content.html https://googlesamples.github.io/web-fundamentals/fundamental...
- bjacobel 10y agoA single HTTP request in an otherwise HTTPS page can compromise the privacy and integrity of a user's connection. SSL/TLS isn't just about checking all the boxes so Chrome will give you the prettier icon, there are real stakes for users.
- andrewmunsell 10y agoTo expand on this-- Imagine you have a website with a payment form on an HTTPS page, but you embed some external analytics script over HTTP. If your visitor's request is MITMed (e.g. they're in a coffee shop or some other insecure WiFi access point, etc), then an attacker can modify the script (that's over HTTP) to send these credit card details to the attacker's server. Once there's a single HTTP resource on the page, HTTPS means a whole lot less, hence the scary warnings.
- baybal2 10y ago>Once there's a single HTTP resource on the page, HTTPS means a whole lot less, hence the scary warnings. More like if there is a single line of 3rd party code.
- kuschku 10y agoNo, they see a yellow warning icon instead of the green https, and in some browsers the https is even red, and strikethrough. That's quite concerning as far as warning signs go. And I don't want to have to compromise the users safety by switching entirely back to HTTP, which would just give no warning.
- TheCoreh 10y agoYou could (and in fact probably should) do what GitHub does. Fetch the images, store a copy and serve them yourself. That way even if the external URLs stop working, the images on your forum/site will remain functional.
- no_protocol 10y agoThis is scary to me so I haven't tried it yet. If I'm allowing users to upload arbitrary files, I might have to deal with things like copyright laws. It doesn't sound fun. Does anyone have relevant information for such a site in the United States?
- ldjb 10y agoI'm not a lawyer (nor even American) but I believe the most relevant legislation would be the Digital Millennium Copyright Act. In which case, it might be a good idea to formulate a policy similar to the one linked to in the footer of this very website.
- catmanjan 10y agoIt's not a trivial problem, I'd be more worried about users uploading illegal content maliciously. Would definitely require a moderation team depending on the site size...
- vbezhenar 10y agoAFAIK hosting a link could be copyright violation too. All bittorrent sites host links, not real content, yet they are sued and closed.
- rogerdpack 10y agoIn the short term, as long as you don't have any password/CC prompts, you can continue using HTTP. In the long term you'd have to "hope" the whole web transitions to https and just rewrite the url's to https, or cache them locally or proxy serve them locally. HTH.
- MrQuincle 10y agoSounds like a perfect CDN opportunity. This doesn't exist yet? Something like: https://user.imagecdn.io/website/image https://user.imagecdn.io/website/image