dashorst opened a new issue, #1946:
URL: https://github.com/apache/wicket/issues/1946
`CSPHeaderConfiguration#reportBack(String mountPath)` adds a
`RelativeURICSPValue` to the `report-uri` directive. The directive's
`checkValueForDirective` returns as soon as it sees a `RelativeURICSPValue`, so
the value is never checked. Passing an absolute URL or a malformed path by
mistake is accepted silently and produces a CSP header the browser can't use.
## Where
- `wicket-core/src/main/java/org/apache/wicket/csp/CSPDirective.java`, the
`REPORT_URI` constant's `checkValueForDirective`: the `if (value instanceof
RelativeURICSPValue) { return; }` branch.
- `wicket-core/src/main/java/org/apache/wicket/csp/RelativeURICSPValue.java`
already has `checkValidityForSrc()`, which resolves the value against
`https://example.com/`. The original report suggests calling it from the branch
above. Check whether it actually rejects an absolute URL like
`https://evil.example/report`; the report says it should be rewritten as well.
## Done when
- `reportBack` throws an `IllegalArgumentException` for a value that isn't a
relative path, and still accepts a normal mount path like `cspviolation`.
- Tests for both cases in
`wicket-core-tests/src/test/java/org/apache/wicket/csp/CSPDirectiveTest.java`.
## Background
Originally reported as
[WICKET-7015](https://issues.apache.org/jira/browse/WICKET-7015) (Wicket 9.12).
The reporter included the proposed change in the ticket.
---
Part of #1945. This issue is meant for a first contribution to Wicket. To
work on it, leave a comment so others know; a claim without a pull request
lapses after two weeks. Questions are welcome, here on the issue or on
[email protected]. Start your branch from `master`, and see [Send a pull
request to
Wicket](https://wicket.apache.org/contribute/wicket-pull-request.html) for
building and testing.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]