datasette PR #2689: Replace token-based CSRF with Sec-Fetch-Site header protection

AI-generated summary of reporting by Simon Willison’s Weblog. Read the original for the full story.

Why it matters

Datasette developers no longer need CSRF token hidden inputs in templates; browser-based protection via Sec-Fetch-Site headers simplifies forms and removes a plugin hook.

Read this as

Datasette, an open-source tool for exploring data, has replaced its old protection against CSRF attacks, tricks where malicious websites trick a user's browser into unwanted actions. The old method required hidden code fields in every form; the new one reads a browser-supplied header instead. Developers building on Datasette can delete those token fields. The approach follows research by Filippo Valsorda adopted in Go 1.25.

Datasette maintainers replaced token-based CSRF defence with a header check based on Filippo Valsorda's research, already shipped in Go 1.25. Teams embedding or extending Datasette should review the upgrade guide: the skip_csrf plugin hook is removed and templates no longer need token inputs. The change was largely implemented by Claude Code across ten commits, reviewed by GPT-5.4 and the maintainer. No cost figures are given.

Datasette PR #2689 removes asgi-csrf token-based CSRF protection and replaces it with middleware checking the Sec-Fetch-Site header, per Filippo Valsorda's August 2025 research adopted in Go 1.25's net/http. All csrftoken hidden inputs are stripped from templates, the skip_csrf(datasette, scope) plugin hook is deleted with its tests, and docs plus the upgrade guide were updated. Claude Code wrote most of the ten commits, cross-reviewed by GPT-5.4.

Read the original

This summary exists to save you time, not to replace the source.

Key terms

Datasette Sec-Fetch-Site Go 1.25 asgi-csrf Claude Code GPT-5.4

Was this summary useful?

One click, anonymous. It tells us which summaries to re-run.

Related reading