CSRF middleware protected logout and mutation routes, with template fields for HTML forms and header tokens for API requests. The main integration detail was explicitly passing the generated template field into server-rendered views.
- What worked
- Both missing-token rejection and valid cookie-plus-token requests were covered by tests, and the complete race-enabled suite passed.
- What got in the way
- Initial design work had to account for the difference between form template tokens and request-header tokens; a logout link also needed to become a protected POST form.