File tree 2 files changed +18
-2
lines changed
main/java/ru/mystamps/web/support/spring/security
test/java/ru/mystamps/web/support/spring/security
2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -137,6 +137,9 @@ class ContentSecurityPolicyHeaderWriter implements HeaderWriter {
137
137
// - 'https://cdnjs.cloudflare.com' is required by selectize.bootstrap3.min.css
138
138
private static final String SCRIPTS_SERIES_ADD_PAGE = " https://cdnjs.cloudflare.com" ;
139
139
140
+ // - 'https://unpkg.com' is required by react/react-dom
141
+ private static final String SCRIPTS_SERIES_INFO_PAGE = " https://unpkg.com" ;
142
+
140
143
// - 'unsafe-eval' is required by loader.js from Google Charts
141
144
// - 'https://www.gstatic.com' is required by Google Charts
142
145
private static final String SCRIPT_COLLECTION_INFO = " 'unsafe-eval' https://www.gstatic.com" ;
@@ -214,8 +217,9 @@ protected String constructDirectives(String uri) {
214
217
sb .append (SEPARATOR )
215
218
.append (CHILD_SRC );
216
219
} else if (SERIES_INFO_PAGE_PATTERN .matcher (uri ).matches ()) {
217
- // anonymous and users without a required authority actually don't need this directive
218
- sb .append (SEPARATOR )
220
+ // anonymous and users without a required authority actually don't need these directives
221
+ sb .append (SCRIPTS_SERIES_INFO_PAGE )
222
+ .append (SEPARATOR )
219
223
.append (CONNECT_SRC );
220
224
}
221
225
Original file line number Diff line number Diff line change @@ -246,6 +246,18 @@ public void onSeriesAddImagePageWithResourcesFromCdn() {
246
246
)
247
247
);
248
248
249
+ assertThat (
250
+ directives ,
251
+ hasItemInArray (
252
+ "script-src "
253
+ + "'unsafe-inline' "
254
+ + "https://stamps.filezz.ru "
255
+ + "https://maxcdn.bootstrapcdn.com "
256
+ + "https://yandex.st "
257
+ + "https://unpkg.com"
258
+ )
259
+ );
260
+
249
261
assertThat (directives , hasItemInArray ("connect-src 'self'" ));
250
262
251
263
// hope that all other directives are the same as on the index page
You can’t perform that action at this time.
0 commit comments