Skip to main content
Skip to Content
interlace
Plugin: mcp-sdk-securityRules

no-unchecked-authorization-url

Disallow an MCP OAuth client opening the server-supplied authorization URL with no scheme allowlist.

Next step

no-unchecked-authorization-url ships in eslint-plugin-mcp-sdk-security, with 16 of its 16 rules in the recommended preset.

Install
npm install -D eslint-plugin-mcp-sdk-security
eslint.config.js
import { configs } from 'eslint-plugin-mcp-sdk-security';

export default [configs.recommended];

Plugin pagenpmSource on GitHub

CWE: CWE-78 OWASP: A03:2021 – Injection

Detects an OAuthClientProvider's redirectToAuthorization(authorizationUrl) passing that URL to open(), a child_process call or electron's shell.openExternal with no check of its scheme. This rule is part of eslint-plugin-mcp-sdk-security.

💼 This rule is set to error in the recommended and strict configs.

Quick Summary

AspectDetails
CWE ReferenceCWE-78 (OS Command Injection)
SeverityCritical (CVSS 9.6)
Auto-Fix❌ No auto-fix available
CategorySecurity

Why this matters

When an MCP server needs OAuth, the SDK reads the server's authorization metadata and calls the client's redirectToAuthorization(authorizationUrl) with the authorization_endpoint it found there. The server chooses that string. A client that opens it in the browser with open() hands it to the operating system's URL launcher (start / PowerShell on Windows, xdg-open on Linux), so a malicious server that answers with a crafted URL runs a command on the client's host.

This is CVE-2025-6514: mcp-remote up to 0.1.14 did exactly this.

❌ Incorrect

import { OAuthClientProvider } from '@modelcontextprotocol/sdk/client/auth.js';
import open from 'open';

class NodeOAuthClientProvider implements OAuthClientProvider {
  async redirectToAuthorization(authorizationUrl: URL) {
    // ❌ the server's URL reaches the OS launcher unchecked
    await open(authorizationUrl.toString());
    // ❌ the same through a process or electron
    exec(`xdg-open ${authorizationUrl}`);
    shell.openExternal(authorizationUrl.href);
  }
}

✅ Correct

class NodeOAuthClientProvider implements OAuthClientProvider {
  async redirectToAuthorization(authorizationUrl: URL) {
    const url = new URL(authorizationUrl);
    if (url.protocol !== 'https:' && url.protocol !== 'http:')
      throw new Error(`Refusing to open ${url.protocol} URL`);
    await open(url.href);
  }
}

How it decides

  • The method is any class method or object property keyed redirectToAuthorization, in a file that imports an MCP package. Its first parameter is the URL, whatever it is called.
  • The URL's forms are the parameter, .href, .toString(), String(url), new URL(url), a template or + concatenation containing one of them, and a same-file const bound to one of them.
  • The sinks are resolved through imports and require, never by name: the open package, child_process's exec, execSync, execFile, execFileSync, spawn, spawnSync and fork (any argument, including an array element), and electron's shell.openExternal.
  • A check is a scheme allowlist on the URL anywhere in the method: url.protocol compared with a string, ALLOWED.has(url.protocol) / .includes(url.protocol), s.startsWith('https://'), or a regex literal's .test(s). One check clears the method; the rule does not prove the check runs before the sink.

What this rule deliberately does not report

  • The URL passed through another call (open(sanitizeUrl(url))). The rule cannot see how complete a sanitizer is, so it abstains. mcp-remote 0.1.15 added a scheme check inside sanitizeUrl and was still vulnerable, because the URL's username and password were left unencoded (fixed in 0.1.16). That kind of gap needs a review of the sanitizer, not a lint rule.
  • A let binding, a destructured value or a value from another module.
  • A file that imports no MCP package.

When Not To Use It

There is no configuration in which opening a URL a remote server chose, with no scheme check, is safe, so this rule has no options.

Further Reading

Use this rule

npm install -D eslint-plugin-mcp-sdk-security
eslint.config.js
import mcpSdkSecurity from 'eslint-plugin-mcp-sdk-security';export default [  {    plugins: { 'mcp-sdk-security': mcpSdkSecurity },    rules: {      'mcp-sdk-security/no-unchecked-authorization-url': 'error'    },  },];
npm install -D oxlint-plugin-mcp-sdk-security
.oxlintrc.json
{  "jsPlugins": ["oxlint-plugin-mcp-sdk-security"],  "rules": {    "mcp-sdk-security/no-unchecked-authorization-url": "error"  }}
vite.config.ts
import { defineConfig } from 'vite-plus';export default defineConfig({  lint: {    jsPlugins: ['oxlint-plugin-mcp-sdk-security'],    rules: {      'mcp-sdk-security/no-unchecked-authorization-url': 'error',    },  },});

oxlint-plugin-mcp-sdk-security re-exports eslint-plugin-mcp-sdk-security/oxlint: the same rules under the same IDs, and no ESLint install. Why oxlint.

Did this rule catch something? Star the repo to get new CWE coverage as we ship it — or follow the AI-code-security benchmarks behind these rules.