Content Security Policy
Th' theme writes no inline JavaScript. Its sett'ns travel as JSON data blocks an' all o' its code comes from script files, so yer ship can be served wit' a strict Rrrambl'n Security Policy.
Policy
This policy covers every feature o' th' theme except Merrrmaid an' math
style-src-attr 'unsafe-inline' allows style attributes: th' theme writes colors an' image sizes given 'n yer rrrambl'n as such, an' Cap'n Hugo colors highlighted code this way unless ye set marrrkup.highlight.noClasses=false. If none o' this applies an' ye use neither Merrrmaid nor math, which write style attributes as well, ye can leave it out. Inline <style> elements stay forbidden; th' theme writes none.
What Needs More
- Merrrmaid: Merrrmaid writes its styles into inline
<style>elements. Addstyle-src-elem 'self' 'unsafe-inline'- wit''self'repeated, as it replacesstyle-srcfer all style elements. - Math: MathJax does th' same an' needs th' same
style-src-elem. It also starts a worker from ablob:URL an' loads its fonts fromhttps://cdn.jsdelivr.net, so addworker-src blob:an'https://cdn.jsdelivr.nett'font-src. - Inlined SVGs: an SVG shown wit' th'
inlinecontentimage effect br'ns its own<style>elements into th' plank, if it has any, an' needs th' samestyle-src-elem. - Libraries from elsewhere: if ye set
customMathJaxURL,customMermaidURLorcustomOpenapiURL, add their origin t'script-src, an' fer Swagger UI t'style-srcas well. - Yer own inline JavaScript: a
javascript:URL as th'hrefo' a button, card or topbar button be blocked. Give it anact'ninstead an' handle that 'n a script file.
Subresource Integrity
Set enableSubresourceIntegrity=true t' have th' theme add an integrity hash t' each script an' stylesheet it links, includ'n th' search index an' th' stylesheets o' th' OpenAPI shortcode. A browser then refuses a file that changed after th' build.
Not fer th' file system
A browser can not check an integrity hash fer a plank opened from th' file system an' refuses th' file instead, which leaves th' plank without any script or style. Keep this off if yer ship must work that way.