[
https://issues.apache.org/jira/browse/WICKET-7205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18112935#comment-18112935
]
ASF GitHub Bot commented on WICKET-7205:
----------------------------------------
pedrosans commented on code in PR #1581:
URL: https://github.com/apache/wicket/pull/1581#discussion_r3960542884
##########
wicket-core-tests/src/test/java/org/apache/wicket/csp/CSPHeaderWriterTest.java:
##########
@@ -115,6 +123,53 @@ void addCspDirectiveToStatelessPageAfterNoRedirect()
STYLE_SRC.getValue());
}
+ @Test
+ void
addCspDirectiveToStatelessPageEvenIfWrappedInMultipleIRequestHandlerDelegates()
+ {
+ tester.getApplication().mount(new
MountedMapper("withdelegate/page", NoopMockPage.class)
+ {
+ @Override
+ public IRequestHandler mapRequest(final Request request)
+ {
+ final IRequestHandler requestHandler =
super.mapRequest(request);
+ final IRequestHandler result;
+ if (requestHandler instanceof
RenderPageRequestHandler renderPageRequestHandler &&
NoopMockPage.class.equals(renderPageRequestHandler.getPageClass()))
Review Comment:
Hi, thank you for the PR. I think the test could be simplified by:
- just testing if requestHandler is != null. if so, it's ok to add wrap it
two time.
- if null, it's ok to just return
- Page can be used instead of NoopMockPage
> CSP-Headers not set if RenderPageRequestHandler wrapped in more than one
> IRequestHandlerDelegates
> -------------------------------------------------------------------------------------------------
>
> Key: WICKET-7205
> URL: https://issues.apache.org/jira/browse/WICKET-7205
> Project: Wicket
> Issue Type: Bug
> Components: wicket-core
> Affects Versions: 10.10.0, 10.11.0
> Reporter: Hans Schäfer
> Priority: Blocker
>
> If a RenderPageRequestHandler is wrapped in more than one
> IRequestHandlerDelegate, the unwrap-Method of IRequestHandlerDelegates does
> not return the RenderPageRequestHandler but a IRequestHandlerDelegates as it
> unwraps only the first one.
> This leads to not rendered CSPs.
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)