✨ feat: allow disabling CSP, following the hierarchy
Introduces new option `enable_csp`, true by default. Can be set on a page, section or globally.
This commit is contained in:
parent
8537bbc10e
commit
5e0cbdd67d
@ -263,6 +263,10 @@ allowed_domains = [
|
|||||||
{ directive = "frame-src", domains = ["player.vimeo.com", "https://www.youtube-nocookie.com"] },
|
{ directive = "frame-src", domains = ["player.vimeo.com", "https://www.youtube-nocookie.com"] },
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# Enable the CSP directives configured (or default).
|
||||||
|
# Can be set at page or section levels, following the hierarchy: page > section > config. See: https://welpo.github.io/tabi/blog/mastering-tabi-settings/#settings-hierarchy
|
||||||
|
enable_csp = true
|
||||||
|
|
||||||
# Custom subset of characters for the header.
|
# Custom subset of characters for the header.
|
||||||
# If set to true, the `static/custom_subset.css` file will be loaded first.
|
# If set to true, the `static/custom_subset.css` file will be loaded first.
|
||||||
# This avoids a flashing text issue in Firefox.
|
# This avoids a flashing text issue in Firefox.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
+++
|
+++
|
||||||
title = "Domina la configuració de tabi: guia completa"
|
title = "Domina la configuració de tabi: guia completa"
|
||||||
date = 2023-09-18
|
date = 2023-09-18
|
||||||
updated = 2024-02-15
|
updated = 2024-03-15
|
||||||
description = "Descobreix les múltiples maneres en què pots personalitzar tabi."
|
description = "Descobreix les múltiples maneres en què pots personalitzar tabi."
|
||||||
|
|
||||||
[taxonomies]
|
[taxonomies]
|
||||||
@ -749,6 +749,8 @@ allowed_domains = [
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Aquesta opció està habilitada per defecte. Per desactivar-la per una pàgina, secció o globalment, estableix `enable_csp = false`. La configuració de `enable_csp` segueix la jerarquia.
|
||||||
|
|
||||||
Per a més informació, consulta la [pàgina de documentació de CSP](/ca/blog/security/).
|
Per a més informació, consulta la [pàgina de documentació de CSP](/ca/blog/security/).
|
||||||
|
|
||||||
---
|
---
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
+++
|
+++
|
||||||
title = "Domina la configuración de tabi: guía completa"
|
title = "Domina la configuración de tabi: guía completa"
|
||||||
date = 2023-09-18
|
date = 2023-09-18
|
||||||
updated = 2024-01-07
|
updated = 2024-03-15
|
||||||
description = "Descubre las múltiples maneras en que puedes personalizar tabi."
|
description = "Descubre las múltiples maneras en que puedes personalizar tabi."
|
||||||
|
|
||||||
[taxonomies]
|
[taxonomies]
|
||||||
@ -749,6 +749,8 @@ allowed_domains = [
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Esta función está habilitada por defecto. Para deshabilitarla (y permitir todo), configura `enable_csp = false` en una página, sección o globalmente. La opción `enable_csp` sigue [la jerarquía](#jerarquia-de-configuracion).
|
||||||
|
|
||||||
Para obtener más información, consulta la [página de documentación de CSP](/es/blog/security/).
|
Para obtener más información, consulta la [página de documentación de CSP](/es/blog/security/).
|
||||||
|
|
||||||
---
|
---
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
+++
|
+++
|
||||||
title = "Mastering tabi Settings: A Comprehensive Guide"
|
title = "Mastering tabi Settings: A Comprehensive Guide"
|
||||||
date = 2023-09-18
|
date = 2023-09-18
|
||||||
updated = 2024-01-07
|
updated = 2024-03-15
|
||||||
description = "Discover the many ways you can customise your tabi site."
|
description = "Discover the many ways you can customise your tabi site."
|
||||||
|
|
||||||
[taxonomies]
|
[taxonomies]
|
||||||
@ -754,6 +754,8 @@ allowed_domains = [
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
This feature is enabled by default. To disable it (and allow all connections), set `enable_csp = false` on a page, section or globally. The `enable_csp` setting follows the [hierarchy](#settings-hierarchy).
|
||||||
|
|
||||||
See the [CSP documentation page](/blog/security/) for more information.
|
See the [CSP documentation page](/blog/security/) for more information.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
+++
|
+++
|
||||||
title = "Seguretat per defecte"
|
title = "Seguretat per defecte"
|
||||||
date = 2023-02-22
|
date = 2023-02-22
|
||||||
updated = 2023-09-29
|
updated = 2024-03-15
|
||||||
description = "tabi té una Política de Seguretat de Contingut (CSP) fàcilment personalitzable amb valors segurs per defecte. Obtingues tranquil·litat i un A+ en l'Observatori de Mozilla."
|
description = "tabi té una Política de Seguretat de Contingut (CSP) fàcilment personalitzable amb valors segurs per defecte. Obtingues tranquil·litat i un A+ en l'Observatori de Mozilla."
|
||||||
|
|
||||||
[taxonomies]
|
[taxonomies]
|
||||||
@ -30,6 +30,8 @@ La llista `allowed_domains` especifica les URLs a les quals el lloc web hauria d
|
|||||||
|
|
||||||
Aquesta funcionalitat permet personalitzar fàcilment les capçaleres de seguretat del lloc web per permetre casos d'ús específics, com ara inserir vídeos de YouTube, carregar scripts o tipografies remotes ([no recomanat](https://www.albertovarela.net/blog/2022/11/stop-using-google-fonts/)).
|
Aquesta funcionalitat permet personalitzar fàcilment les capçaleres de seguretat del lloc web per permetre casos d'ús específics, com ara inserir vídeos de YouTube, carregar scripts o tipografies remotes ([no recomanat](https://www.albertovarela.net/blog/2022/11/stop-using-google-fonts/)).
|
||||||
|
|
||||||
|
Pots desactivar les capçaleres (permitint-ho tot) en una pàgina, secció, o globalment configurant `enable_csp = false` en el front matter o en el fitxer `config.toml`.
|
||||||
|
|
||||||
**Nota**: [habilitar els comentaris](@/blog/comments/index.ca.md) o [les analítiques](@/blog/mastering-tabi-settings/index.ca.md#analisi-web) automàticament permet scripts/frames/estils/connexions en funció del servei habilitat.
|
**Nota**: [habilitar els comentaris](@/blog/comments/index.ca.md) o [les analítiques](@/blog/mastering-tabi-settings/index.ca.md#analisi-web) automàticament permet scripts/frames/estils/connexions en funció del servei habilitat.
|
||||||
|
|
||||||
[^1]: Requereix una configuració adequada del servidor web (p. ex., redirigir el trànsit HTTP a HTTPS).
|
[^1]: Requereix una configuració adequada del servidor web (p. ex., redirigir el trànsit HTTP a HTTPS).
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
+++
|
+++
|
||||||
title = "Seguro por defecto"
|
title = "Seguro por defecto"
|
||||||
date = 2023-02-22
|
date = 2023-02-22
|
||||||
updated = 2023-09-29
|
updated = 2024-03-15
|
||||||
description = "tabi tiene una Política de Seguridad de Contenido (CSP) fácilmente personalizable con configuraciones seguras. Obtén tranquilidad y una calificación de A+ en Mozilla Observatory."
|
description = "tabi tiene una Política de Seguridad de Contenido (CSP) fácilmente personalizable con configuraciones seguras. Obtén tranquilidad y una calificación de A+ en Mozilla Observatory."
|
||||||
|
|
||||||
[taxonomies]
|
[taxonomies]
|
||||||
@ -30,6 +30,8 @@ La lista `allowed_domains` especifica las URL a las que el sitio web debería po
|
|||||||
|
|
||||||
Esta función permite personalizar fácilmente las cabeceras de seguridad del sitio web para permitir casos de uso específicos, como la incrustación de videos de YouTube, la carga de scripts o fuentes remotas ([no recomendado](https://www.albertovarela.net/blog/2022/11/stop-using-google-fonts/)).
|
Esta función permite personalizar fácilmente las cabeceras de seguridad del sitio web para permitir casos de uso específicos, como la incrustación de videos de YouTube, la carga de scripts o fuentes remotas ([no recomendado](https://www.albertovarela.net/blog/2022/11/stop-using-google-fonts/)).
|
||||||
|
|
||||||
|
Puedes desactivar las cabeceras (permitiendo todo) en una página, sección, o globalmente configurando `enable_csp = false` en el front matter o en el archivo `config.toml`.
|
||||||
|
|
||||||
**Nota**: [habilitar los comentarios](@/blog/comments/index.es.md) o [las analíticas](@/blog/mastering-tabi-settings/index.es.md#analisis-web) automáticamente permite scripts/frames/estilos/conexiones en función del servicio habilitado.
|
**Nota**: [habilitar los comentarios](@/blog/comments/index.es.md) o [las analíticas](@/blog/mastering-tabi-settings/index.es.md#analisis-web) automáticamente permite scripts/frames/estilos/conexiones en función del servicio habilitado.
|
||||||
|
|
||||||
[^1]: Requiere una configuración adecuada del servidor web (por ejemplo, redirigir el tráfico HTTP a HTTPS).
|
[^1]: Requiere una configuración adecuada del servidor web (por ejemplo, redirigir el tráfico HTTP a HTTPS).
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
+++
|
+++
|
||||||
title = "Secure by default"
|
title = "Secure by default"
|
||||||
date = 2023-02-22
|
date = 2023-02-22
|
||||||
updated = 2023-09-29
|
updated = 2024-03-15
|
||||||
description = "tabi has an easily customizable Content Security Policy (CSP) with safe defaults. Get peace of mind and an A+ on Mozilla Observatory."
|
description = "tabi has an easily customizable Content Security Policy (CSP) with safe defaults. Get peace of mind and an A+ on Mozilla Observatory."
|
||||||
|
|
||||||
[taxonomies]
|
[taxonomies]
|
||||||
@ -30,6 +30,8 @@ The `allowed_domains` list specifies the URLs that the website should be able to
|
|||||||
|
|
||||||
This feature allows you to easily customize the website's security headers to allow for specific use cases, such as embedding YouTube videos, loading scripts or remote fonts ([not recommended](https://www.albertovarela.net/blog/2022/11/stop-using-google-fonts/)).
|
This feature allows you to easily customize the website's security headers to allow for specific use cases, such as embedding YouTube videos, loading scripts or remote fonts ([not recommended](https://www.albertovarela.net/blog/2022/11/stop-using-google-fonts/)).
|
||||||
|
|
||||||
|
You can disable the CSP (allowing all connections) on a page, section, or globally by setting `enable_csp = false` in the front matter or `config.toml` file.
|
||||||
|
|
||||||
**Note**: [enabling comments](@/blog/comments/index.md) or [analytics](@/blog/mastering-tabi-settings/index.md#analytics) automatically allows scripts/frames/styles/connections as needed from the respective services.
|
**Note**: [enabling comments](@/blog/comments/index.md) or [analytics](@/blog/mastering-tabi-settings/index.md#analytics) automatically allows scripts/frames/styles/connections as needed from the respective services.
|
||||||
|
|
||||||
[^1]: Requires proper webserver configuration (e.g. redirecting HTTP traffic to HTTPS).
|
[^1]: Requires proper webserver configuration (e.g. redirecting HTTP traffic to HTTPS).
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
"show_previous_next_article_links",
|
"show_previous_next_article_links",
|
||||||
"invert_previous_next_article_links",
|
"invert_previous_next_article_links",
|
||||||
"previous_next_article_links_full_width",
|
"previous_next_article_links_full_width",
|
||||||
|
"enable_csp",
|
||||||
] %}
|
] %}
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
|
@ -143,7 +143,9 @@
|
|||||||
|
|
||||||
<meta property="og:site_name" content="{{ config.title }}">
|
<meta property="og:site_name" content="{{ config.title }}">
|
||||||
|
|
||||||
{%- include "partials/content_security_policy.html" -%}
|
{%- if macros_settings::evaluate_setting_priority(setting="enable_csp", page=page | default(value=""), section=section | default(value=""), default_global_value="true") == "true" -%}
|
||||||
|
{%- include "partials/content_security_policy.html" -%}
|
||||||
|
{%- endif -%}
|
||||||
|
|
||||||
{%- if config.extra.theme_switcher and config.extra.theme_switcher == true -%}
|
{%- if config.extra.theme_switcher and config.extra.theme_switcher == true -%}
|
||||||
{# If JavaScript is disabled, hide the button. #}
|
{# If JavaScript is disabled, hide the button. #}
|
||||||
|
@ -218,6 +218,10 @@ allowed_domains = [
|
|||||||
{ directive = "frame-src", domains = ["player.vimeo.com", "https://www.youtube-nocookie.com"] },
|
{ directive = "frame-src", domains = ["player.vimeo.com", "https://www.youtube-nocookie.com"] },
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# Enable the CSP directives configured (or default).
|
||||||
|
# Can be set at page or section levels, following the hierarchy: page > section > config. See: https://welpo.github.io/tabi/blog/mastering-tabi-settings/#settings-hierarchy
|
||||||
|
enable_csp = true
|
||||||
|
|
||||||
# Custom subset of characters for the header.
|
# Custom subset of characters for the header.
|
||||||
# If set to true, the `static/custom_subset.css` file will be loaded first.
|
# If set to true, the `static/custom_subset.css` file will be loaded first.
|
||||||
# This avoids a flashing text issue in Firefox.
|
# This avoids a flashing text issue in Firefox.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user