File tree 1 file changed +6
-3
lines changed
src/main/java/ru/mystamps/web/support/spring/security
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,10 @@ class ContentSecurityPolicyHeaderWriter implements HeaderWriter {
49
49
private static final String IMG_SRC = "img-src 'self' https://cdn.rawgit.com https://raw.githubusercontent.com" ;
50
50
51
51
// - 'self' is required by glyphicons-halflings-regular.woff2 from bootstrap
52
- private static final String FONT_SRC = "font-src 'self'" ;
52
+ private static final String FONT_SRC_SELF = "font-src 'self'" ;
53
+
54
+ // - 'https://maxcdn.bootstrapcdn.com' is required by glyphicons-halflings-regular.woff2
55
+ private static final String FONT_SRC_CDN = "font-src https://maxcdn.bootstrapcdn.com" ;
53
56
54
57
// CheckStyle: ignore LineLength for next 1 line
55
58
private static final String REPORT_URI = "report-uri https://mystamps.report-uri.io/r/default/csp/reportOnly" ;
@@ -110,7 +113,7 @@ class ContentSecurityPolicyHeaderWriter implements HeaderWriter {
110
113
private static final int MIN_HEADER_LENGTH =
111
114
DEFAULT_SRC .length ()
112
115
+ IMG_SRC .length ()
113
- + FONT_SRC .length ()
116
+ + FONT_SRC_SELF .length ()
114
117
+ REPORT_URI .length ()
115
118
+ STYLE_SRC .length ()
116
119
+ SCRIPT_SRC .length ()
@@ -133,7 +136,7 @@ private String constructDirectives(String uri) {
133
136
134
137
sb .append (DEFAULT_SRC ).append (SEPARATOR )
135
138
.append (IMG_SRC ).append (SEPARATOR )
136
- .append (FONT_SRC ).append (SEPARATOR )
139
+ .append (useSingleHost ? FONT_SRC_SELF : FONT_SRC_CDN ).append (SEPARATOR )
137
140
.append (REPORT_URI ).append (SEPARATOR )
138
141
.append (STYLE_SRC )
139
142
.append (useSingleHost ? STYLES_SELF : STYLES_CDN );
You can’t perform that action at this time.
0 commit comments