Free CSRF Protection Checker

Free CSRF Protection Checker

Free tool

Checks for anti-CSRF tokens and SameSite cookie posture on state-changing endpoints, so attackers can't forge requests from another site.

  • Anti-CSRF tokens
  • SameSite strategy
  • Safe methods
No credit card requiredProduction-safe (100% passive)No setup or code required
Used by 5,000+ developers and engineering teams
Oracle logoShopify logoGoDaddy logoChubb logoToshiba logoMAPFRE logoBelfius logoHolcim logo

A scan shows the surface. A pentest proves what gets in.

Passive scan

  • Reads what your app already exposes
  • Never logs in or submits a form
  • Cannot confirm what is exploitable

Active AI pentest

  • Attacks your app like a real hacker
  • Chains requests to confirm real exploits
  • Reproduces every finding as proof

Probes for

  • SQL injection
  • Broken access control
  • IDOR
  • SSRF
  • Business-logic abuse

See a sample pentest report

Free to start, no call required. Every report is reviewed by our security team.

How to fix common failures

  • Require tokens on POST/PUT/PATCH/DELETE and verify them server-side
  • Use per-request tokens or double-submit with robust secrets
  • Prefer SameSite=Lax by default, and use None+Secure only when needed

What this checker validates

  • Presence of anti-CSRF tokens on state-changing endpoints
  • SameSite cookie posture aligned with cross-site needs

Implementation examples

Once you've identified the gap, applying the fix is straightforward. Here are the three configurations developers reach for most often.

Nginx

# Harden cookies passing through the proxy so the browser
# refuses to send them on cross-site POSTs (nginx 1.19.3+).
proxy_cookie_flags ~ secure httponly samesite=lax;

# Token validation itself belongs in the application, not the proxy.

Apache

# Force SameSite + Secure on session cookies.
Header edit Set-Cookie ^(.*)$ "$1; SameSite=Lax; Secure; HttpOnly"

# Reject state-changing requests whose Origin is not ours.
RewriteEngine On
RewriteCond %{REQUEST_METHOD} ^(POST|PUT|PATCH|DELETE)$
RewriteCond %{HTTP:Origin} !^$
RewriteCond %{HTTP:Origin} !^https://example\.com$ [NC]
RewriteRule .* - [F]

Node.js (Express)

import express from "express"
import session from "express-session"

const app = express()

// Fail fast if the session secret is not configured.
const sessionSecret = process.env.SESSION_SECRET
if (!sessionSecret) throw new Error("SESSION_SECRET must be set")

// Without this, secure cookies are dropped when TLS terminates
// at a reverse proxy or load balancer in front of the app.
app.set("trust proxy", 1)

app.use(
  session({
    secret: sessionSecret,
    resave: false,
    saveUninitialized: false,
    cookie: { sameSite: "lax", secure: true, httpOnly: true },
  })
)

// Reject state-changing requests unless we can confirm a same-origin
// source. Fail closed: a missing Origin/Referer is treated as untrusted.
const ALLOWED_ORIGIN = "https://example.com"
function isSameOrigin(req) {
  // Origin is exact; compare it directly (no prefix matching, so
  // https://example.com.evil.com cannot slip through).
  if (req.headers.origin) return req.headers.origin === ALLOWED_ORIGIN
  // Fall back to Referer, comparing only its origin part.
  if (req.headers.referer) {
    try {
      return new URL(req.headers.referer).origin === ALLOWED_ORIGIN
    } catch {
      return false
    }
  }
  return false
}
app.use((req, res, next) => {
  if (["POST", "PUT", "PATCH", "DELETE"].includes(req.method) && !isSameOrigin(req)) {
    return res.sendStatus(403)
  }
  next()
})

// For per-request tokens on top of this, use a maintained library
// such as csrf-csrf. Avoid csurf - it is deprecated.

Tool-specific questions

Do I still need tokens with SameSite?

Yes. SameSite reduces cross-site cookie sending but tokens remain the primary defense for CSRF.

Should APIs use cookies or Authorization headers?

For browser apps, prefer HttpOnly Secure cookies with CSRF protections. For non-browser clients, use Authorization with CORS controls.
Why Barrion

