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

    ## Problem                                                                  
                                                                                
                  
                                                                                
                                                                                
                   
     `RelativeURICSPValue` was supposed to only accept relative URIs, but two   
                                                                                
                   
     gaps made enforcement impossible:                                          
                                                                                
                   
                                                                                
                                                                                
                   
     1. `CSPDirective.checkValueForDirective()` short-circuited on              
                                                                                
                   
        `RelativeURICSPValue` and returned **without** calling 
`checkValidityForSrc()`.
     2. `checkValidityForSrc()` itself only validated URI syntax, not whether 
the                                                                             
                     
        URI was actually relative.                                              
                                                                                
                   
                                                                                
                                                                                
                   
     As a result, `new RelativeURICSPValue("https://evil.com";)` passed all 
checks                                                                          
                        
     and appeared verbatim in the CSP header.                                   
                                                                                
                   
                                                                                
                                                                                
                   
     ## Fix                                                                     
                                                                                
                 
                                                                                
                                                                                
                   
     - `checkValidityForSrc()` now calls `UrlUtils.isRelative()` and throws     
                                                                                
                   
       `IllegalArgumentException` if the URI is not relative.
     - `checkValueForDirective()` now calls `checkValidityForSrc()` for         
                                                                                
                   
       `RelativeURICSPValue` instead of returning early.                        
                                                                                
                   
                                                                                
                                                                                
                   
     ## Impact on existing applications                                         
                                                                                
                   
                                                                                
                                                                                
                   
     An application that passed an absolute URI to `RelativeURICSPValue` will 
get                                                                             
                     
     an `IllegalArgumentException` at startup.                                  
                                                                                
                 
                                                                                
                                                                                
                   
     Closes #1946       


-- 
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]

Reply via email to