Skip to content

Commit 6d3463f

Browse files
committed
ContentSecurityPolicyHeaderWriter: remove stale workaround after updating to Togglz 2.6
No functional changes.
1 parent 9b0eab5 commit 6d3463f

File tree

2 files changed

+0
-52
lines changed

2 files changed

+0
-52
lines changed

src/main/java/ru/mystamps/web/support/spring/security/ContentSecurityPolicyHeaderWriter.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ class ContentSecurityPolicyHeaderWriter implements HeaderWriter {
3737

3838
private static final String ADD_IMAGE_PAGE_PATTERN = "/series/(add|\\d+|\\d+/(ask|image))";
3939

40-
private static final String TOGGLZ_PAGES_PATTERN = Url.TOGGLZ_CONSOLE_PAGE + '/';
41-
4240
private static final String H2_CONSOLE_PATTERN = Url.H2_CONSOLE_PAGE + '/';
4341

4442
// default policy prevents loading resources from any source
@@ -88,10 +86,6 @@ class ContentSecurityPolicyHeaderWriter implements HeaderWriter {
8886
private static final String STYLE_COLLECTION_INFO =
8987
" https://www.gstatic.com 'sha256-/kXZODfqoc2myS1eI6wr0HH8lUt+vRhW8H/oL+YJcMg='";
9088

91-
// - 'sha256-biL...' is required for 'display: none;' inline CSS for Togglz
92-
private static final String STYLE_TOGGLZ =
93-
" 'sha256-biLFinpqYMtWHmXfkA1BPeCY0/fNt46SAZ+BBk5YUog='";
94-
9589
// - 'sha256-biL...' is required for 'display: none;' inline CSS
9690
// - 'sha256-ZdH...' is required for 'display: none' inline CSS
9791
// - 'sha256-aqN...' is required for 'display:none' inline CSS
@@ -196,9 +190,6 @@ protected String constructDirectives(String uri) {
196190
sb.append(STYLE_SERIES_ADD_PAGE);
197191
}
198192

199-
} else if (uri.startsWith(TOGGLZ_PAGES_PATTERN)) {
200-
sb.append(STYLE_TOGGLZ);
201-
202193
} else if (onH2ConsolePage) {
203194
sb.append(STYLE_H2_CONSOLE);
204195
}

src/test/java/ru/mystamps/web/support/spring/security/ContentSecurityPolicyHeaderWriterTest.java

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -330,49 +330,6 @@ public void onSeriesAddPageWithResourcesFromCdn() {
330330
assertThat(directives, is(arrayWithSize(NUMBER_OF_DIRECTIVES_ON_ADD_SERIES_PAGE)));
331331
}
332332

333-
@Test
334-
public void onTogglzConsoleWithLocalResources() {
335-
ContentSecurityPolicyHeaderWriter writer =
336-
new ContentSecurityPolicyHeaderWriter(true, bool());
337-
String[] directives = writer.constructDirectives("/togglz/").split(";");
338-
339-
// test only a directive that is differ from the index page
340-
assertThat(
341-
directives,
342-
hasItemInArray(
343-
"style-src "
344-
+ "https://cdn.rawgit.com "
345-
+ "'self' "
346-
+ "'sha256-biLFinpqYMtWHmXfkA1BPeCY0/fNt46SAZ+BBk5YUog='"
347-
)
348-
);
349-
350-
// hope that all other directives are the same as on the index page
351-
assertThat(directives, is(arrayWithSize(NUMBER_OF_DIRECTIVES_ON_STANDARD_PAGES)));
352-
}
353-
354-
@Test
355-
public void onTogglzConsoleWithResourcesFromCdn() {
356-
ContentSecurityPolicyHeaderWriter writer =
357-
new ContentSecurityPolicyHeaderWriter(false, bool());
358-
String[] directives = writer.constructDirectives("/togglz/").split(";");
359-
360-
// test only a directive that is differ from the index page
361-
assertThat(
362-
directives,
363-
hasItemInArray(
364-
"style-src "
365-
+ "https://cdn.rawgit.com "
366-
+ "https://stamps.filezz.ru "
367-
+ "https://maxcdn.bootstrapcdn.com "
368-
+ "'sha256-biLFinpqYMtWHmXfkA1BPeCY0/fNt46SAZ+BBk5YUog='"
369-
)
370-
);
371-
372-
// hope that all other directives are the same as on the index page
373-
assertThat(directives, is(arrayWithSize(NUMBER_OF_DIRECTIVES_ON_STANDARD_PAGES)));
374-
}
375-
376333
@Test
377334
public void onH2ConsoleWithLocalResources() {
378335
ContentSecurityPolicyHeaderWriter writer =

0 commit comments

Comments
 (0)