@@ -78,6 +78,9 @@ class ContentSecurityPolicyHeaderWriter implements HeaderWriter {
7878 private static final String STYLE_SERIES_ADD_IMAGE =
7979 " 'sha256-DpmxvnMJIlwkpmmAANZYNzmyfnX2PQCBDO4CB2BFjzU='" ;
8080
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+
8184 // - 'https://www.gstatic.com' is required by Google Charts
8285 // - 'sha256-/kX...' is required for 'overflow: hidden;' inline CSS for Google Charts.
8386 private static final String STYLE_COLLECTION_INFO =
@@ -106,6 +109,9 @@ class ContentSecurityPolicyHeaderWriter implements HeaderWriter {
106109 private static final String SCRIPTS_CDN =
107110 " https://stamps.filezz.ru https://maxcdn.bootstrapcdn.com https://yandex.st" ;
108111
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+
109115 // - 'unsafe-eval' is required by loader.js from Google Charts
110116 // - 'https://www.gstatic.com' is required by Google Charts
111117 private static final String SCRIPT_COLLECTION_INFO = " 'unsafe-eval' https://www.gstatic.com" ;
@@ -136,6 +142,7 @@ public void writeHeaders(HttpServletRequest request, HttpServletResponse respons
136142 @ SuppressWarnings ({ "PMD.NPathComplexity" , "PMD.ModifiedCyclomaticComplexity" })
137143 private String constructDirectives (String uri ) {
138144 boolean onCollectionInfoPage = uri .startsWith (COLLECTION_INFO_PAGE_PATTERN );
145+ boolean onAddSeriesPage = uri .equals (Url .ADD_SERIES_PAGE );
139146
140147 StringBuilder sb = new StringBuilder (MIN_HEADER_LENGTH );
141148
@@ -149,8 +156,12 @@ private String constructDirectives(String uri) {
149156 if (onCollectionInfoPage ) {
150157 sb .append (STYLE_COLLECTION_INFO );
151158
152- } else if (uri .equals ( Url . ADD_SERIES_PAGE ) || uri . matches (ADD_IMAGE_PAGE_PATTERN )) {
159+ } else if (uri .matches (ADD_IMAGE_PAGE_PATTERN )) {
153160 sb .append (STYLE_SERIES_ADD_IMAGE );
161+
162+ if (onAddSeriesPage ) {
163+ sb .append (STYLE_SERIES_ADD_PAGE );
164+ }
154165
155166 } else if (uri .startsWith (TOGGLZ_PAGES_PATTERN )) {
156167 sb .append (STYLE_TOGGLZ );
@@ -164,8 +175,9 @@ private String constructDirectives(String uri) {
164175 sb .append (SCRIPT_COLLECTION_INFO );
165176 }
166177
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 )
169181 .append (CONNECT_SRC );
170182 }
171183
0 commit comments