Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(webapp): add missing hashes to CSP #794

Merged
merged 1 commit into from
Nov 19, 2023

Conversation

Rotzbua
Copy link
Contributor

@Rotzbua Rotzbua commented Aug 15, 2023

Add inline script hashes for @vitejs/plugin-legacy:

Add the corresponding hashes to your script-src list:

sha256-MS6/3FCg4WjP9gwgaBGwLpRCY6fZBgwmhVCdrPrNf3E=
sha256-tQjf8gvb2ROOMapIxFvFAYBeUJ0v1HCbOcSmDNXGtDo=
sha256-4y/gEB2/KIwZFTfNqwXJq4olzvmQ0S214m9jwKgNXoc=
sha256-+5XkZFazzJo8n0iOP4ti/cLCMUudTf//Mzkb7xNPXIc=

Source:
https://github.com/vitejs/vite/tree/main/packages/plugin-legacy#content-security-policy

Reference

fixes #788

Copy link
Member

@peterthomassen peterthomassen left a comment

Choose a reason for hiding this comment

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

i think we can add these. To avoid future confusion, would you mind adding comments to explain what these hashes are about? Thanks!

Copy link
Member

@peterthomassen peterthomassen left a comment

Choose a reason for hiding this comment

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

Thanks. Now, unfortunately, the hashes have changed yesterday (see vitejs/vite@4033a32).

How are we going to go about this? -- If they get outdated, it's about as good as not having them at all.

@Rotzbua
Copy link
Contributor Author

Rotzbua commented Nov 14, 2023

Thanks. Now, unfortunately, the hashes have changed yesterday (see vitejs/vite@4033a32).

The commit is part of vite v5 which is not released yet.
Since this would be a mayor update, it is ok that the hash changes.

@peterthomassen
Copy link
Member

Mh. Nevertheless, the code comment linking to the source is not correct (it lists the new hashes, not the ones that are in this PR).

@peterthomassen
Copy link
Member

So, can you fix the comments such that the point at the source of the hashes? -- If we don't do this, anyone looking at the code some time in the future will be confused.

Add inline script hashes for `@vitejs/plugin-legacy`:

Warning: the hashes may change with newer releases!

Add the corresponding hashes to your script-src list:

    sha256-MS6/3FCg4WjP9gwgaBGwLpRCY6fZBgwmhVCdrPrNf3E=
    sha256-tQjf8gvb2ROOMapIxFvFAYBeUJ0v1HCbOcSmDNXGtDo=
    sha256-4y/gEB2/KIwZFTfNqwXJq4olzvmQ0S214m9jwKgNXoc=
    sha256-+5XkZFazzJo8n0iOP4ti/cLCMUudTf//Mzkb7xNPXIc=

Source:
https://github.com/vitejs/vite/tree/v4/packages/plugin-legacy#content-security-policy
Copy link
Member

@peterthomassen peterthomassen left a comment

Choose a reason for hiding this comment

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

thanks, lgtm!

@peterthomassen peterthomassen merged commit ef55495 into desec-io:main Nov 19, 2023
5 checks passed
@Rotzbua Rotzbua deleted the fix_vite_csp branch December 2, 2023 13:47
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.

nginx: update CSP header for webapp
2 participants