I maintain a small website for a non-profit organization. Multiple .pdfs are available for viewing on the website.
I’ve come across an issue with .pdf display in the current version of Safari (v. 16.4) (under macOS Ventura) and have also now seen it in other WebKit browsers such as DuckDuckGo and Orion.
When the website CSP contains “style-src 'self’;” a link to open a .pdf (stored in the website’s directory) results in the height of the .pdf to be severely truncated to just 154 pixels.
The developer console reports "Refused to apply a stylesheet because its hash, its nonce, or 'unsafe-inline' does not appear in the style-src directive od the Content Security Policy."
Changing the CSP to include “style-src 'self' 'unsafe-inline’;” results in the .pdf being displayed as expected.
Safari 15.6.1 under macOS Catalina, Firefox and Google Chrome all display the .pdf as expected without the addition of 'unsafe-inline’ to style-src.
Is this a WebKit bug or a purposeful change in the implementation of in-browser .pdf display?
I’m aware of the security concerns of using 'unsafe-inline’ in style-src as noted in CSP style-src: 'unsafe-inline' - is it worth it?
What alternative is available to circumvent this .pdf display issue that I’ve noted (assuming it’s not a bug that will be fixed)?