arrow-site icon indicating copy to clipboard operation
arrow-site copied to clipboard

The Content-Security-Policy header must not be overridden

Open sebbASF opened this issue 2 months ago • 5 comments

https://github.com/apache/arrow-site/blob/0a7594a059837f9324ee769fa29c5e84d6103156/.htaccess#L31

The Content-Security-Policy header must not be overridden.

There is now a standard way to add local exceptions to the CSP:

https://infra.apache.org/tools/csp.html

Please update the .htaccess file accordingly.

sebbASF avatar Oct 25 '25 12:10 sebbASF

Thanks @sebbASF. @thisisnic are you able to take a look at this?

amoeba avatar Oct 25 '25 16:10 amoeba

Thanks for the ping @amoeba, will take a look next week.

thisisnic avatar Oct 25 '25 17:10 thisisnic

Please note that the policy says that any exceptions must have been approved, and a reference to the approval must be commented in the .htaccess file

sebbASF avatar Oct 28 '25 23:10 sebbASF

Thanks for the info @sebbASF. I was wondering if you know of other projects which are using the kapa.ai bot which have needed to do the same, so I can compare to those and check if it looks right before I merge? Last time we updated the .htaccess file, it took a lot of rounds to get it right while trying not to take out the website for too long.

thisisnic avatar Oct 29 '25 08:10 thisisnic

Which pages have the kapa.ai bot? I could not find any reference to it except in the htaccess CSP override.

Note that there are ways to test changes to the CSP without affecting the deployed site. You could set up a preview site (define this in .asf.yaml).

Or the Attic project has a Docker definition that can apply any desired CSP to a remote website. Details are in https://github.com/apache/attic/blob/main/DOCKER.md

The basic commands are:

$ docker compose build (only needs to be done once, unless you change any files)

VAR_HOSTURL=https://beam.apache.org/ CSP_PROJECT_DOMAINS="host1 host2" docker compose up

Navigate to localhost:8000

If you enable browser debugging, you should be able to see if there are any CSP errors in the console log.

sebbASF avatar Oct 31 '25 17:10 sebbASF