npx claudepluginhub jeremylongshore/claude-code-plugins-plus-skills --plugin csrf-protection-validatorThis skill is limited to using the following tools:
Validate Cross-Site Request Forgery protection across web application endpoints,
Detects CSRF vulnerabilities in HTML forms, session cookies, and middleware for Django, Flask, Express, Spring Boot, Go, and Rust web apps. Provides framework-specific fixes and verification steps.
Prevents CSRF attacks in web apps using SameSite cookies, csurf synchronizer tokens, double-submit cookies, and origin validation for Express/NestJS with cookie-based auth and state-changing endpoints.
Analyzes PHP code for CSRF vulnerabilities like missing tokens, state-changing GET requests, and token validation gaps. Use when auditing web app forms and APIs.
Share bugs, ideas, or general feedback.
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.
${CLAUDE_SKILL_DIR}/${CLAUDE_SKILL_DIR}/references/README.md for CSRF protection methods, OWASP CSRF Prevention Cheat Sheet, and framework-specific API examplesSecure and HttpOnly attributes, and the comparison is timing-safe to prevent token extraction.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.Origin header against an allowlist on state-changing requests. Flag implementations that fall back to no protection when the header is absent.Content-Type enforcement), and Flash/Silverlight crossdomain.xml files.csurf for Express, @csrf_protect for Django, csrf_meta_tags for Rails)| Error | Cause | Solution |
|---|---|---|
| No state-changing endpoints found | Unconventional routing patterns or SPA architecture | Check for client-side routing frameworks (React Router, Vue Router) and trace API calls from frontend code |
| CSRF middleware detected but not applied globally | Middleware applied per-route rather than globally | Verify every state-changing route has the middleware applied; flag gaps in coverage |
| Token generation source unclear | Framework abstracts CSRF token generation | Check framework documentation for default CSPRNG usage; inspect framework source if needed |
| SameSite attribute not set in code | Cookie attributes set at infrastructure layer | Check reverse proxy, load balancer, or CDN cookie rewriting rules |
| Mixed protection strategies | Different endpoints use different CSRF mechanisms | Document each strategy and verify consistency; recommend standardizing on one approach |
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.
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.
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).