Skip to content

Add middleware and nonce support - #6

Merged
JeffersonBledsoe merged 15 commits into
mainfrom
csp-nonce
Jun 24, 2026
Merged

JeffersonBledsoe merged 15 commits into
mainfrom
csp-nonce

Conversation

@instification

Copy link
Copy Markdown
Member

This is a major rewrite of the addon.

Main goals:

  • Set a proper Content-Security-Policy header via middleware instead of via a meta tag
  • Add nonce support
  • Work in dev mode
  • Fix issues with icons that set style= attributes

Main downsides:

  • A number of volto files needed to be shadowed
    • helpers/Html/Html.jsx
    • components/theme/Icons
    • The server.jsx from volto will also need to be customised for the nonce to be properly set in the redux store. This could also be added as a customisation here.
  • It was developed against an older version of volto so the methodology & customisations will likely not work with the latest version of volto

Todo:

  • Tests
  • Work with latest volto

@JeffersonBledsoe

JeffersonBledsoe commented Feb 25, 2026 •

Copy link
Copy Markdown
Member

Issues noted:

  • Nonce is generated in client-side code even if it's disabled on the server, resulting in a hydration mismatch
  • Icon shadow has a ref to generate a name, but this mis-matches client and serverside

@JeffersonBledsoe
JeffersonBledsoe merged commit 1dd6280 into main Jun 24, 2026
1 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants