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

Make CSP examples consistent #669

Merged
merged 4 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@
<param-name>policy</param-name>
<param-value>
default-src 'self';
connect-src 'self' ;
connect-src 'self' ${LABKEY.ALLOWED.CONNECTIONS} ;
object-src 'none' ;
style-src 'self' 'unsafe-inline' ;
img-src 'self' data: ;
font-src 'self' data: ;
script-src 'unsafe-eval' 'strict-dynamic' 'nonce-${REQUEST.SCRIPT.NONCE}';
base-uri 'self' ;
upgrade-insecure-requests ;
Expand Down Expand Up @@ -64,10 +65,11 @@
<param-name>policy</param-name>
<param-value>
default-src 'self' https: ;
connect-src 'self' https: ;
connect-src 'self' https: ${LABKEY.ALLOWED.CONNECTIONS} ;
object-src 'none' ;
style-src 'self' https: 'unsafe-inline' ;
img-src 'self' data: ;
font-src 'self' data: ;
script-src 'unsafe-inline' 'unsafe-eval' 'strict-dynamic' 'nonce-${REQUEST.SCRIPT.NONCE}';
base-uri 'self' ;
upgrade-insecure-requests ;
Expand Down
38 changes: 35 additions & 3 deletions server/configs/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,46 @@ spring.main.banner-mode=off

# example usage 1 - very strict, disallows 'external' websites, disallows unsafe-inline, but only reports violations (does not enforce)

#csp.report=default-src 'self' https: ;\nconnect-src 'self' https: ;\nobject-src 'none' ;\nstyle-src 'self' https: 'unsafe-inline' ;\nimg-src 'self' data: ;\nscript-src 'unsafe-inline' 'unsafe-eval' 'strict-dynamic' 'nonce-${REQUEST.SCRIPT.NONCE}';\nbase-uri 'self' ;\nupgrade-insecure-requests ;\nframe-ancestors 'self' ;\nreport-to https://www.labkey.org/admin-contentsecuritypolicyreport.api ;\nreport-uri https://www.labkey.org/admin-contentsecuritypolicyreport.api ;
#csp.report=\
# default-src 'self';\
# connect-src 'self' ${LABKEY.ALLOWED.CONNECTIONS} ;\
# object-src 'none' ;\
# style-src 'self' 'unsafe-inline' ;\
# img-src 'self' data: ;\
# font-src 'self' data: ;\
# script-src 'unsafe-eval' 'strict-dynamic' 'nonce-${REQUEST.SCRIPT.NONCE}';\
# base-uri 'self' ;\
# upgrade-insecure-requests ;\
# frame-ancestors 'self' ;\
# report-uri https://www.labkey.org/admin-contentsecuritypolicyreport.api ;

# example usage 2 - less strict but enforces directives, (NOTE: unsafe-inline is still required for many modules)

#csp.enforce=default-src 'self' https: ;\nconnect-src 'self' https: ;\nobject-src 'none' ;\nstyle-src 'self' https: 'unsafe-inline' ;\nimg-src 'self' data: ;\nscript-src 'unsafe-inline' 'unsafe-eval' 'strict-dynamic' 'nonce-${REQUEST.SCRIPT.NONCE}';\nbase-uri 'self' ;\nupgrade-insecure-requests ;\nframe-ancestors 'self' ;\nreport-to https://www.labkey.org/admin-contentsecuritypolicyreport.api ;\nreport-uri https://www.labkey.org/admin-contentsecuritypolicyreport.api ;
#csp.enforce=\
# default-src 'self' https: ;\
# connect-src 'self' https: ${LABKEY.ALLOWED.CONNECTIONS};\
# object-src 'none' ;\
# style-src 'self' https: 'unsafe-inline' ;\
# img-src 'self' data: ;\
# font-src 'self' data: ;\
# script-src 'unsafe-inline' 'unsafe-eval' 'strict-dynamic' 'nonce-${REQUEST.SCRIPT.NONCE}';\
# base-uri 'self' ;\
# upgrade-insecure-requests ;\
# frame-ancestors 'self' ;\
# report-uri https://www.labkey.org/admin-contentsecuritypolicyreport.api ;

# Default CSP for TeamCity and dev deployments
#setupTask#csp.report=default-src 'self' https: http: ;\nconnect-src 'self' ${LABKEY.ALLOWED.CONNECTIONS} ;\nobject-src 'none' ;\nstyle-src 'self' https: 'unsafe-inline' ;\nimg-src 'self' https: data: ;\nscript-src 'unsafe-eval' 'strict-dynamic' 'nonce-${REQUEST.SCRIPT.NONCE}' ;\nbase-uri 'self' ;\nframe-ancestors 'self' ;\nreport-to /admin-contentsecuritypolicyreport.api ;\nreport-uri /admin-contentsecuritypolicyreport.api ;
#setupTask#csp.report=\
#setupTask# default-src 'self' https: http: ;\
#setupTask# connect-src 'self' ${LABKEY.ALLOWED.CONNECTIONS} ;\
#setupTask# object-src 'none' ;\
#setupTask# style-src 'self' https: 'unsafe-inline' ;\
#setupTask# img-src 'self' https: data: ;\
#setupTask# font-src 'self' https: data: ;\
#setupTask# script-src 'unsafe-eval' 'strict-dynamic' 'nonce-${REQUEST.SCRIPT.NONCE}' ;\
#setupTask# base-uri 'self' ;\
#setupTask# frame-ancestors 'self' ;\
#setupTask# report-uri /admin-contentsecuritypolicyreport.api ;

# Use a non-temp directory for tomcat
#setupTask#server.tomcat.basedir=@@pathToServer@@/build/deploy/embedded
Expand Down