Agent skill

Validating Csrf Protection

by jeremylongshore in jeremylongshore/tons-of-skills-marketplace

Validate CSRF protection implementations for security gaps. An agent skill from jeremylongshore/tons-of-skills-marketplace.

MITAuto-check passedSecurity

Install Validating Csrf Protection

skills CLI
$ npx skills add jeremylongshore/tons-of-skills-marketplace --skill validating-csrf-protection -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install jeremylongshore/tons-of-skills-marketplace validating-csrf-protection --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/jeremylongshore/tons-of-skills-marketplace.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/.curated/validating-csrf-protection .claude/skills/validating-csrf-protection && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
validating-csrf-protection
GitHub stars
2.8k
Token cost
~1.8k tokens
SKILL.md length
741 words
Files
5 (incl. scripts, references, assets)
Skills in repo
3,342
Repo updated
First seen
Licence
MIT

At a glance

Validate CSRF protection implementations for security gaps. An agent skill from jeremylongshore/tons-of-skills-marketplace.

  • Works in 10 steps: Inventory all state-changing endpoints… → For each state-changing endpoint, verify… → Validate synchronizer token… → …
  • Reviewing form security
  • SKILL.md covers Overview, Prerequisites, Instructions and Output, plus 3 more sections
  • Runs Python scripts from its folder

What it does

Validating Csrf Protection is an agent skill from jeremylongshore/tons-of-skills-marketplace. Validate CSRF protection implementations for security gaps. Use when reviewing form security or state-changing operations. Trigger with 'validate CSRF', 'check CSRF protection', or 'review token security'.

Its SKILL.md is about 1.8k tokens, which your agent loads only when the skill is triggered. The skill folder holds 7 other files, including scripts, reference files and assets (for example `assets/README.md`, `references/README.md` and `scripts/README.md`). Compatibility notes: Designed for Claude Code

It sits in Security, covering Web application vulnerabilities. The repository describes itself as: Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com. The licence is MIT.

When your agent uses it

  • Reviewing form security
  • State-changing operations
  • With validate CSRF
  • Check CSRF protection

Example prompts

  • “validate CSRF”
  • “check CSRF protection”
  • “review token security”
  • “/validating-csrf-protection”

Requirements

  • Python 3
  • Compatibility (from SKILL.md): Designed for Claude Code
  • Pre-approved tools (allowed-tools): Read, Write, Edit, Grep, Glob, Bash(security:*), Bash(scan:*), Bash(audit:*)

Workflow steps

10 steps, taken from the first numbered list in SKILL.md.

  1. Inventory all state-changing endpoints by scanning for POST, PUT, PATCH, and DELETE route handlers using Grep. Include form action…
  2. For each state-changing endpoint, verify that at least one CSRF protection mechanism is in place: synchronizer token, double-submit…
  3. Validate synchronizer token implementation: confirm tokens are generated server-side using a CSPRNG, bound to the user session, included…
  4. Check double-submit cookie patterns: verify the cookie value matches the request body or header value, the cookie uses Secure and HttpOnly…
  5. Assess SameSite cookie attributes on session cookies: verify SameSite=Strict or SameSite=Lax is set. Flag SameSite=None without Secure as…
  6. Verify Origin/Referer header validation: check that the server validates the Origin header against an allowlist on state-changing…
  7. For API endpoints using token-based auth (JWT in Authorization header), confirm that cookies are not also sent -- if cookies are used…
  8. Check for CSRF bypass vectors: look for state-changing GET endpoints, JSONP endpoints, content-type sniffing (missing Content-Type…
  9. Classify each finding by severity (critical for unprotected financial/admin endpoints, high for other state-changing endpoints, medium for…
  10. Generate remediation guidance with framework-specific CSRF middleware configuration examples.

What it can do on your machine

Read from SKILL.md and the folder at commit cfae287. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Write
    • Edit
    • Grep
    • Glob
    • Bash(security:*)
    • Bash(scan:*)
    • Bash(audit:*)

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 2 files in scripts/ (Python), which the agent can run.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • cheatsheetseries.owasp.org
    • cwe.mitre.org
    • web.dev
    • owasp.org

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Designed for Claude Code

    From compatibility in the SKILL.md frontmatter.

Context cost

Validating Csrf Protection loads about 1.8k tokens when it runs, and up to ~1.8k if it reads all its reference files. Until then it costs about 58 tokens; SKILL.md has 741 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~58
When it runs · the whole SKILL.md, loaded when a task matches
~1.8k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~1.8k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from jeremylongshore/tons-of-skills-marketplace at commit cfae287, republished under its MIT licence (© jeremylongshore). 741 words, ~1,752 tokens.

Download SKILL.mdSave it as .claude/skills/validating-csrf-protection/SKILL.md (or your agent's skills folder). This skill also uses 4 other files; get the full folder from GitHub.
name
validating-csrf-protection
description
Validate CSRF protection implementations for security gaps. Use when reviewing form security or state-changing operations. Trigger with 'validate CSRF', 'check CSRF protection', or 'review token security'.
allowed-tools
Read, Write, Edit, Grep, Glob, Bash(security:*), Bash(scan:*), Bash(audit:*)
compatibility
Designed for Claude Code
version
1.26.0
license
MIT
author
Jeremy Longshore <jeremy@intentsolutions.io>
tags
security, validating-csrf

Validating CSRF Protection

Overview

Validate Cross-Site Request Forgery protection across web application endpoints, forms, and API routes. This skill examines synchronizer token patterns, double-submit cookie implementations, SameSite cookie attributes, Origin/Referer header validation, and custom header requirements to identify state-changing operations vulnerable to CSRF attacks.

Prerequisites

  • Access to the target codebase and configuration files in ${CLAUDE_SKILL_DIR}/
  • Familiarity with the web framework in use (Express, Django, Rails, Spring, Laravel, etc.)
  • Standard shell utilities and Grep/Glob available for codebase scanning
  • Reference: ${CLAUDE_SKILL_DIR}/references/README.md for CSRF protection methods, OWASP CSRF Prevention Cheat Sheet, and framework-specific API examples

Instructions

  1. Inventory all state-changing endpoints by scanning for POST, PUT, PATCH, and DELETE route handlers using Grep. Include form action attributes in HTML templates, AJAX calls in JavaScript, and API route definitions.
  2. For each state-changing endpoint, verify that at least one CSRF protection mechanism is in place: synchronizer token, double-submit cookie, SameSite cookie attribute, Origin validation, or custom header requirement.
  3. Validate synchronizer token implementation: confirm tokens are generated server-side using a CSPRNG, bound to the user session, included in forms as hidden fields or request headers, and validated on every state-changing request. Flag tokens that are static, predictable, or reused across sessions as CWE-352 (Cross-Site Request Forgery).
  4. Check double-submit cookie patterns: verify the cookie value matches the request body or header value, the cookie uses Secure and HttpOnly attributes, and the comparison is timing-safe to prevent token extraction.
  5. Assess SameSite cookie attributes on session cookies: verify SameSite=Strict or SameSite=Lax is set. Flag SameSite=None without Secure as severity high. Note that SameSite=Lax permits top-level GET navigations, which may be insufficient for GET endpoints that trigger state changes.
  6. Verify Origin/Referer header validation: check that the server validates the Origin header against an allowlist on state-changing requests. Flag implementations that fall back to no protection when the header is absent.
  7. For API endpoints using token-based auth (JWT in Authorization header), confirm that cookies are not also sent -- if cookies are used alongside bearer tokens, CSRF protection remains necessary.
  8. Check for CSRF bypass vectors: look for state-changing GET endpoints, JSONP endpoints, content-type sniffing (missing Content-Type enforcement), and Flash/Silverlight crossdomain.xml files.
  9. Classify each finding by severity (critical for unprotected financial/admin endpoints, high for other state-changing endpoints, medium for defense-in-depth gaps).
  10. Generate remediation guidance with framework-specific CSRF middleware configuration examples.

Output

  • Endpoint inventory: Table of all state-changing endpoints with their CSRF protection status (Protected, Partially Protected, Unprotected)
  • Findings report: Each finding includes severity, CWE-352 reference, affected endpoint/file, attack scenario description, and remediation code
  • Protection coverage: Percentage of state-changing endpoints with validated CSRF protection
  • SameSite cookie audit: Table of all session/auth cookies with their SameSite, Secure, HttpOnly, and Path attributes
  • Remediation guide: Framework-specific middleware setup (e.g., csurf for Express, @csrf_protect for Django, csrf_meta_tags for Rails)
Show full SKILL.md (281 more words)Show less

Error Handling

ErrorCauseSolution
No state-changing endpoints foundUnconventional routing patterns or SPA architectureCheck for client-side routing frameworks (React Router, Vue Router) and trace API calls from frontend code
CSRF middleware detected but not applied globallyMiddleware applied per-route rather than globallyVerify every state-changing route has the middleware applied; flag gaps in coverage
Token generation source unclearFramework abstracts CSRF token generationCheck framework documentation for default CSPRNG usage; inspect framework source if needed
SameSite attribute not set in codeCookie attributes set at infrastructure layerCheck reverse proxy, load balancer, or CDN cookie rewriting rules
Mixed protection strategiesDifferent endpoints use different CSRF mechanismsDocument each strategy and verify consistency; recommend standardizing on one approach

Examples

Express.js CSRF Token Validation

Scan ${CLAUDE_SKILL_DIR}/src/routes/ for router.post and router.put handlers. Verify each includes csurf middleware or equivalent token validation. Flag any POST handler that directly processes req.body without csrfProtection middleware as CWE-352, severity critical for financial operations, high for other state changes.

Django CSRF Middleware Audit

Grep ${CLAUDE_SKILL_DIR}/settings.py for django.middleware.csrf.CsrfViewMiddleware in the MIDDLEWARE list. Scan views for @csrf_exempt decorators -- flag each exempted view as a potential CSRF vulnerability requiring justification. Verify templates include {% csrf_token %} in all form tags.

SPA + API CSRF Assessment

For a React frontend calling a REST API, verify that the API enforces a custom header requirement (e.g., X-Requested-With) or uses double-submit cookies. Check that the SPA reads the CSRF token from a cookie and includes it in the X-CSRF-Token header. Flag API endpoints that accept application/x-www-form-urlencoded without CSRF validation as severity high (exploitable via HTML forms).

Resources

© jeremylongshore, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 4 other files (scripts, references, assets) in skills/.curated/validating-csrf-protection of jeremylongshore/tons-of-skills-marketplace.

  • SKILL.md
  • assets/README.md
  • references/README.md
  • scripts/README.md
  • scripts/csrf_test.py

Open the folder on GitHubat commit cfae287

Compare with similar skills

Validating Csrf Protection next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Validating Csrf Protection compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Validating Csrf Protection this skilljeremylongshore/tons-of-skills-marketplace2.8k—~1.8kAutomated safety check: PassMIT
Security And Hardeningpenpot/penpot61k6 repos~4.7kAutomated safety check: NotesMPL-2.0
Security Auditoreigent-ai/eigent15k—~1.8kAutomated safety check: NotesApache-2.0
Security Reviewjewbetcha/opentrace11618 repos~3.1kAutomated safety check: NotesMIT
Strix Code Vulnerability Scanusestrix/strix68k—~1.1kAutomated safety check: PassApache-2.0
Code Audit3stoneBrother/code-audit8921 repos~2.7kAutomated safety check: PassNone

Similar skills

  • Hardens code against vulnerabilities. An agent skill from penpot/penpot.

    61k GitHub starsUsed in 6 repos~4.7k tokens
    SecurityAuto-check: notes
  • Security Auditor

    eigent-ai/eigent

    Audits source code, dependencies and config files for vulnerabilities and hardcoded secrets, using two bundled Python scanners and an OWASP Top 10 checklist.

    15k GitHub stars~1.8k tokensUpdated yesterday
    SecurityAuto-check: notes
  • Security Review

    jewbetcha/opentrace

    A skill your agent uses when adding authentication, handling user input, working with secrets, creating API endpoints, or implementing payment/sensitive features.

    116 GitHub starsUsed in 18 repos~3.1k tokens
    SecurityAuto-check: notes
  • Runs a Strix white-box security review that reads the source, then exploits what it finds in a sandbox so each reported issue has a proof-of-concept.

    68k GitHub stars~1.1k tokensUpdated yesterday
    SecurityAuto-check passed
  • Code Audit

    3stoneBrother/code-audit

    Professional code security audit skill covering 55+ vulnerability types.

    892 GitHub starsUsed in 1 repo~2.7k tokens
    SecurityAuto-check passed
  • Triages findings from a Strix pentest by severity, fixes each root cause with a minimal change, and re-runs Strix to confirm the exploit no longer works.

    68k GitHub stars~1.5k tokensUpdated yesterday
    SecurityAuto-check passed

More from jeremylongshore/tons-of-skills-marketplace

All 3,342 skills in this repo
  • Performing Security Code Review

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to conduct a security-focused code review using the security-agent plugin.

    2.8k GitHub starsUsed in 2 repos~1.3k tokens
    Auto-check: notes
  • Adapting Transfer Learning Models

    jeremylongshore/tons-of-skills-marketplace

    Build this skill automates the adaptation of pre-trained machine learning models using transfer learning techniques.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Agent Context Loader

    jeremylongshore/tons-of-skills-marketplace

    Execute proactive auto-loading: automatically detects and loads agents.md files.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Aggregating Performance Metrics

    jeremylongshore/tons-of-skills-marketplace

    Aggregate and centralize performance metrics from applications, systems, databases, caches, and services.

    2.8k GitHub stars~1.2k tokensUpdated today
    Auto-check passed
  • Analyzing Capacity Planning

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to analyze capacity requirements and plan for future growth.

    2.8k GitHub stars~947 tokensUpdated today
    Auto-check passed
  • Analyzing Database Indexes

    jeremylongshore/tons-of-skills-marketplace

    Process use when you need to work with database indexing. An agent skill from jeremylongshore/tons-of-skills-marketplace.

    2.8k GitHub stars~2k tokensUpdated today
    Auto-check passed

Categories

Questions about Validating Csrf Protection

What does Validating Csrf Protection do?

Validate CSRF protection implementations for security gaps. An agent skill from jeremylongshore/tons-of-skills-marketplace. Validating Csrf Protection is an agent skill from jeremylongshore/tons-of-skills-marketplace. Validate CSRF protection implementations for security gaps.

When should I use Validating Csrf Protection?

Validating Csrf Protection fits situations like: reviewing form security; state-changing operations; with validate CSRF; check CSRF protection.

How do I install Validating Csrf Protection in Claude Code?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill validating-csrf-protection -a claude-code`. Or copy the skill folder (skills/.curated/validating-csrf-protection in jeremylongshore/tons-of-skills-marketplace) into .claude/skills/validating-csrf-protection in your project. Claude Code loads it when a task matches its description.

How do I install Validating Csrf Protection in Codex?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill validating-csrf-protection -a codex`. Or copy the skill folder (skills/.curated/validating-csrf-protection in jeremylongshore/tons-of-skills-marketplace) into .agents/skills/validating-csrf-protection in your project. Codex loads it when a task matches its description.

Can I use Validating Csrf Protection in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill validating-csrf-protection -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/validating-csrf-protection, .gemini/skills/validating-csrf-protection, .github/skills/validating-csrf-protection and .opencode/skills/validating-csrf-protection in your project.

What does Validating Csrf Protection need to run?

Going by SKILL.md and its folder, Validating Csrf Protection needs Python for the scripts in its folder. Our summary lists: Python 3. Its frontmatter pre-approves these tools: Read, Write, Edit, Grep, Glob, Bash(security:*), Bash(scan:*), Bash(audit:*). Compatibility (from SKILL.md): Designed for Claude Code.

Does Validating Csrf Protection access the network?

SKILL.md names 4 domains. As links in the text: cheatsheetseries.owasp.org, cwe.mitre.org, web.dev and owasp.org. This is read from the text; nothing was executed.

Is Validating Csrf Protection safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Validating Csrf Protection use?

Validating Csrf Protection is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Validating Csrf Protection use?

About 1.8k tokens (SKILL.md is roughly 7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 17 tokens, read only when the agent opens those files.

What are the alternatives to Validating Csrf Protection?

Skills that share tags, products or a category with Validating Csrf Protection: Security And Hardening (penpot/penpot, 61k stars), Security Auditor (eigent-ai/eigent, 15k stars), Security Review (jewbetcha/opentrace, 116 stars) and Strix Code Vulnerability Scan (usestrix/strix, 68k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Validating Csrf Protection?

jeremylongshore (a GitHub user) maintains it in jeremylongshore/tons-of-skills-marketplace, which has 2,827 GitHub stars. The repository holds 3,342 skills in this directory. The repository was last updated on October 10, 2026.

Source: jeremylongshore/tons-of-skills-marketplace on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.