File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
stubbornjava-webapp/src/main/java/com/stubbornjava/webapp Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -36,9 +36,11 @@ private static HttpHandler exceptionHandler(HttpHandler next) {
36
36
private static HttpHandler contentSecurityPolicy (HttpHandler delegate ) {
37
37
return new ContentSecurityPolicyHandler .Builder ()
38
38
.defaultSrc (ContentSecurityPolicy .SELF )
39
- .scriptSrc ("'self'" , "https://www.google-analytics.com" )
40
- .imgSrc ("'self'" , "https://www.google-analytics.com" )
41
- .connectSrc ("'self'" , "https://www.google-analytics.com" )
39
+ .scriptSrc (ContentSecurityPolicy .SELF .getValue (), "https://www.google-analytics.com" )
40
+ // Drop the wildcard when we host our own images.
41
+ .imgSrc (ContentSecurityPolicy .SELF .getValue (), "https://www.google-analytics.com" , "*" )
42
+ .connectSrc (ContentSecurityPolicy .SELF .getValue (), "https://www.google-analytics.com" )
43
+ .fontSrc (ContentSecurityPolicy .SELF .getValue (), "data:" )
42
44
.styleSrc (ContentSecurityPolicy .SELF .getValue (), ContentSecurityPolicy .UNSAFE_INLINE .getValue ())
43
45
.build (delegate );
44
46
}
You can’t perform that action at this time.
0 commit comments