Skip to content

website/docs: add CSP to hardening#11970

Merged
gergosimonyi merged 9 commits intomainfrom
website/docs/add-CSP-to-hardening
Nov 21, 2024
Merged

website/docs: add CSP to hardening#11970
gergosimonyi merged 9 commits intomainfrom
website/docs/add-CSP-to-hardening

Conversation

@gergosimonyi
Copy link
Collaborator

No description provided.

@gergosimonyi gergosimonyi requested a review from a team November 8, 2024 16:45
@gergosimonyi gergosimonyi requested a review from a team as a code owner November 8, 2024 16:45
@netlify
Copy link

netlify bot commented Nov 8, 2024

Deploy Preview for authentik-docs ready!

Name Link
🔨 Latest commit 8b49c90
🔍 Latest deploy log https://app.netlify.com/sites/authentik-docs/deploys/673efd8485fb430008aa689d
😎 Deploy Preview https://deploy-preview-11970--authentik-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@netlify
Copy link

netlify bot commented Nov 8, 2024

Deploy Preview for authentik-storybook ready!

Name Link
🔨 Latest commit 8b49c90
🔍 Latest deploy log https://app.netlify.com/sites/authentik-storybook/deploys/673efd847e6d2c0008b2fd42
😎 Deploy Preview https://deploy-preview-11970--authentik-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@codecov
Copy link

codecov bot commented Nov 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.67%. Comparing base (4189981) to head (8b49c90).
Report is 5 commits behind head on main.

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11970      +/-   ##
==========================================
- Coverage   92.67%   92.67%   -0.01%     
==========================================
  Files         761      761              
  Lines       37935    37935              
==========================================
- Hits        35158    35156       -2     
- Misses       2777     2779       +2     
Flag Coverage Δ
e2e 49.20% <ø> (-0.01%) ⬇️
integration 24.85% <ø> (ø)
unit 90.19% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@github-actions
Copy link
Contributor

github-actions bot commented Nov 8, 2024

authentik PR Installation instructions

Instructions for docker-compose

Add the following block to your .env file:

AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-8b49c90353c4441215641a0befbcc39ce9515e69
AUTHENTIK_OUTPOSTS__CONTAINER_IMAGE_BASE=ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s

For arm64, use these values:

AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-8b49c90353c4441215641a0befbcc39ce9515e69-arm64
AUTHENTIK_OUTPOSTS__CONTAINER_IMAGE_BASE=ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s

Afterwards, run the upgrade commands from the latest release notes.

Instructions for Kubernetes

Add the following block to your values.yml file:

authentik:
    outposts:
        container_image_base: ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s
global:
    image:
        repository: ghcr.io/goauthentik/dev-server
        tag: gh-8b49c90353c4441215641a0befbcc39ce9515e69

For arm64, use these values:

authentik:
    outposts:
        container_image_base: ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s
global:
    image:
        repository: ghcr.io/goauthentik/dev-server
        tag: gh-8b49c90353c4441215641a0befbcc39ce9515e69-arm64

Afterwards, run the upgrade commands from the latest release notes.

Copy link
Contributor

@tanberry tanberry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few editing thangs.

gergosimonyi and others added 2 commits November 9, 2024 20:46
Co-authored-by: Tana M Berry <tanamarieberry@yahoo.com>
Signed-off-by: Simonyi Gergő <28359278+gergosimonyi@users.noreply.github.com>
### Content Security Policy (CSP)

:::caution
Setting up CSP incorrectly may result in the client not loading necessary third-party code.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Setting up CSP incorrectly may result in the client not loading necessary third-party code.
Setting up CSP incorrectly might result in the client not loading necessary third-party code.


Content Security Policy (CSP) is a security standard that mitigates the risk of content injection vulnerabilities. authentik doesn't currently support CSP natively, so setting it up depends on your installation. We recommend using a [reverse proxy](../install-config/reverse-proxy.md) to set a CSP header.

authentik will require at least the following origins:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
authentik will require at least the following origins:
authentik requires at least the following origins:

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we explain more about what an origin is? Where to define it? Do we have any links about it to link to?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Offline resolution: we should use the word used by the CSP spec: "location"

Copy link
Contributor

@tanberry tanberry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought I had edited that use of "may" before, but maybe I missed this one. (We want to use "might", to imply chances, instead of "may" which implies permission. :-)

@BeryJu
Copy link
Member

BeryJu commented Nov 20, 2024

/cherry-pick version-2024.10

:::

Content Security Policy (CSP) is a security standard that mitigates the risk of content injection vulnerabilities. authentik doesn't currently support CSP natively, so setting it up depends on your installation. We recommend using a [reverse proxy](../install-config/reverse-proxy.md) to set a CSP header.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably should cross-reference #12092 so that that behaviour is also documented. People deploying a custom csp might overlook this and override those headers.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a general warning not to overwrite any existing CSP header.


```
default-src 'self';
style-src 'self' 'unsafe-inline';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might want to add comments that explain why we need unsafe-inline for styles and scripts based on the comments I had in the notes in notion

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough, added.

(A bit weird syntactically because this is a language-agnostic text block, but anyone who's implementing it will understand.)

@gergosimonyi gergosimonyi merged commit a9b3a4c into main Nov 21, 2024
@gergosimonyi gergosimonyi deleted the website/docs/add-CSP-to-hardening branch November 21, 2024 13:20
gcp-cherry-pick-bot bot pushed a commit that referenced this pull request Nov 21, 2024
* add CSP to hardening

* re-word docs

Co-authored-by: Tana M Berry <tanamarieberry@yahoo.com>
Signed-off-by: Simonyi Gergő <28359278+gergosimonyi@users.noreply.github.com>

* fix typo

* use the correct term "location" instead of "origin" in CSP docs

* reword docs

* add comments to permissive CSP directives

* add warning about overwriting existing CSP headers

---------

Signed-off-by: Simonyi Gergő <28359278+gergosimonyi@users.noreply.github.com>
Co-authored-by: Tana M Berry <tanamarieberry@yahoo.com>
gergosimonyi added a commit that referenced this pull request Nov 21, 2024
website/docs: add CSP to hardening (#11970)

* add CSP to hardening

* re-word docs




* fix typo

* use the correct term "location" instead of "origin" in CSP docs

* reword docs

* add comments to permissive CSP directives

* add warning about overwriting existing CSP headers

---------

Signed-off-by: Simonyi Gergő <28359278+gergosimonyi@users.noreply.github.com>
Co-authored-by: Simonyi Gergő <28359278+gergosimonyi@users.noreply.github.com>
Co-authored-by: Tana M Berry <tanamarieberry@yahoo.com>
kensternberg-authentik added a commit that referenced this pull request Nov 21, 2024
* main: (23 commits)
  website/docs: update info about footer links to match new UI (#12120)
  website/docs: prepare release notes (#12142)
  providers/oauth2: fix migration (#12138)
  providers/oauth2: fix migration dependencies (#12123)
  web: bump API Client version (#12129)
  providers/oauth2: fix redirect uri input (#12122)
  providers/proxy: fix redirect_uri (#12121)
  website/docs: prepare release notes (#12119)
  web: bump API Client version (#12118)
  security: fix CVE 2024 52289 (#12113)
  security: fix CVE 2024 52307 (#12115)
  security: fix CVE 2024 52287 (#12114)
  website/docs: add CSP to hardening (#11970)
  core: bump uvicorn from 0.32.0 to 0.32.1 (#12103)
  core: bump google-api-python-client from 2.153.0 to 2.154.0 (#12104)
  core: bump pydantic from 2.9.2 to 2.10.0 (#12105)
  translate: Updates for file locale/en/LC_MESSAGES/django.po in it (#12110)
  internal: add CSP header to files in `/media` (#12092)
  core, web: update translations (#12101)
  web: fix bug that prevented error reporting in current wizard. (#12033)
  ...
kensternberg-authentik added a commit that referenced this pull request Nov 21, 2024
* main: (23 commits)
  website/docs: update info about footer links to match new UI (#12120)
  website/docs: prepare release notes (#12142)
  providers/oauth2: fix migration (#12138)
  providers/oauth2: fix migration dependencies (#12123)
  web: bump API Client version (#12129)
  providers/oauth2: fix redirect uri input (#12122)
  providers/proxy: fix redirect_uri (#12121)
  website/docs: prepare release notes (#12119)
  web: bump API Client version (#12118)
  security: fix CVE 2024 52289 (#12113)
  security: fix CVE 2024 52307 (#12115)
  security: fix CVE 2024 52287 (#12114)
  website/docs: add CSP to hardening (#11970)
  core: bump uvicorn from 0.32.0 to 0.32.1 (#12103)
  core: bump google-api-python-client from 2.153.0 to 2.154.0 (#12104)
  core: bump pydantic from 2.9.2 to 2.10.0 (#12105)
  translate: Updates for file locale/en/LC_MESSAGES/django.po in it (#12110)
  internal: add CSP header to files in `/media` (#12092)
  core, web: update translations (#12101)
  web: fix bug that prevented error reporting in current wizard. (#12033)
  ...
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.

5 participants