Skip to content

Add CSPHeaderEvent, CSP hash-reporting sources and Hash block tags#4

Open
aubes wants to merge 2 commits into
mainfrom
feature/2.1.0
Open

Add CSPHeaderEvent, CSP hash-reporting sources and Hash block tags#4
aubes wants to merge 2 commits into
mainfrom
feature/2.1.0

Conversation

@aubes
Copy link
Copy Markdown
Owner

@aubes aubes commented May 7, 2026

  • CSPHeaderEvent: dispatched on every response after active groups are resolved and before headers are rendered. Listeners can mutate the active CSPPolicy instances to apply cross-cutting changes.
  • CSP Level 3 hash-reporting sources: 'report-sha256', 'report-sha384', 'report-sha512' added to the CSPSource enum. Use them in script-src / style-src to ask browsers to include the SHA hash of the blocked resource in violation reports (useful for iterating a strict-dynamic policy).
  • Hash block tags: {% csp_script_hash %}...{% end_csp_script_hash %} and {% csp_style_hash %}...{% end_csp_style_hash %} capture the inline content, compute its sha256 hash, and add it to the corresponding directive. No nonce attribute on the rendered tag, so the page stays cache-friendly. See docs/twig.md#hash-block-tags.

@aubes aubes force-pushed the feature/2.1.0 branch from d1a7839 to bcfe6a2 Compare May 7, 2026 07:24
@aubes aubes force-pushed the feature/2.1.0 branch from bcfe6a2 to a1e09f7 Compare May 7, 2026 07:28
@aubes aubes added enhancement New feature or request documentation Improvements or additions to documentation labels May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant