csrf

Enforce CSRF tokens on state-changing endpoints across web frameworks.

20|Updated Feb 27, 2026
One-click install
npx skills add https://github.com/thejefflarson/soundcheck --skill csrf-thejefflarson
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: csrf
Source: https://github.com/thejefflarson/soundcheck/tree/main/.claude/skills/csrf
Command: npx skills add https://github.com/thejefflarson/soundcheck --skill csrf-thejefflarson

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Cross-Site Request Forgery (CSRF) vulnerabilities allow attackers to trick authenticated users into performing unwanted actions. This Skill helps you recognize, prevent, and remediate CSRF weaknesses in web applications.

Core Features & Use Cases

  • Enforces per-form CSRF tokens and CSRF middleware across common web frameworks (Django, Flask, Express, Spring, Go, Rust).
  • Verifies that state-changing endpoints require valid tokens and that cookies use secure attributes (SameSite, HttpOnly).
  • Use Case: A user submits a payment form; the system validates a CSRF token to prevent unauthorized transfers.

Quick Start

Scan your web project and enable CSRF protection by adding per-form tokens and enabling middleware across all routes.

Frequently Asked Questions about csrf

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent CSRF attacks in web applications using cookie-based sessions?▼

To prevent CSRF attacks in web applications using cookie-based sessions, enforce CSRF middleware that validates per-form tokens on state-changing endpoints and configure session cookies with SameSite attributes to prevent token leakage.

Does CSRF middleware work with Django, Flask, and Express?▼

Yes, CSRF middleware works with Django, Flask, Express, Spring, Go, and Rust. It enforces per-form CSRF tokens and validates POST, PUT, PATCH, and DELETE requests across these frameworks to block unauthorized state-changing actions.

How do I add CSRF tokens to AJAX requests and form submissions?▼

Adding CSRF tokens to AJAX requests and form submissions requires enabling CSRF middleware across all routes. The system validates tokens on state-changing endpoints to ensure authenticated users cannot be tricked into performing unwanted actions.

What is cross-site request forgery and when do I need CSRF protection?▼

Cross-site request forgery is a vulnerability where attackers trick authenticated users into performing unwanted actions. You need CSRF protection whenever web applications use cookie-based sessions for form submissions or AJAX requests to secure state-changing endpoints.

Why do session cookies need SameSite and HttpOnly attributes for form security?▼

Session cookies need SameSite and HttpOnly attributes for form security to prevent CSRF token leakage. SameSite restricts cookie transmission on cross-site requests, while HttpOnly protects tokens from client-side scripts during endpoint validation.

What's the best way to validate CSRF tokens for state-changing endpoints?▼

The best way to validate CSRF tokens for state-changing endpoints is enforcing CSRF middleware that requires valid per-form tokens for POST, PUT, PATCH, and DELETE requests, ensuring cookies use secure attributes to prevent leakage.