That's why I love if it's built into the framework like Django or Phoenix rather than bolted on or home-rolled.
That's why I love if it's built into the framework like Django or Phoenix rather than bolted on or home-rolled.
That is, the protection will be on. But the way to be allowed in by the gate is not on by default. You have to remember to add the tag.
Which is why I'm so excited to just switch to SameSite once there's enough browser usage...
Whereas the hand-rolled CSRF scheme I've inherited will fail silently
Back in the day, the middleware scanned your response and injected it next to each </form> tag. A hack and dirty for sure, but removed that burden.
In the latest versions the framework sets the SameSite header properly, so you don't need the CSRF middleware at all (you can just remove it).
On the other hand, if you use some library to handle forms and validation like deform and colander, the CSRF handling is pretty transparent. Also, but validating CSRF on middleware level, you can't forget about it - features relying on POST requests won't work.