-
-
Notifications
You must be signed in to change notification settings - Fork 487
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
Add troubleshooting documentation for: Cannot display report in Jenkins due to sandboxed iframe #168
Comments
Hi, and thanks for opening an issue! You have a valid use case, although one that I don't myself have that much experience on. Do you, or anyone else reading, have ideas on how we could make this plugin work with a strict Content-Security Policy? We generate the chart script inline here: webpack-bundle-analyzer/views/script.ejs Lines 2 to 5 in 2d5f4fc
We don't have any special CSP attributes for the script tag, and maybe we should have? The other part where we add a webpack-bundle-analyzer/views/viewer.ejs Lines 13 to 16 in 2d5f4fc
|
After some investigation, it appears to be an issue with Jenkins and not with Webpack Bundle Analyzer. I have created a test that replicates the issue (external to Jenkins or Webpack Bundle Analyzer). <!-- index.html -->
<html>
<body>
<iframe sandbox="" src="iframe.html" />
</body>
</html>
<!-- iframe.html -->
<html>
<body>
<script>
// Blocked script execution in 'iframe.html' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
console.log('Hello World')
</script>
</body>
</html> Jenkins permissions will not allow any script's to run. In addition, the only way to make this work is to change permissions on Jenkins. I found some instructions here: https://wiki.jenkins.io/display/JENKINS/Configuring+Content+Security+Policy#ConfiguringContentSecurityPolicy-RelaxingTheRules I was able to test this using Jenkins Script Console to temporarily set this using this command:
Cheers! |
Thanks for following up :) |
Thank you for the solution, after 3h hours of investigation you spared me :)). Have a nice day |
It would be nice if the README.md troubleshooting could be extended to cover this item |
Note from @valscion
Please help us document this issue in README.md troubleshooting section. A link to #168 (comment) would be suitable to refer people from README.md to in case they have this issue.
Issue description
When viewing the static report in Jenkins, exceptions are thrown in the console and page is visibly blank.
The report is successfully built. It cannot be viewed in Jenkins due to content security violations.
Technical info
Debug info
Used as plugin to output static report during
webpack
Console Errors:
The text was updated successfully, but these errors were encountered: