Content Security Policy
The theme writes no inline JavaScript. Its settings travel as JSON data blocks and all of its code comes from script files, so your site can be served with a strict Content Security Policy.
Policy
This policy covers every feature of the theme except Mermaid
style-src-attr 'unsafe-inline' allows style attributes: the theme writes colors and image sizes given in your content as such, and Hugo colors highlighted code this way unless you set markup.highlight.noClasses=false. If none of this applies, you use no Mermaid and your math output is mathml, you can leave it out: Mermaid and the other math outputs write style attributes as well. Inline <style> elements stay forbidden; the theme writes none.
What Needs More
- Mermaid: Mermaid writes its styles into inline
<style>elements. Addstyle-src-elem 'self' 'unsafe-inline'- with'self'repeated, as it replacesstyle-srcfor all style elements. - Inlined SVGs: an SVG shown with the
inlinecontentimage effect brings its own<style>elements into the page, if it has any, and needs the samestyle-src-elem. - Libraries from elsewhere: if you set
customMermaidURLorcustomOpenapiURL, add their origin toscript-src, and for Swagger UI tostyle-srcas well. - Your own inline JavaScript: a
javascript:URL as thehrefof a button, card or topbar button is blocked. Give it anactioninstead and handle that in a script file.
Subresource Integrity
Set enableSubresourceIntegrity=true to have the theme add an integrity hash to each script and stylesheet it links, including the search index and the stylesheets of the OpenAPI shortcode. A browser then refuses a file that changed after the build.
Not for the file system
A browser can not check an integrity hash for a page opened from the file system and refuses the file instead, which leaves the page without any script or style. Keep this off if your site must work that way.