Built for the engineers who already have enough to fix.

Speed

Real-time results

Instant analysis with a detailed report. You see findings as the scan runs, not after.
Coverage

Comprehensive checks

35+ checks per scan covering TLS, headers, CORS, cookies, DNS, email auth, and more, in a single pass.
Action

Step-by-step fixes

Every finding ships with the exact remediation step for your framework. Hand it to the engineer who owns the surface.
FAQ

Frequently asked.

What is Barrion and how does it enhance website security?
Barrion is a security testing and monitoring platform for engineering teams, and it works in three ways. Passive scanning keeps a continuous, read-only watch over your live web apps and APIs. Codebase scanning connects to GitHub and checks your code for hard-coded secrets, insecure patterns and vulnerable dependencies. AI pentesting goes on the offensive, running agent-driven attacks that prove which vulnerabilities are genuinely exploitable. Every finding comes with a step-by-step fix you can ship right away.
How safe is Barrion to use for security testing?
Passive scanning and codebase scanning are completely safe to run, including against production. Passive scans only read your live app, so we never submit forms, brute-force endpoints or touch anything that changes state, and codebase scanning just reads your repository. AI pentesting is more aggressive by design, since its job is to confirm real exploits, so it runs rate-limited and non-destructive, and you approve the exact scope before a single request is sent.
What types of security issues does Barrion identify?
It depends on the surface. On your live apps, Barrion catches misconfigurations across TLS and HTTPS, security headers, cookie flags, CORS policy, DNS records, email authentication (SPF, DKIM, DMARC), network exposure and the usual web hygiene gaps. In your codebase it finds secrets committed to the repo, insecure code patterns and vulnerable dependencies. AI pentesting surfaces the exploitable stuff, like SQL injection, cross-site scripting and broken access control, each one backed by proof it can actually be exploited.
What specific security checks does Barrion perform?
For live apps it checks TLS and HTTPS configuration, HTTP security headers, cookie flags, CORS policy, DNS and email authentication records, network exposure and common web hygiene issues. In your codebase it looks for hard-coded secrets, insecure patterns and vulnerable dependencies. AI pentesting takes it further by actively chaining requests to confirm exploitable flaws. Whatever the source, findings are ranked by severity and come with clear, step-by-step remediation.
What is Barrion's smart crawling?
Smart crawling automatically discovers the pages and endpoints of your app so scans cover the surface that matters, without you manually listing every URL.
How often does Barrion perform security scans?
You can run a scan manually whenever you want. Continuous monitoring of your live apps runs on its own (weekly and up on Essential, daily on Business), codebase scans can fire on every commit or pull request, and we alert you the moment something new shows up.
Is Barrion suitable for security testing of all business sizes?
Yes. Live-app monitoring, codebase scanning through GitHub and AI pentesting all work just as well for a solo developer as for a startup, a scale-up or an enterprise security team, without adding headcount.
How does Barrion handle data security and privacy during security testing?
Live-app and codebase scans are read-only by default, and we never store or expose sensitive data from your application. AI pentests are rate-limited and non-destructive, built to confirm whether something is exploitable without altering your data or affecting availability.
What if I'm not satisfied with Barrion's security testing service?
Paid plans start with a free trial, and you can cancel anytime. If something isn't right, contact us and we'll make it work for your team.
How does Barrion help with SOC 2, ISO 27001, NIS2, and other compliance frameworks?
Barrion produces audit-ready PDF and CSV reports suitable for SOC 2, ISO 27001, PCI DSS and NIS2, ready to share with auditors, customers and your board.

Anything else? Email contact@barrion.io.

Keep it covered

Fix it once, then watch it stay fixed.

A pentest proves what is exploitable today. Continuous monitoring re-checks this tool's results on a schedule and alerts you the moment a deploy undoes the fix.

What you get for free

18 core security checks via this tool, passive scans, step-by-step remediation, security score on every result.

What Essential adds at $39/mo

+17 advanced checks, continuous monitoring, daily security score history, email alerts, GitHub SAST, board-ready PDFs, SOC 2 / ISO 27001 / PCI reports.