Skip to content

chore: add deployment config option to append custom csp directives#15596

Merged
Emyrk merged 6 commits into
mainfrom
stevenmasley/addition_csp_directives
Nov 21, 2024
Merged

chore: add deployment config option to append custom csp directives#15596
Emyrk merged 6 commits into
mainfrom
stevenmasley/addition_csp_directives

Conversation

@Emyrk
Copy link
Copy Markdown
Member

@Emyrk Emyrk commented Nov 19, 2024

Allows adding custom static CSP directives to Coder. Niche use case but makes this easier then creating a reverse proxy that has to replace the header. We want to preserve our directives, so having an append option is preferred to a "replace" option via a reverse proxy.

Closes #15118

Some notes

We do not validate the directives set. Browsers have different sets of support, so we accept any string values.

Screenshot from 2024-11-19 11-22-08

Example configuring. The format matches the header format.

coder server ... --additional-csp-policy="script-src https://example.com google.com"

# can also do it like
coder server ... --additional-csp-policy="script-src https://example.com" --additional-csp-policy="script-src https://google.com"

Allows adding custom static CSP directives to Coder. Niche use case
but makes this easier then creating a reverse proxy that has to
replace the header. We want to preserve our directives.
@Emyrk Emyrk changed the title chore: deployment config option to append custom csp directives chore: add deployment config option to append custom csp directives Nov 19, 2024
Copy link
Copy Markdown
Contributor

@dannykopping dannykopping left a comment

Choose a reason for hiding this comment

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

LGTM

Comment thread coderd/coderd.go Outdated
Comment thread coderd/coderd.go
Comment thread coderd/coderd.go
Comment thread codersdk/deployment.go
@Emyrk Emyrk merged commit 5b7fa78 into main Nov 21, 2024
@Emyrk Emyrk deleted the stevenmasley/addition_csp_directives branch November 21, 2024 17:53
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.

Embedding Coder Instance - CSP Frame Ancestor Issue

3 participants