Skip to content

Commit 50431e4

Browse files
committed
add default CSP commented out as example for the users
1 parent 0c17455 commit 50431e4

2 files changed

Lines changed: 31 additions & 3 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ This repo contains a Dockerfile, `docker-compose.yml`, and various other files f
77
This repo is a work in progress. Containers created from these sources are untested. Until further work is done, integrations with LabKey products that traditionally have relied on OS configuration such as R reports or Python scripts will **NOT** work.
88

99
## Content Security Policy
10-
February 2025 brings an enforced Content Security Policy enabled by default, the same one that LabKey uses in most if not all deployments, and is highly recommended to be left in place. It can, however, be disabled by enabling the `ExperimentalFeature.disableEnforceCsp` startup property.
10+
May 2025 brings a stricter Content Security Policy set directly in the LabKey server code (https://github.com/LabKey/server/blob/develop/server/embedded/src/org/labkey/embedded/LabKeyServer.java).
1111

12-
The policy itself can be overriden with an `optional.application.properties` file.
12+
The policies can still be overridden by setting them in `application.properties`. See the commented out section there for examples.
1313

14-
CSP_REPORT and CSP_ENFORCE environment variables have been removed.
14+
The default enforce policy can be disabled by enabling the `ExperimentalFeature.disableEnforceCsp` startup property.
1515

1616
## log4j2.xml
1717
March 2025 brings a new implementation of log4j2.xml. We're now using the default configuration from the [server repo](https://github.com/LabKey/server/blob/develop/server/embedded/src/main/resources/log4j2.xml), and overriding that as needed with the local file identified in the `LOG4J_CONFIG_OVERRIDE` environment variable. By default this is an empty file that makes no changes, which is due to some complications of the Docker `COPY` command. During startup, entrypoint.sh copies the local files into the configs directory after the jar has been opened up.

application.properties

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,5 +163,33 @@ server.tomcat.max-threads=50
163163
server.servlet.session.timeout=60m
164164
context.workDirLocation=/work/Tomcat/localhost
165165

166+
## Example CSP Enforce policy
167+
# csp.enforce=\
168+
# default-src 'self' ; \
169+
# connect-src 'self' ${CONNECTION.SOURCES} ; \
170+
# object-src 'none' ; \
171+
# style-src 'self' 'unsafe-inline' ${STYLE.SOURCES} ; \
172+
# img-src 'self' data: ${IMAGE.SOURCES} ; \
173+
# font-src 'self' data: ${FONT.SOURCES} ; \
174+
# script-src 'unsafe-eval' 'strict-dynamic' 'nonce-${REQUEST.SCRIPT.NONCE}' ; \
175+
# base-uri 'self' ; \
176+
# frame-src 'self' ${FRAME.SOURCES} ; \
177+
# ${UPGRADE.INSECURE.REQUESTS} ; \
178+
# frame-ancestors 'self' ; \
179+
# report-uri /admin-contentSecurityPolicyReport.api?cspVersion=e12&${CSP.REPORT.PARAMS} ;
180+
181+
## Example CSP Report policy
182+
# csp.report=\
183+
# default-src 'self' ; \
184+
# connect-src 'self' ${CONNECTION.SOURCES} ; \
185+
# object-src 'none' ; \
186+
# style-src 'self' 'unsafe-inline' ${STYLE.SOURCES} ; \
187+
# img-src 'self' data: ${IMAGE.SOURCES} ; \
188+
# font-src 'self' data: ${FONT.SOURCES} ; \
189+
# script-src 'unsafe-eval' 'strict-dynamic' 'nonce-${REQUEST.SCRIPT.NONCE}' ; \
190+
# base-uri 'self' ; \
191+
# frame-src 'self' ${FRAME.SOURCES} ; \
192+
# report-uri /admin-contentSecurityPolicyReport.api?cspVersion=r12&${CSP.REPORT.PARAMS} ;
193+
166194
## Load optional application.properties if file exists - used for one-off labkey cloud use cases etc.
167195
spring.config.import=optional:file:${LABKEY_HOME}/config/optional.application.properties

0 commit comments

Comments
 (0)