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.
npm install -D eslint-plugin-mcp-sdk-securityimport { configs } from 'eslint-plugin-mcp-sdk-security';
export default [configs.recommended];
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
| Aspect | Details |
|---|---|
| CWE Reference | CWE-78 (OS Command Injection) |
| Severity | Critical (CVSS 9.6) |
| Auto-Fix | ❌ No auto-fix available |
| Category | Security |
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-fileconstbound to one of them. - The sinks are resolved through imports and
require, never by name: theopenpackage,child_process'sexec,execSync,execFile,execFileSync,spawn,spawnSyncandfork(any argument, including an array element), and electron'sshell.openExternal. - A check is a scheme allowlist on the URL anywhere in the method:
url.protocolcompared 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 insidesanitizeUrland 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
letbinding, 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-securityimport 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{ "jsPlugins": ["oxlint-plugin-mcp-sdk-security"], "rules": { "mcp-sdk-security/no-unchecked-authorization-url": "error" }}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.
no-tool-description-injection
Disallow MCP tool, prompt and resource descriptions built from text a client, a remote service or a file controls.
no-untrusted-stdio-command
Disallow an MCP client spawning a stdio server whose command comes from a tool argument, a network response or a project config file.