MCP Scanner
ScanLeaderboardDocsSign in
Home/upstash/context7/Results
38F

context7

upstash/context7

98 files · 24 findings

Share GitHub SARIF JSON
2 critical15 high7 medium
Tool Poisoningclean
Command Injection2 issues
Path Traversal6 issues
SSRF10 issues
Credential Theft1 issue
Excessive Permissions5 issues
Missing Authclean
Command Injection2

child_process import with unsanitized usage

high

Direct usage of child_process module methods with variable arguments may allow command injection.

.github/workflows/changeset-check.yml:21
const { execSync } = require('child_process');
How to fix

Use execFile with explicit argument arrays instead of child_process with string commands.

SSRF10

Request to localhost or loopback address

high

Requests targeting 127.0.0.1, localhost, or [::1] may access internal services not intended to be exposed.

packages/cli/src/commands/auth.ts:59
const redirectUri = `http://localhost:${port}/callback`;
How to fix

Block requests to localhost and loopback addresses. Implement URL validation that rejects 127.x.x.x and ::1.

Excessive Permissions5

sudo command usage

high

Using sudo in scripts escalates privileges and may allow unintended system-wide modifications.

packages/cli/src/commands/generate.ts:537
console.log(pc.dim(`  sudo chown -R $(whoami) "${parentDir}"`));
How to fix

Remove sudo usage. Run processes with the minimum required privileges.

Path Traversal6

fs operations without path sanitization

medium

File system operations using variables without prior path validation or sanitization may allow traversal attacks.

packages/cli/src/utils/auth.ts:36
fs.mkdirSync(CONFIG_DIR, { recursive: true, mode: 0o700 });
How to fix

Add path sanitization before all fs operations. Validate paths against an allowlist of permitted directories.

Credential Theft1

Base64 encoding of sensitive data

high

Encoding environment variables or credential file contents to Base64 is a common exfiltration obfuscation technique.

packages/mcp/src/lib/encryption.ts:21
const cipher = createCipheriv(ALGORITHM, Buffer.from(ENCRYPTION_KEY, "hex"), iv);
How to fix

Remove Base64 encoding of credentials. If encoding is needed, use a proper encryption library.

Supply Chain
clean
Rug Pullclean

child_process import with unsanitized usage

high

Direct usage of child_process module methods with variable arguments may allow command injection.

packages/cli/src/commands/generate.ts:7
import { spawn } from "child_process";
How to fix

Use execFile with explicit argument arrays instead of child_process with string commands.

Request to localhost or loopback address

high

Requests targeting 127.0.0.1, localhost, or [::1] may access internal services not intended to be exposed.

packages/cli/src/utils/auth.ts:105
const url = new URL(req.url || "/", `http://localhost`);
How to fix

Block requests to localhost and loopback addresses. Implement URL validation that rejects 127.x.x.x and ::1.

URL construction from user input

medium

Building URLs by concatenating or interpolating user input without an allowlist check enables SSRF via host manipulation.

packages/cli/src/utils/auth.ts:259
const url = new URL(`${baseUrl}/api/oauth/authorize`);
How to fix

Do not construct URLs from unvalidated user input. Use a URL allowlist or domain restriction.

HTTP request with unvalidated URL parameter

high

Passing user-controlled variables directly to fetch, axios, or http.get without URL validation enables SSRF attacks.

