You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Nexory (via GitHub)" <gi...@apache.org> on 2026/10/22 00:02:09 UTC

[PR] Remove the frame-src copy of child-src when child-src is removed [wicket]

Nexory opened a new pull request, #1698:
URL: https://github.com/apache/wicket/pull/1698

   CSPHeaderConfiguration.remove(CHILD_SRC) removed only child-src, but the frame-src copy that add(CHILD_SRC, ...) makes for older browsers stayed behind and pointed at the removed directive, so rendering the header threw an IllegalStateException and the page request failed. This change removes that copy together with child-src, keeps frame-src values that were added explicitly, and adds tests.
   
   This is a robustness fix for a public method of the CSP configuration, not a security fix.
   
   Today strict().remove(CHILD_SRC) is enough to trigger it: strict() adds child-src, which also creates frame-src as a ClonedCSPValue, remove() drops child-src only, and ClonedCSPValue.render() then throws "CSP directive CHILD_SRC not set, cannot clone its value." when the header is written.
   
   remove(CHILD_SRC) now also removes the copies of child-src from frame-src, and frame-src itself when nothing else is left in it. Values added to frame-src with add(FRAME_SRC, ...) stay, whether they were added before or after child-src, and remove(FRAME_SRC) does not touch child-src. ClonedCSPValue gets a package-private isCloneOf() so that remove() drops only its own copies. The Javadoc of remove() says so. An application that calls remove(CHILD_SRC) gets a header without child-src and frame-src instead of an exception.
   
   What I measured on current master (58ac5651):
   
   * Without the change two of the new tests fail with the IllegalStateException quoted above (2 of the 37 tests in ContentSecurityPolicySettingsTest); with it all 37 pass.
   * The other three new tests pass with and without the change. They pin an explicit frame-src set before child-src, remove(FRAME_SRC) leaving child-src alone, and a child-src added after the removal being copied into frame-src again.
   * When I break the lookup in remove() on purpose, so that it searches for copies of the wrong directive, the same two tests fail again.
   * mvn clean verify for wicket-core-tests with the modules it builds from (JDK 21 and Maven 3.9.15, the first leg of the CI matrix) ran 2784 tests with 0 failed and 19 skipped, against 2779 tests with 0 failed and 19 skipped on master without the change. The difference is the five new tests.
   * I did not run the other modules, -Pjs-test, or the newer JDK versions of the CI matrix.
   


-- 
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: commits-unsubscribe@wicket.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Remove the frame-src copy of child-src when child-src is removed [wicket]

Posted by "Nexory (via GitHub) via commits" <co...@wicket.apache.org>.
Nexory commented on PR #1698:
URL: https://github.com/apache/wicket/pull/1698#issuecomment-6647034365

   Rebased onto master. The Java 21 failure came from the japicmp check in wicket-core: the branch was still on 11.0.0-SNAPSHOT, so japicmp compared it against the released 11.0.0 and reported 12 incompatibilities, none of them in the CSP classes. The old base 58ac565 without this PR fails the same way.
   


-- 
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: commits-unsubscribe@wicket.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Remove the frame-src copy of child-src when child-src is removed [wicket]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #1698:
URL: https://github.com/apache/wicket/pull/1698#issuecomment-6330511174

   ## [Codecov](https://app.codecov.io/gh/apache/wicket/pull/1698?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :x: Patch coverage is `62.50000%` with `3 lines` in your changes missing coverage. Please review.
   :white_check_mark: Project coverage is 62.34%. Comparing base ([`58ac565`](https://app.codecov.io/gh/apache/wicket/commit/58ac565158315aa0d8ba8c2610a0490851bd4a47?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`9cbfdae`](https://app.codecov.io/gh/apache/wicket/commit/9cbfdae02681100a3c083ea1ac922e6ce476bbef?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@            Coverage Diff            @@
   ##             master    #1698   +/-   ##
   =========================================
     Coverage     62.34%   62.34%           
   - Complexity    11361    11365    +4     
   =========================================
     Files          1253     1253           
     Lines         48438    48446    +8     
     Branches       6794     6798    +4     
   =========================================
   + Hits          30198    30203    +5     
   + Misses        15538    15537    -1     
   - Partials       2702     2706    +4     
   ```
   </details>
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
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: commits-unsubscribe@wicket.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Remove the frame-src copy of child-src when child-src is removed [wicket]

Posted by "Nexory (via GitHub)" <gi...@apache.org>.
Nexory commented on PR #1698:
URL: https://github.com/apache/wicket/pull/1698#issuecomment-6331163901

   Codecov flagged three partly covered branches in this patch, so I added a second commit that only adds tests. Production code is unchanged.
   
   The new tests cover remove(CHILD_SRC) without any frame-src, a frame-src value that copies another directive, and a frame-src value that copies the child-src of another configuration. In the last two cases remove(CHILD_SRC) keeps the value.
   
   The two copy cases are what pins the check in isCloneOf(): when I changed it to return true for every copy, both tests failed, and the test without a frame-src still passed.
   
   ContentSecurityPolicySettingsTest now runs 40 tests, all green. wicket-core-tests with the modules it builds from ran 2787 tests with 0 failed and 19 skipped, against 2779 with 0 failed and 19 skipped on master.
   
   With the coverage profile, the branches of remove() and isCloneOf() together go from 10 of 14 covered to 14 of 14.
   


-- 
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: commits-unsubscribe@wicket.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org