@@ -78,6 +78,9 @@ class ContentSecurityPolicyHeaderWriter implements HeaderWriter {
78
78
private static final String STYLE_SERIES_ADD_IMAGE =
79
79
" 'sha256-DpmxvnMJIlwkpmmAANZYNzmyfnX2PQCBDO4CB2BFjzU='" ;
80
80
81
+ // - 'https://cdnjs.cloudflare.com' is required by selectize.min.js
82
+ private static final String STYLE_SERIES_ADD_PAGE = " https://cdnjs.cloudflare.com" ;
83
+
81
84
// - 'https://www.gstatic.com' is required by Google Charts
82
85
// - 'sha256-/kX...' is required for 'overflow: hidden;' inline CSS for Google Charts.
83
86
private static final String STYLE_COLLECTION_INFO =
@@ -106,6 +109,9 @@ class ContentSecurityPolicyHeaderWriter implements HeaderWriter {
106
109
private static final String SCRIPTS_CDN =
107
110
" https://stamps.filezz.ru https://maxcdn.bootstrapcdn.com https://yandex.st" ;
108
111
112
+ // - 'https://cdnjs.cloudflare.com' is required by selectize.bootstrap3.min.css
113
+ private static final String SCRIPTS_SERIES_ADD_PAGE = " https://cdnjs.cloudflare.com" ;
114
+
109
115
// - 'unsafe-eval' is required by loader.js from Google Charts
110
116
// - 'https://www.gstatic.com' is required by Google Charts
111
117
private static final String SCRIPT_COLLECTION_INFO = " 'unsafe-eval' https://www.gstatic.com" ;
@@ -136,6 +142,7 @@ public void writeHeaders(HttpServletRequest request, HttpServletResponse respons
136
142
@ SuppressWarnings ({ "PMD.NPathComplexity" , "PMD.ModifiedCyclomaticComplexity" })
137
143
private String constructDirectives (String uri ) {
138
144
boolean onCollectionInfoPage = uri .startsWith (COLLECTION_INFO_PAGE_PATTERN );
145
+ boolean onAddSeriesPage = uri .equals (Url .ADD_SERIES_PAGE );
139
146
140
147
StringBuilder sb = new StringBuilder (MIN_HEADER_LENGTH );
141
148
@@ -149,8 +156,12 @@ private String constructDirectives(String uri) {
149
156
if (onCollectionInfoPage ) {
150
157
sb .append (STYLE_COLLECTION_INFO );
151
158
152
- } else if (uri .equals ( Url . ADD_SERIES_PAGE ) || uri . matches (ADD_IMAGE_PAGE_PATTERN )) {
159
+ } else if (uri .matches (ADD_IMAGE_PAGE_PATTERN )) {
153
160
sb .append (STYLE_SERIES_ADD_IMAGE );
161
+
162
+ if (onAddSeriesPage ) {
163
+ sb .append (STYLE_SERIES_ADD_PAGE );
164
+ }
154
165
155
166
} else if (uri .startsWith (TOGGLZ_PAGES_PATTERN )) {
156
167
sb .append (STYLE_TOGGLZ );
@@ -164,8 +175,9 @@ private String constructDirectives(String uri) {
164
175
sb .append (SCRIPT_COLLECTION_INFO );
165
176
}
166
177
167
- if (uri .equals (Url .ADD_SERIES_PAGE )) {
168
- sb .append (SEPARATOR )
178
+ if (onAddSeriesPage ) {
179
+ sb .append (SCRIPTS_SERIES_ADD_PAGE )
180
+ .append (SEPARATOR )
169
181
.append (CONNECT_SRC );
170
182
}
171
183
0 commit comments