Reputation: 2209
In the past, we needed to mitigate CSRF attacks, in ways described by this OWASP cheatsheet:
But regardless, now since SubtleCrypto is available in all browsers for a while now, the server can simply require signing requests in the browser using Javascript (e.g. using elliptic-curve-based non-extractable private keys, or any other type of asymmetric key). And in that case, we no longer use the session cookie as a bearer token.
My question is - if the server starts requiring signing using Javascript, wouldn't that completely remove the need for CSRF techniques like 1, 2, 3 above? After all, the only way a cross-site request is getting accepted by the server, is if the top-level domain loaded some Javascript, and thus got access to the non-extractable private keys, allowing it to sign requests. It also seems much more secure than relying on sessionId alone as a bearer token, because intercepting that token doesn't allow an attacker to sign any requests.
Upvotes: 0
Views: 37