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

CSP unsafe-inline CSS violations #11576

Closed
Dreamsorcerer opened this issue Feb 8, 2020 · 2 comments · Fixed by #11570 or #11569
Closed

CSP unsafe-inline CSS violations #11576

Dreamsorcerer opened this issue Feb 8, 2020 · 2 comments · Fixed by #11570 or #11569

Comments

@Dreamsorcerer
Copy link

Separating this from issue #11036 .

I am getting unsafe-inline errors for the CSS, for example on this line of code:
https://github.com/mozilla/pdf.js/blob/master/web/ui_utils.js#L893

Looks like there are several places using code like that, which would need to be changed to fix these errors.

Refused to apply inline style because it violates the following Content Security Policy directive: "style-src ...". Either the 'unsafe-inline' keyword, a hash ('sha256-MW4Iy/yu3WipUpTMM/T6OjvUu9R6vUwutodlmYNo6qM='), or a nonce ('nonce-...') is required to enable inline execution.

@Dreamsorcerer
Copy link
Author

I'm not too familiar with the details here, but would it be possible to simply replace the setAttribute with a direct assignment to the width value?

this.bar.style.width = "calc(100% - " + scrollbarWidth + "px);";

@timvandermeij
Copy link
Contributor

It looks like the pull requests above will fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment