feat(csp): add webmention support to content security policy

- include webmention.io in connect-src when webmention system is enabled
- ensure compatibility with webmention services by updating CSP directives
This commit is contained in:
Jeremiah Russell 2025-02-12 13:01:04 +00:00
parent 4f6b64129a
commit a663de6dac
No known key found for this signature in database
GPG key ID: E576B835ACE207E5

View file

@ -54,6 +54,12 @@ content="default-src 'self'
{%- set script_src = script_src ~ " " ~ " cdn.jsdelivr.net" -%}
{%- endif -%}
{#- Check if a webmention system is enabled to allow the necessary domains and directives -#}
{%- set webmention_enabled = config.extra.webmentions.enabled -%}
{%- if webmention_enabled -%}
{%- set connect_src = connect_src ~ " webmention.io" -%}
{%- endif -%}
{#- Append WebSocket for Zola serve mode -#}
{%- if config.mode == "serve" -%}
{%- set connect_src = connect_src ~ " ws:" -%}