Skip to content

Commit 4c483bb

Browse files
authored
Support adding module-specific resource hosts to more CSP directives (#996)
1 parent 1373ff5 commit 4c483bb

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

server/configs/application.properties

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -128,28 +128,30 @@ management.server.port=@@shutdownPort@@
128128
## START OF CSP ENFORCE BLOCK (DO NOT CHANGE THIS TEXT)
129129
#useLocalBuild#csp.enforce=\
130130
#useLocalBuild# default-src 'self' https: ;\
131-
#useLocalBuild# connect-src 'self' ${LABKEY.ALLOWED.CONNECTIONS} ;\
131+
#useLocalBuild# connect-src 'self' ${CONNECTION.SOURCES} ;\
132132
#useLocalBuild# object-src 'none' ;\
133-
#useLocalBuild# style-src 'self' https: 'unsafe-inline' ;\
133+
#useLocalBuild# style-src 'self' https: 'unsafe-inline' ${STYLE.SOURCES} ;\
134134
#useLocalBuild# img-src 'self' https: data: ;\
135-
#useLocalBuild# font-src 'self' data: ;\
135+
#useLocalBuild# font-src 'self' data: ${FONT.SOURCES} ;\
136136
#useLocalBuild# script-src 'self' 'unsafe-eval' 'strict-dynamic' 'nonce-${REQUEST.SCRIPT.NONCE}' ;\
137137
#useLocalBuild# base-uri 'self' ;\
138138
#useLocalBuild# frame-ancestors 'self' ;\
139+
#useLocalBuild# frame-src 'self' ${FRAME.SOURCES} ;\
139140
#useLocalBuild# report-uri /admin-contentsecuritypolicyreport.api?${CSP.REPORT.PARAMS} ;
140141
## END OF CSP ENFORCE BLOCK (DO NOT CHANGE THIS TEXT)
141142

142143
## START OF CSP REPORT BLOCK (DO NOT CHANGE THIS TEXT)
143144
csp.report=\
144145
default-src 'self' ; /* Limit the default to only the current server */\
145-
connect-src 'self' ${LABKEY.ALLOWED.CONNECTIONS} ; /* For security purposes limit allowed connection sources, can be substituted and appended via the LabKey Admin UI */\
146+
connect-src 'self' ${CONNECTION.SOURCES} ; /* For security purposes limit allowed connection sources, can be substituted and appended via the LabKey Admin UI */\
146147
object-src 'none' ; /* These tags are not currently used by LKS */\
147-
style-src 'self' 'unsafe-inline' ; /* We currently have a few inline <style> tags that we are weeding out */\
148+
style-src 'self' 'unsafe-inline' ${STYLE.SOURCES} ; /* We currently have a few inline <style> tags that we are weeding out */\
148149
img-src 'self' data: ; /* Limit image loading locations */\
149-
font-src 'self' data: ; /* Limit font source loading locations */\
150+
font-src 'self' data: ${FONT.SOURCES} ; /* Limit font source loading locations */\
150151
script-src 'unsafe-eval' 'strict-dynamic' 'nonce-${REQUEST.SCRIPT.NONCE}' ; /* Limit scripts that are allowed to those with nonces or transitive scripts */\
151152
base-uri 'self' ; /* Limit the base tags to only source from current server */\
152-
frame-ancestors 'self' ; /* Only allow embedding resources to the current server */\
153+
frame-ancestors 'self' ; /* Only allow iframe resources to the current server */\
154+
frame-src 'self' ${FRAME.SOURCES} ; /* Only allow iframe resources from the current server plus explicitly declared external sources */\
153155
report-uri /admin-contentsecuritypolicyreport.api?${CSP.REPORT.PARAMS} ; /* Reports any encountered CSP conflicts to the supplied URL */
154156
## END OF CSP REPORT BLOCK (DO NOT CHANGE THIS TEXT)
155157

0 commit comments

Comments
 (0)