✨ feat: allow customizable secure headers (CSP)
parent
a8540ab499
commit
d7caa7af5f
@ -1,20 +0,0 @@
|
||||
+++
|
||||
title = "Lorem Ipsum"
|
||||
date = "2022-06-30"
|
||||
[taxonomies]
|
||||
tags = ["test"]
|
||||
+++
|
||||
|
||||
# Heading 1
|
||||
Who is Lauren Ipsum? Fun grid ac labels Sed sed, rhoncus nocode pixel perfect property accessibility custom code university nam lens flares exploring shades of consequat fluid science and magic In rogue pixels. Cms scelerisque editor bibendum neque et Semper grid quantum field quis visually tempor.
|
||||
|
||||
## Heading 1.1
|
||||
Adding lens cras eget ratio Webflow generation nocode dui code screen neque responsifying cloneable frosted glass beautiful Grimur dapibus block sticky nav Est disrupt membership ecommerce augue fluid quick find responsive. Don't touch my design. Marketplace nam proofreading labels and tooltips combo. Late night coffee spill.
|
||||
|
||||
# Heading 2
|
||||
|
||||
Marketplace client-first 3D jello disrupt visual code superpowers visually alchemy wizardry cut to black. Fun contrast ratio agency accessibility sticky nav reverse-proxy. Sprinkling on some wow. Interaction freelance enterprise cms optimizing for IE6 cloneable making it pop logic div block McGuire Instagrimur.
|
||||
|
||||
Designer adding lens flares symbols responsive images. Sprinkling on some wow. Proofreading labels and tooltips fluid frosted glass Webp neumorphic button the magical div block interaction SEO cms grid library superpowers accessible client-first DevLink generation nocode alt tag combo class. To set.
|
||||
|
||||
Exploring shades of gray responsive images 3D university attributes designer nocode the magical div block. Don't touch my design. Pixel perfect component frosted glass. Cat-herding rogue pixels. Making it pop wizardry Webp generation nocode combo class reverse-proxy fun create component adding lens.
|
@ -0,0 +1,24 @@
|
||||
+++
|
||||
title = "Secure by default"
|
||||
date = "2023-02-22"
|
||||
[taxonomies]
|
||||
tags = ["security", "showcase"]
|
||||
+++
|
||||
|
||||
The default configuration of the theme gets an A+ score on [Mozilla Observatory](https://observatory.mozilla.org).
|
||||
|
||||
This is accomplished by programatically configuring Content Security Policy (CSP) headers based on a user-defined list of allowed domains in the theme's config.toml file. Here's the default and recommended setup (you could remove the last lines if you don't want to embed videos):
|
||||
|
||||
```
|
||||
[extra]
|
||||
allowed_domains = [
|
||||
{ directive = "img-src", domains = ["'self'", "https://*"] },
|
||||
{ directive = "script-src", domains = ["'self'"] },
|
||||
{ directive = "style-src", domains = ["'self'"] },
|
||||
{ directive = "frame-src", domains = ["player.vimeo.com", "https://www.youtube-nocookie.com"] },
|
||||
]
|
||||
```
|
||||
|
||||
The allowed_domains list specifies the URLs that the website should be able to connect to, and each domain in the list is associated with a CSP directive such as `frame-src`, `connect-src`, or `script-src`. The `templates/partials/header.html` file dynamically generates the CSP header based on this list.
|
||||
|
||||
This feature allows you to easily customize their website's security headers to allow for specific use cases, such as embedding YouTube videos, loading remote fonts ([not recommended](https://www.albertovarela.net/blog/2022/11/stop-using-google-fonts/)) or scripts.
|
Loading…
Reference in New Issue