Skip to content

Stop using data: URIs for icons and other graphics #24678

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

Closed
lol768 opened this issue Nov 5, 2017 · 1 comment
Closed

Stop using data: URIs for icons and other graphics #24678

lol768 opened this issue Nov 5, 2017 · 1 comment
Labels

Comments

@lol768
Copy link

lol768 commented Nov 5, 2017

PR #20329 introduced a data:image/svg+xml background:

https://github.com/patrickhlauke/bootstrap/blob/d125860464d2a47f957193440097b502acf95832/scss/_navbar.scss#L107-L114

This requires whitelisting data: as an content security policy img-src. The MDN guide says this about the data: source:

Allows data: URIs to be used as a content source. This is insecure; an attacker can also inject arbitrary data: URIs. Use this sparingly and definitely not for scripts.

Whilst this doesn't present an immediate XSS risk as far as I know, it's less than ideal that using Bootstrap effectively forces you to whitelist this source if you want e.g. the responsive navbar to work.

This would be better implemented as a separate image file, which would have the added benefit of being cached even if the cached CSS was invalidated. With most clients supporting HTTP/2.0 there's not going to be a need to open a new TCP connection.


For local projects, I've 'fixed' this by overriding the background-image property and referencing an actual svg file.

@XhmikosR
Copy link
Member

XhmikosR commented Nov 6, 2017

I doubt we'll change this. I totally understand your point of view, but the extra file is a lot more troublesome than some of the users having to whitelist this.

@XhmikosR XhmikosR closed this as completed Nov 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants