Introducing The Sweep: OX’s New Live Security Research Series
Register Now
Breaking: The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Read the Report
Are you exposed? Connect your apps in minutes.
Scan your apps free

@cloudflare/workers-oauth-provider

Latest version: v1.4.0

Overview

Last scanned
25 Nov 2026
Published
25 Nov 2026
npm package Publisher: cf-ci-write, cf-npm-publish, dash_service_account, wrangler-publisher
1,901 Stars
147 Forks
10 Versions
5.0M Downloads
TypeScript Repo language

Scan summary

@cloudflare/workers-oauth-provider was last scanned on 25 Nov 2026 at version 1.4.0. Risk score 0 of 100. No malicious behavior was detected.

  • Releases: 10 versions; the latest 2 were published within 3 days (23–25 Nov 2026).
  • Findings: No rules fired in version 1.4.0.
  • Downloads: 5,042,091 downloads.

Versions

10 versions published
Versions and the rules that fired in each
VersionPublishedStatus
1.4.0 LATEST 25 Nov 2026 No rules fired
1.3.0 23 Nov 2026 No rules fired
1.2.4 22 Oct 2026 No rules fired
1.2.2 6 Oct 2026 Not shown
1.2.1 28 Sep 2026 Not shown

No rules fired in 1.4.0

Findings

Findings for v1.4.0. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.

The score describes 1.4.0; other versions have their own rules, not their own score.

Known vulnerabilities

2 CVEs · last 1 May 2025

0 CRITICAL 0 HIGH 2 MEDIUM 0 LOW

Versions

  • ≥ 0.0.5
  • < 0.0.5 2 MEDIUM

Vulnerabilities

  • CVE-2025-4144 Medium 1 May 2025 @cloudflare/workers-oauth-provider PKCE bypass via downgrade attack Fixed in 0.0.5
  • CVE-2025-4143 Medium 1 May 2025 @cloudflare/workers-oauth-provider missing validation of redirect_uri on authorize endpoint Fixed in 0.0.5

README

The publisher’s own README, as collected from the registry.

OAuth 2.1 Provider Framework for Cloudflare Workers

@cloudflare/workers-oauth-provider adds OAuth 2.1 authorization to HTTP APIs and remote MCP servers running on Cloudflare Workers.

Upgrading from 0.x, 1.0 or 1.1? Read the migration guide, which covers every change since 0.10 with code, or point your coding agent at skills/migrate-to-1.x/, which also ships in the npm package.

Install

npm install @cloudflare/workers-oauth-provider

The authorization server needs a KV namespace bound as OAUTH_KV, and the global_fetch_strictly_public compatibility flag if it accepts Client ID Metadata Documents.

Quick start

An MCP deployment has two roles. The authorization server signs users in and issues tokens. The resource server is your MCP endpoint: it accepts those tokens and checks them with the authorization server over a Service Binding.

// auth-server/index.ts
const authorizationServer = new OAuthAuthorizationServer<Env>({
  issuer: 'https://auth.example.com',
  resources: ['https://mcp.example.com/mcp'],
  scopesSupported: ['mcp:read', 'mcp:write', 'offline_access'], // everything this server can grant
  clientIdMetadataDocumentEnabled: true,
});

export default class AuthServer extends WorkerEntrypoint<Env> {
  fetch(request: Request) {
    // /authorize is yours: parseAuthRequest(), sign the user in and ask for consent, completeAuthorization().
    if (new URL(request.url).pathname === '/authorize') return authorize(request, this.env);
    return authorizationServer.fetch(request, this.env, this.ctx); // discovery, token, revocation
  }

  // Resource servers call this over their Service Binding.
  validateToken(resource: string, token: string) {
    return authorizationServer.validateToken(resource, token, this.env);
  }
}
// mcp-server/index.ts
export default new OAuthResourceServer<Env, AuthProps>({
  resourceMetadata: {
    resource: 'https://mcp.example.com/mcp',
    authorization_servers: ['https://auth.example.com'],
  },
  requiredScopes: ['mcp:read'], // needed for any access; clients request these first
  validateToken: (env) => env.AUTH_SERVER.validateToken,
  handler: {
    fetch(request, env, ctx) {
      // ctx.props: what completeAuthorization() stored. ctx.auth: the verified token.
      // Step-up: a 403 naming the missing scope, and the client re-authorizes for it.
      const needed = request.method === 'GET' ? ['mcp:read'] : ['mcp:read', 'mcp:write'];
      if (!needed.every((scope) => ctx.auth.scope.includes(scope))) return insufficientScope(ctx.auth, needed);
      return Response.json({ userId: ctx.props.userId });
    },
  },
});

examples/split-workers has both Workers in full, including the /authorize handler and wrangler.jsonc, with an end-to-end test that runs them in workerd.

The resource server publishes its RFC 9728 metadata, answers unauthenticated requests with a challenge pointing at it, and accepts only tokens issued for its own resource. The handler owns authorization beyond that: scopes, ownership, tenancy.

On the wire both lists are called scopes_supported, as the specs name them, but they mean different things: scopesSupported is everything the authorization server can grant; a resource's requiredScopes is what any access needs, so MCP clients request it first, and more comes by step-up. The handler checks ctx.auth.scope: the library advertises the required scopes but doesn't enforce them, since only your code knows which scopes imply others. See Scopes.

One Worker: OAuthProvider

The split roles above are the recommended shape. OAuthProvider remains fully supported for one Worker that is both the authorization server and its only resource, which was the 0.x shape: it combines the roles. Requests under apiRoute reach apiHandler with ctx.props and ctx.auth; everything else goes to defaultHandler, which owns /authorize and reaches the helpers as env.OAUTH_PROVIDER:

export default new OAuthProvider<Env>({
  apiRoute: '/mcp',
  apiHandler: McpApiHandler,
  defaultHandler, // your /authorize page
  authorizeEndpoint: '/authorize',
  tokenEndpoint: '/oauth/token',
  scopesSupported: ['mcp:read', 'mcp:write', 'offline_access'], // everything this server can grant
  resourceMetadata: {
    resource: 'https://mcp.example.com/mcp',
    authorization_servers: ['https://mcp.example.com'],
  },
  requiredScopes: ['mcp:read'], // needed for any access; clients request these first
  clientIdMetadataDocumentEnabled: true,
});

Documentation

  • Resource servers: more resources, both roles in one Worker, what the handler sees, other issuers.
  • Consent page: what it must show, Allow and Deny, remembering consent.
  • Signing in through another provider: GitHub, Google and friends as the identity step.
  • Authorization server reference: the authorize endpoint, client registration (pre-registered, CIMD, DCR), PKCE and token lifetimes, resources and audiences, scopes, KV storage, every option.
  • MCP authorization discovery: how a client gets from a 401 to your authorization server.
  • Advanced configuration: external tokens, token exchange, tokenExchangeCallback, onError, Enterprise-Managed Authorization (experimental).
  • Storage schema: the KV layout. Tokens, codes and secrets are stored only as hashes; props are encrypted with a key only the token holder can unwrap.

Standards

MCP authorization 2026-07-28, OAuth 2.1, and RFCs 6750, 7009, 7591, 7636, 8414, 8693, 8707, 9207 and 9728, plus Client ID Metadata Documents, OpenID Connect RP Metadata Choices and, experimentally, MCP Enterprise-Managed Authorization.

Development

Node 24 or newer. npm install, npm run build, npm run check. Changes that affect behavior or the public API need a Changeset; see AGENTS.md for conventions, SECURITY.md for vulnerability reporting, and HISTORY.md for how the library began.

OX Radar and Response Center

Find threats in your stack.

OX Radar can check high-priority threats, like critical package CVEs, against your context.

Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.

Where it’s listed

The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).

  • npm @cloudflare/workers-oauth-provider

References

The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.

Powered by Read the latest findings

Scan your whole stack

Group 1261154050 1
Group 1261154050
 

From OX Research Newsroom

Copy of Template Design OX Blog (3)
Research

Ruby2Shell: Ruby Memory Corruption Flaws Expose Applications to Remote Code Execution, But is it an Actual Risk?

Critical Apache HTTP Server Flaw Exposes Web Servers to RCE (1)
CVE

CVE-2026-119618: Critical Apache HTTP Server Flaw Exposes Web Servers to Remote Code Execution

Copy of Template Design OX Blog (2)
Research

NGINX2Root: Five Critical NGINX Flaws Expose Web Servers to Remote Code Execution

Frame 2085668439 (1)
Group 1261154229