packages/cli/src/utils/github.ts:95
const treeResponse = await fetch(treeUrl, {
How to fix

Validate and sanitize all URLs before making HTTP requests. Use an allowlist of permitted domains.

HTTP request with unvalidated URL parameter

high

Passing user-controlled variables directly to fetch, axios, or http.get without URL validation enables SSRF attacks.

packages/cli/src/utils/github.ts:119
const fileResponse = await fetch(rawUrl);
How to fix

Validate and sanitize all URLs before making HTTP requests. Use an allowlist of permitted domains.

HTTP request with unvalidated URL parameter

high

Passing user-controlled variables directly to fetch, axios, or http.get without URL validation enables SSRF attacks.

packages/mcp/src/lib/api.ts:75
const response = await fetch(url, { headers });
How to fix

Validate and sanitize all URLs before making HTTP requests. Use an allowlist of permitted domains.

HTTP request with unvalidated URL parameter

high

Passing user-controlled variables directly to fetch, axios, or http.get without URL validation enables SSRF attacks.

packages/mcp/src/lib/api.ts:107
const response = await fetch(url, { headers });
How to fix

Validate and sanitize all URLs before making HTTP requests. Use an allowlist of permitted domains.

URL construction from user input

medium

Building URLs by concatenating or interpolating user input without an allowlist check enables SSRF via host manipulation.

packages/mcp/src/lib/api.ts:69
const url = new URL(`${CONTEXT7_API_BASE_URL}/v2/libs/search`);
How to fix

Do not construct URLs from unvalidated user input. Use a URL allowlist or domain restriction.

URL construction from user input

medium

Building URLs by concatenating or interpolating user input without an allowlist check enables SSRF via host manipulation.

packages/mcp/src/lib/api.ts:101
const url = new URL(`${CONTEXT7_API_BASE_URL}/v2/context`);
How to fix

Do not construct URLs from unvalidated user input. Use a URL allowlist or domain restriction.

HTTP request with unvalidated URL parameter

high

Passing user-controlled variables directly to fetch, axios, or http.get without URL validation enables SSRF attacks.

packages/sdk/src/http/index.ts:155
res = await fetch(url, requestOptions as RequestInit);
How to fix

Validate and sanitize all URLs before making HTTP requests. Use an allowlist of permitted domains.

sudo command usage

high

Using sudo in scripts escalates privileges and may allow unintended system-wide modifications.

packages/cli/src/commands/skill.ts:415
log.dim(`  sudo chown -R $(whoami) "${parentDir}"`);
How to fix

Remove sudo usage. Run processes with the minimum required privileges.

sudo command usage

high

Using sudo in scripts escalates privileges and may allow unintended system-wide modifications.

packages/cli/src/commands/skill.ts:592
log.dim(`  sudo chown -R $(whoami) "${parentDir}"`);
How to fix

Remove sudo usage. Run processes with the minimum required privileges.

sudo command usage

high

Using sudo in scripts escalates privileges and may allow unintended system-wide modifications.

packages/cli/src/commands/skill.ts:690
log.error(`Permission denied. Try: sudo rm -rf "${skillPath}"`);
How to fix

Remove sudo usage. Run processes with the minimum required privileges.

sudo command usage

high

Using sudo in scripts escalates privileges and may allow unintended system-wide modifications.

packages/cli/src/commands/skill.ts:932
log.dim(`  sudo chown -R $(whoami) "${parentDir}"`);
How to fix

Remove sudo usage. Run processes with the minimum required privileges.

fs operations without path sanitization

medium

File system operations using variables without prior path validation or sanitization may allow traversal attacks.

packages/cli/src/utils/auth.ts:47
fs.writeFileSync(CREDENTIALS_FILE, JSON.stringify(data, null, 2), { mode: 0o600 });
How to fix

Add path sanitization before all fs operations. Validate paths against an allowlist of permitted directories.

fs operations without path sanitization

medium

File system operations using variables without prior path validation or sanitization may allow traversal attacks.

packages/cli/src/utils/auth.ts:55
const data = JSON.parse(fs.readFileSync(CREDENTIALS_FILE, "utf-8"));
How to fix

Add path sanitization before all fs operations. Validate paths against an allowlist of permitted directories.

fs operations without path sanitization

medium

File system operations using variables without prior path validation or sanitization may allow traversal attacks.

packages/cli/src/utils/auth.ts:64
fs.unlinkSync(CREDENTIALS_FILE);
How to fix

Add path sanitization before all fs operations. Validate paths against an allowlist of permitted directories.

Directory traversal sequence targeting sensitive files

critical

Paths containing '../' sequences targeting sensitive system files (etc/passwd, .ssh, .env) can escape intended directories.

packages/sdk/vitest.config.ts:5
dotenv.config({ path: path.resolve(__dirname, "../../.env") });
How to fix

Validate and sanitize file paths. Use path.resolve() with a base directory and verify the result stays within the allowed root.

Directory traversal sequence targeting sensitive files

critical

Paths containing '../' sequences targeting sensitive system files (etc/passwd, .ssh, .env) can escape intended directories.

packages/tools-ai-sdk/vitest.config.ts:5
config({ path: path.resolve(__dirname, "../../.env") });
How to fix

Validate and sanitize file paths. Use path.resolve() with a base directory and verify the result stays within the allowed root.