Elestia Open Source Ratings
7.6

cors

A strong pick. 4th of 10 web security libraries.

cors is the official Express/Connect middleware that sets CORS headers. It is small and stable, has no known advisories, and is still the standard pick for Express apps. It changes very rarely, ships no built-in types and does not fit Fetch-based frameworks.

Best for: Express or Connect APIs that a browser front end on another origin must call.

GitHubnpm

Scores

Overall7.6

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

Claude Opus 5.5: 7.0, likely 6.0 to 8.0

For Express apps it is the clear default for CORS: safe, tiny, correct and used everywhere. It loses points for very slow development, missing bundled types, an old callback API and a narrow scope tied to Express. Teams on Fastify, Hono or Next.js should use their framework's own CORS support.

GPT-6.2 Sol: 8.1, likely 7.0 to 9.0

cors is a strong pick for a new Express API that needs browser cross-origin access. It handles the common policies with little setup, and its downstream integrations give confidence in the API. The slow patch cadence and known documentation gaps keep it below the top tier. In the wider category, Helmet covers other security headers and DOMPurify covers HTML sanitization.

Needed by many5.3

How many developers need a tool for this job?

Claude Opus 5.5: 5.5, likely 4.5 to 6.5

Any API that a browser calls from another origin needs CORS, and many backend developers face that. But this package serves only Express/Connect-style Node servers. It also covers one slice of the category's job: headers, not rate limits or HTML sanitizing.

GPT-6.2 Sol: 5.0, likely 3.8 to 6.2

Cross-origin browser access is common when a frontend and API are hosted separately. Express leads backend framework usage in State of JavaScript 2025, but this package serves Node.js middleware stacks and frameworks such as Fastify and Hono have their own options. The survey measures framework use, so the share of projects that need this package remains uncertain.

Helps a lot7.5

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

Claude Opus 5.5: 7.0, likely 6.0 to 8.0

It does its narrow job correctly and simply. It has flexible origin matching, per-request options and solid preflight handling, and its docs are now much better. Limits: no built-in types, a callback-only async origin, no Fetch/Request support, and a permissive mode that is easy to misuse.

GPT-6.2 Sol: 8.0, likely 6.8 to 9.0

Version 2.8.6 covers preflights, credentials, and static or dynamic origin policies with a small API. TypeScript needs separate declarations, and the outdated catch-all example is a trap for developers and coding agents using Express 5. Open cache-header reports and limited package-specific performance measurements leave room for uncertainty.

Holds up over time6.9

Will it still be a good choice in two years?

Claude Opus 5.5: 6.5, likely 5.5 to 7.5

It is feature-complete and sits under the Express technical committee at the OpenJS Foundation, which had renewed security work in 2026. But activity is low: 10 commits and one release in a year, the first release since 2018, and 36 open PRs. The newer frameworks ship their own CORS tools.

GPT-6.2 Sol: 7.3, likely 5.9 to 8.6

The January 2026 patch refreshed CI and documentation, had two reviewers, and links to the Express funding collective. The snapshot shows ten commits and one release over the year, well below Helmet and express-rate-limit in commit activity, and several older issues remain open. The established API helps, but the backlog makes the pace of future fixes uncertain.

Used widely8.9

How many use it, and is that growing?

Claude Opus 5.5: 9.0, likely 8.0 to 9.5

It has 935k dependent repos, the most in the category by far, and about 500M downloads every 4 weeks. Downloads grew 5.1x in a year, above the 4.1 median. Packages such as engine.io and Apollo Server pull it in, which inflates the downloads, but the dependents count still shows direct use on a huge scale.

  • dependents repos: 935,233 repos, against Helmet's 128,887
  • npm downloadsLast4Weeks: 498.8M now vs 97.4M a year ago (ratio 5.1)
  • engine.io and @apollo/server dependencies: Transitive installs inflate downloads

GPT-6.2 Sol: 8.8, likely 7.7 to 9.8

Ecosyste.ms found 935,233 dependent repositories, over seven times Helmet's count, and 13,273 dependent packages. Four-week downloads rose from 97 million to 499 million, about 5.1× against the catalog median of 4.1×, which suggests a gain in install share. Framework dependencies, repeated CI installs, and sparse recent social discussion make the number of new direct choices harder to pin down.

  • dependents.repos, dependents.packages, peers: The observed dependent repository count leads the peer group by a wide margin.
  • npm.downloadsLast4Weeks, npm.downloadsSame4WeeksYearAgo, medianDownloadsRatio: Download growth was about 5.1× against a 4.1× median.
  • github.com/socketio/socket.io/blob/main/packages/engine.io/package.json: Socket.IO's Engine.IO lists cors as a runtime dependency.
  • github.stars, bluesky.posts, hackerNews.stories: 6,197 stars, one recent Bluesky post, and no matched Hacker News stories.
Vouched for7.6

Who stands behind it being good?

Claude Opus 5.5: 7.0, likely 6.0 to 8.0

It is the official Express middleware, recommended in the Express docs, and major projects such as socket.io's engine.io and Apollo Server build on it. No survey covers it. Beyond comparison listings there are few independent write-ups, and it gets little discussion on Hacker News or Bluesky.

GPT-6.2 Sol: 8.2, likely 7.0 to 9.1

NestJS, Firebase Functions, and Socket.IO each rely on cors for cross-origin handling in their server stacks. Those integrations provide independent evidence that the middleware works in widely used systems. Recent package-specific satisfaction surveys and standalone benchmarks are sparse, which keeps the range wider.

Safe8.3

How safe is it to depend on?

Claude Opus 5.5: 8.5, likely 7.5 to 9.0

There are no advisories in 13 years, only two tiny dependencies (vary, object-assign), and an MIT licence. Releases come from the Express team, which added CodeQL and Scorecard in 2026. The main risk is misconfiguration by users (origin reflection with credentials), not a flaw in the code. The bundle has no Scorecard result to confirm the details.

GPT-6.2 Sol: 8.0, likely 6.7 to 9.2

The MIT-licensed package has two direct runtime dependencies, zero advisories in the OSV snapshot, and a private reporting process through Express. Express's January OpenSSF report scored an earlier commit 7.5 out of 10, and GitHub verifies the 2.8.6 release commit. The current Scorecard and npm publishing permissions remain unverified, and teams must configure allowed origins carefully when enabling credentials.

Good

  • Covers the usual CORS needs with one call: origin as a string, RegExp, array or function, plus credentials, preflight handling and maxAge.
  • No advisories in its history, only two small dependencies, and an MIT licence.
  • Maintained under the Express project at the OpenJS Foundation, and so widely used that AI agents and tutorials get it right.
  • The 2026 release added CodeQL, Scorecard reporting, current Node CI and much better docs, including per-request config and an FAQ.

Bad

  • No bundled TypeScript types; you need @types/cors from DefinitelyTyped.
  • The dynamic origin option takes a callback, not a Promise, and the API has not changed since 2018.
  • Setting origin: true with credentials: true reflects any origin, which is a common security misconfiguration.
  • It only fits Express/Connect-style servers. Fastify, Koa, Hono and Next.js need their own CORS tools.

The numbers

npm downloads, 4 weeks
499M ×5.1 in a year
GitHub stars
6.2k
Commits, 12 months
10
npm version
2.8.6 Jan 2026
Versions, 12 months
1
Advisories, 24 months
0 of 0 ever
OpenSSF Scorecard
None
Licence
MIT

Read on 21 November 2026 from GitHub (expressjs/cors), npm (cors), 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