Elestia Open Source Ratings
6.1

csrf-csrf

Reasonable, with limits. 8th of 10 web security libraries.

csrf-csrf is a small Express middleware for stateless CSRF protection with the signed double-submit cookie pattern. It is one of the main maintained replacements for the deprecated csurf. It does a narrow job well, but one maintainer releases it rarely, and it ties you to Express and cookie-parser.

Best for: Express apps without server sessions, such as SPA backends, that need a maintained replacement for csurf.

GitHubnpm

Scores

Overall6.1

How strongly do we recommend it for a new project today?

Claude Opus 5.5: 5.5, likely 4.5 to 6.5

For Express apps that need stateless CSRF tokens, it is a sound choice and one of the few maintained ones. Its design fixes the main weakness of csurf. Slow work by one maintainer, the Express-only scope and little outside validation keep it in the reasonable-with-limits band. Many new apps can rely on SameSite cookies or the protection built into their framework instead.

GPT-6.2 Sol: 6.6, likely 5.3 to 7.8

It is a reasonable choice for new Express apps that specifically need stateless, cookie-based CSRF tokens. Sparse releases and unresolved Express 5 typing temper that recommendation. Helmet and DOMPurify have much stronger maintenance and adoption signals for their respective security jobs. Future Express compatibility work and wider production experience could change how confidently teams can choose it.

Needed by many3.4

How many developers need a tool for this job?

Claude Opus 5.5: 3.5, likely 2.5 to 5.0

CSRF protection matters only for apps that authenticate with cookies, and this package serves only Express. SameSite cookies and framework-built protection cover many apps without it. That makes it a clear niche next to helmet, cors or rate limiting.

GPT-6.2 Sol: 3.3, likely 2.2 to 4.5

Express is widely used, and browser apps that authenticate with cookies need CSRF protection. This package serves the subset that needs stateless tokens. Surveys measure Express usage, leaving the size of that subset uncertain.

Helps a lot6.6

How well does it do the job for those who need it?

Claude Opus 5.5: 6.0, likely 5.0 to 7.5

Version 4 signs tokens with HMAC and binds them to a session identifier, which fixes the known weakness of naive double-submit cookies. It has types, configurable options and good warnings in the docs. Limits: it is Express-only, it depends on cookie-parser order, and it has rough edges such as the Express 5 types issue and a report of a missing http-errors package. Developers also often misconfigure getSessionIdentifier.

GPT-6.2 Sol: 7.2, likely 6.0 to 8.3

Version 4.1.0 implements OWASP's signed, session-bound pattern and adds timing-safe token comparison. The reference covers token delivery and configurable errors, but developers have reported confusion over setup and an Express 5 type mismatch. The current manifest still uses Express 4 types, and some examples that coding agents may find use the version 3 API. Independent performance and agent accuracy measurements are scarce.

Holds up over time4.7

Will it still be a good choice in two years?

Claude Opus 5.5: 4.5, likely 3.0 to 6.0

The project is not archived, and version 4.1.0 came out in November 2026. But it had only 3 commits in the last year, it has no GitHub releases, and the work rests mostly on one maintainer. Issues such as Express 5 type support stay open for months, and the v4 upgrade broke existing setups. Its domain is small and stable, so slow work hurts it less than it would a larger library.

GPT-6.2 Sol: 4.8, likely 3.3 to 6.3

The November hardening release followed a 17-month gap, and three commits in the past year put it well behind Helmet and express-rate-limit. The npm package has one listed maintainer, the Express 5 typing issue remains open, and the last major upgrade required new tokens. NestJS now offers built-in CSRF protection, and the timing of future Express compatibility work is uncertain.

Used widely3.9

How many use it, and is that growing?

Claude Opus 5.5: 4.5, likely 3.5 to 5.5

It has about 280k weekly downloads, and its yearly ratio of 4.18 is about the median of 4.1, so it holds its ground but does not gain. It has 217 dependent repositories, far below the tens of thousands of helmet or express-rate-limit, which suggests a few thousand projects choose it directly. It has almost no attention on Hacker News or Bluesky.

  • npm downloadsLast4Weeks: 1.13M now vs 270k a year ago, a ratio of 4.18 against a median of 4.1
  • dependents: 217 repos and 7 packages, low next to its peers
  • bluesky posts: 0 posts; the one HN match is about Gorilla/CSRF, not this project

