papegaaij commented on pull request #439:
URL: https://github.com/apache/wicket/pull/439#issuecomment-670436058


   > I notice that different reviewers have conflicting designs in mind. This 
conflict comes from the fact that @papegaaij's applications use the current 
`CsrfPreventionRequestCycleListener` not so much as a mitigation against CSRF 
attacks, but rather as an authorization or ACL component that exposes 
applications/pages/handlers to a set of whitelisted origins. Unfortunately, 
this is not what Fetch Metadata was designed for (and @svenmeier correctly 
points this out), but rather to simply reject cross-site requests to endpoints 
that aren't meant to be used cross-site, regardless of the source origin.
   
   @salcho The current situation is a bit unfortunate indeed. My application 
does not use the whitelisting, but others might. Looing at the usage of these 
whitelists, I think the reason these whitelists exist is not for ACL, but again 
to prevent false positives. False positives are common with the old 
implementation and hard to solve.
   
   > At this point, we can make changes to use Fetch Metadata as both a CSRF 
protection and an ACL component, but I believe we would be making Wicket a 
disservice by creating a security module that is: trivially bypassable (send a 
[CORS-safelisted request](https://fetch.spec.whatwg.org/#simple-header) to 
avoid setting the Origin header, which makes the check undecidable) and very 
hard to maintain, since the policies would be order-dependent and 
inter-dependent.
   
   I don't think this is needed. CSRF protection is meant to do just that, it's 
not an ACL. However, it must be possible to exclude some requests from this 
protection. The old implementation allowed this via an 
`isChecked(IRequestHandler)` method, the new implementation should do the same.
   
   I'll take a look at the PR, and see what I can do to the improve protection, 
keep the flexibility and prevent the false positives.


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

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


Reply via email to