csrf token #148
Replies: 1 comment
-
Short answer: I will remove the part about CSRF tokens from the documentation. If you are building a simple application, you probably don't need them, and can simply use cookies with Long answer CSRFCross-site request forgery is an attack where an attacker creates a malicious website that points to your website. When users click on a link in the malicious site, their browser makes a request which contains their session token to your website, and your website processes the request as if the user legitimately wanted to perform the action. Traditional protection against CSRFTraditionally, websites started to implement CSRF tokens to protect against this attack. select 'redirect' as component, '/error.sql' as link
where not exists (select 1 from tokens where session = sqlpage.cookie('session') and token = :csrf_token) Modern developmentSince around 2018, all browsers support the select 'redirect' as component, '/signin.sql' as link
where not exists (select 1 from user_sessions where session_token = sqlpage.cookie('session')) I hope this answer is clear.
|
Beta Was this translation helpful? Give feedback.
-
On https://sql.ophir.dev/documentation.sql?component=form#component
there is the suggestion of using a csrf_token
How would you do that practically?
After looking at https://en.wikipedia.org/wiki/Cross-site_request_forgery#Synchronizer_token_pattern
what could the token look like?,
or is this the same as the token being used for protected pages (eg user logged in cookie)?
And in the case of protected pages you would not need a csrf token? or do you?
Beta Was this translation helpful? Give feedback.
All reactions