GPT-6.2 Sol: 3.2, likely 2.0 to 4.5

Four-week downloads rose from 270,065 to 1.13 million, or 4.18×, just above the catalog's 4.1× baseline. The 217 indexed repositories and seven dependent packages point to modest direct use, and every peer with a repository count is ahead. Automated installs and incomplete repository coverage leave the actual number of projects uncertain.

  • npm.downloadsLast4Weeks, npm.downloadsSame4WeeksYearAgo, medianDownloadsRatio: Downloads grew just faster than the catalog baseline.
  • dependents: ecosyste.ms indexed 217 repositories and seven packages.
  • peers: The lowest reported peer repository count is 2,053.
  • github.stars, bluesky.posts: 197 stars and zero tracked Bluesky posts.
Vouched for4.5

Who stands behind it being good?

Claude Opus 5.5: 3.0, likely 2.0 to 4.5

Guides and the csrf-sync docs point to it as the stateless replacement for csurf, but no well-known company or framework backs it in public. Express itself does not name it. I found no independent audit or benchmark.

GPT-6.2 Sol: 6.0, likely 4.7 to 7.3

NestJS documents it as the token-based option for its Express adapter. Ride The Lightning shipped a migration from csurf, and another adopter reported a successful migration in the Express discussion. Independent package benchmarks and survey-based satisfaction data are scarce, so these reports establish practical use more clearly than comparative quality.

Safe7.2

How safe is it to depend on?

Claude Opus 5.5: 7.0, likely 5.5 to 8.0

It has one runtime dependency and an ISC licence on npm. Its one advisory was low severity, from 2022, and fixed. There is no Scorecard, the GitHub repo shows no licence field, and releases come mostly from one person, so the publishing process cannot be checked. Misconfiguration is the main risk for a security middleware.

  • advisories: 1 low-severity advisory in 2022, none in the last 24 months
  • npm dependencies: 1 runtime dependency
  • scorecard: No OpenSSF Scorecard data
  • npm license: ISC on npm; the GitHub licence field is null

GPT-6.2 Sol: 7.3, likely 5.9 to 8.5

The package has one direct runtime dependency and a permissive ISC license. Its only cataloged advisory was a low-severity cookie-name issue patched in 2.2.1, and version 4.1.0 hardened token comparison. One listed npm maintainer, a missing Scorecard and unverified release provenance leave uncertainty about publishing safeguards.

Good

  • It uses HMAC-signed tokens tied to a session identifier, which blocks the cookie-tossing weakness that hit csurf.
  • It has one runtime dependency and ships its own TypeScript types.
  • The README and FAQ are careful, with clear warnings about common mistakes such as reading the token from the cookie.
  • You can configure secret rotation, cookie options, ignored methods and error responses.

Bad

  • It works only with Express and needs cookie-parser registered in the right order.
  • Work is slow: 3 commits and one npm release in the last year, from mostly one maintainer.
  • Version 4 had breaking changes (the required getSessionIdentifier, a new token format), and Express 5 type support was still an open issue in 2026.
  • The repository has no OpenSSF Scorecard and no GitHub releases, so the publishing process is hard to check.

The numbers

npm downloads, 4 weeks
1.1M ×4.2 in a year
GitHub stars
197
Commits, 12 months
3
npm version
4.1.0 Nov 2026
Versions, 12 months
1
Advisories, 24 months
0 of 1 ever
OpenSSF Scorecard
None
Licence
ISC

Read on 21 November 2026 from GitHub (Psifi-Solutions/csrf-csrf), npm (csrf-csrf), OSV and the OpenSSF Scorecard.

Web security libraries

  1. 8.7DOMPurify
  2. 8.2Helmet
  3. 7.9express-rate-limit
  4. 7.6cors
  5. 7.4rate-limiter-flexible
  6. 7.0Upstash Ratelimit
  7. 6.8sanitize-html
  8. 6.1csrf-csrf
  9. 5.7Arcjet
  10. 5.0js-xss
Compare all 10 on six scores