justinas/nosurf

Possible flaw

arjndr opened this issue · 2 comments

I am relatively new to back end programming and Golang, but I thought it'd be a good idea to post this. I am able to "authenticate" requests on the example code, by passing the csrf_token cookie and form data to cURL like this:

curl http://localhost:8000 -d "name=abcd&csrf_token=dEdKyAmXFbvNZGcWvVcBQVAb8IlVwS10SAFqwSQ/k7IkMvQbmRzMHV4M5V197UPycAEOncxxler1It9TtHbpiA==" --cookie "csrf_token=UHW+05CL2aaTaIJLwLpCsyAa/hSZsLievSO1kpBJejo="

and then the response is

<!doctype html>
<html>
<body>

<p>Your name: abcd</p>

<form action="/" method="POST">
<input type="text" name="name">


<input type="hidden" name="csrf_token" value="U4/bPZUAKZ&#43;wezr8YcWkdEpsJ&#43;2gnLt6UPPXzIhXAKYD&#43;mXuBYvwOSMTuLehf&#43;bHanbZ&#43;TksA&#43;Tt0GJeGB56nA==">
<input type="submit" value="Send">
</form>
</body>
</html>

I'm not completely sure if this is an expected behavior or a flaw.

Ahh, makes sense. Thanks for the enlightenment 😄