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

security issue? #2

Open
enjalot opened this issue Nov 20, 2015 · 1 comment
Open

security issue? #2

enjalot opened this issue Nov 20, 2015 · 1 comment

Comments

@enjalot
Copy link

enjalot commented Nov 20, 2015

I tried to run it on the github issue comments (i.e. this page) and it gave me the following error:

Refused to load the script 'https://nthitz.github.io/d3fx/index.js' because it violates the following Content Security Policy directive: "script-src assets-cdn.github.com".

the same on twitter. Is this a thing only some sites add?

@nthitz
Copy link
Owner

nthitz commented Nov 20, 2015

ah yes indeed. Sites can specify a "Content Security Policy" which has a directive that whitelists domains that <script>s are allowed to have as a src. Any bookmarklet that creates <script> tags would fail on sites that specify that header. Github, Twitter, Facebook all do :(. Google doesn't ¯_(ツ)_/¯

You'll notice that the javascript that creates the <script> still executes so the "inline" JS in the bookmarklet still runs. So you could presumably include all of d3 and d3fx within a bookmarklet (w/o external scripts) and have things work. Not sure if Chrome extensions have the same restrictions, but if they are adding <script>s with unwhitelisted src attributes they probably do.

http://www.html5rocks.com/en/tutorials/security/content-security-policy/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants