Skip to content

First-party CSRF story for forms and API routes #43

Description

@JoviDeCroock

Problem

Pracht provides primitives that make cookie-backed mutations easy:

  • <Form method=post action=...>
  • API routes with POST, PUT, PATCH, and DELETE
  • middleware-driven session auth

But there is no built-in CSRF defense story in the framework itself. If an app
uses ambient cookies for auth, cross-site form posts or fetches can become the
app developer's problem by default.

Consider

Define a first-party CSRF posture for state-changing requests:

  • document the minimum safe baseline for cookie-backed auth
  • provide helpers for token generation and verification, or a middleware pattern
  • support origin / same-site validation where appropriate
  • clarify how this should work across Node, Cloudflare, and Vercel adapters
  • make examples and starter templates follow the recommended pattern

Why it matters

This is a common web security footgun. If the framework makes mutations easy, it
should also make the safe path obvious and easy to adopt.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions