My understanding is that
Strictis the best as, admitting you have a recent browser, it completely replaces the need for CSRF Token.Strictis however a big hit on usability as things like SSO or just having a link in email to go to a logged page will load the page without the cookie.
Would it be viable approach if :
- The user start a session (logs to a website
example.comfor example) example.comset aLaxone with just "has_a_strict_cookie=true"example.comalso set aStrictone with your usual session id etc. in it- The user-agent request a resource
/should/be/logged/sensitive example.combackend checks:- if the
Strictcookie is sent, we are in normal "same origin" navigation, the resourcesensitiveis transmistted - if only the
Laxcookie is present, it means the user has a session BUT it comes from a "cross origin" context, in which caseexample.comcould redirect toexample.com/intermediate/pagewith a link (and auto javascript click on the link?) to thesensitiveresource, so that theStrictcookie is then sent ? - if neither are present it means the user has no session at all and we simple redirect to a login page
- if the
In term of security:
- only the
Strictcookie allow access to sensitive information (session id) so it's not possible to become lazy and to start to only rely on theLaxcookie - The redirection on the intermediate page does not disclose more information than a redirect to a login page would have
In term of usability:
- You can have external link to sensitive resource / SSO scheme
- The only compromise is to have during a second an intermediate page
Am I missing something ? If not, why is not advertised more ? Most resources on the web as of 2023 seems to be "Either use Strict if you need absolute security and can live with its limitation or use Lax but you're not fully protected against CSRF attack on GET resource that modify state"
it would defeat the purpose of the strict cookie, because the user can be tricked into making these two requests
I see, but it would protect against img with a src="" or javascript triggering a fetch request ?
hmm the difference being a click vs filling up a form ? it's still an improvement ?
– allan.simon Oct 02 '23 at 19:58