MCP Scanner
ScanLeaderboardDocsSign in
Home/modelcontextprotocol/servers/Results
0F

servers

modelcontextprotocol/servers

97 files · 95 findings

Share GitHub SARIF JSON
3 critical4 high88 medium
Tool Poisoningclean
Command Injection1 issue
Path Traversal86 issues
SSRF3 issues
Credential Theftclean
Excessive Permissionsclean
Missing Auth5 issues
Supply Chain
SSRF3

URL construction from user input

medium

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

src/everything/resources/templates.ts:119
new URL(`${textUriBase}/${resourceId}`);
How to fix

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

Missing Auth5

Server route without authentication middleware

medium

HTTP endpoints defined without authentication middleware may be accessible to unauthorized users.

src/everything/transports/sse.ts:26
app.get("/sse", async (req, res) => {
How to fix

Add authentication middleware to all routes that access or modify data.

Path Traversal86

fs operations without path sanitization

medium

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

src/filesystem/__tests__/directory-tree.test.ts:17
const entries = await fs.readdir(currentPath, {withFileTypes: true});
How to fix

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

Command Injection1

child_process import with unsanitized usage

high

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

src/filesystem/__tests__/startup-validation.test.ts:2
import { spawn } from 'child_process';
How to fix

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

clean
Rug Pullclean

URL construction from user input

medium

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

src/everything/resources/templates.ts:127
new URL(`${blobUriBase}/${resourceId}`);
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.

src/everything/tools/gzip-file-as-resource.ts:190
const response = await fetch(url, { signal: controller.signal });
How to fix

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

Server route without authentication middleware

medium

HTTP endpoints defined without authentication middleware may be accessible to unauthorized users.

src/everything/transports/sse.ts:59
app.post("/message", async (req, res) => {
How to fix

Add authentication middleware to all routes that access or modify data.

Server route without authentication middleware

medium

HTTP endpoints defined without authentication middleware may be accessible to unauthorized users.

src/everything/transports/streamableHttp.ts:60
app.post("/mcp", async (req: Request, res: Response) => {
How to fix

Add authentication middleware to all routes that access or modify data.

Server route without authentication middleware

medium

HTTP endpoints defined without authentication middleware may be accessible to unauthorized users.

src/everything/transports/streamableHttp.ts:137
app.get("/mcp", async (req: Request, res: Response) => {
How to fix

Add authentication middleware to all routes that access or modify data.

Server route without authentication middleware

medium

HTTP endpoints defined without authentication middleware may be accessible to unauthorized users.

src/everything/transports/streamableHttp.ts:165
app.delete("/mcp", async (req: Request, res: Response) => {
How to fix

Add authentication middleware to all routes that access or modify data.

fs operations without path sanitization

medium

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

src/filesystem/__tests__/directory-tree.test.ts:58
await fs.mkdir(path.join(testDir, 'src'));
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.

src/filesystem/__tests__/directory-tree.test.ts:59
await fs.mkdir(path.join(testDir, 'node_modules'));
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.

src/filesystem/__tests__/directory-tree.test.ts:60
await fs.mkdir(path.join(testDir, '.git'));
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.

src/filesystem/__tests__/directory-tree.test.ts:61
await fs.mkdir(path.join(testDir, 'nested', 'node_modules'), { recursive: true });
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.

src/filesystem/__tests__/directory-tree.test.ts:64
await fs.writeFile(path.join(testDir, '.env'), 'SECRET=value');
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.

src/filesystem/__tests__/directory-tree.test.ts:65
await fs.writeFile(path.join(testDir, '.env.local'), 'LOCAL_SECRET=value');
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.

src/filesystem/__tests__/directory-tree.test.ts:66
await fs.writeFile(path.join(testDir, 'src', 'index.js'), 'console.log("hello");');
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.

src/filesystem/__tests__/directory-tree.test.ts:67
await fs.writeFile(path.join(testDir, 'package.json'), '{}');
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.

src/filesystem/__tests__/directory-tree.test.ts:68
await fs.writeFile(path.join(testDir, 'node_modules', 'module.js'), 'module.exports = {};');
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.

src/filesystem/__tests__/directory-tree.test.ts:69
await fs.writeFile(path.join(testDir, 'nested', 'node_modules', 'deep.js'), 'module.exports = {};');
How to fix

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

path.join/resolve with user-controlled input

high

Using path.join or path.resolve with variables from user input without validation can lead to directory traversal.

src/filesystem/__tests__/lib.test.ts:222
: path.resolve('/home/user', relativePath);
How to fix

Sanitize user input before passing to path.join/resolve. Use path.normalize() and check for '..' sequences.

Access to sensitive system files

critical

Direct access to sensitive files like /etc/passwd, /etc/shadow, or SSH keys indicates potential data exfiltration.

src/filesystem/__tests__/lib.test.ts:170
const testPath = process.platform === 'win32' ? 'C:\\Windows\\System32\\file.txt' : '/etc/passwd';
How to fix

Remove direct references to sensitive system files. Use a restricted file access layer.

Directory traversal sequence detected

high

Paths containing '../' sequences can escape intended directories and access arbitrary files on the filesystem.

src/filesystem/__tests__/path-validation.test.ts:274
expect(isPathWithinAllowedDirectories('/home/user/project/../../../etc/passwd', allowed)).toBe(false);
How to fix

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

Access to sensitive system files

critical

Direct access to sensitive files like /etc/passwd, /etc/shadow, or SSH keys indicates potential data exfiltration.

src/filesystem/__tests__/path-validation.test.ts:75
expect(isPathWithinAllowedDirectories('/etc/passwd', allowed)).toBe(false);
How to fix

Remove direct references to sensitive system files. Use a restricted file access layer.

Access to sensitive system files

critical

Direct access to sensitive files like /etc/passwd, /etc/shadow, or SSH keys indicates potential data exfiltration.

src/filesystem/__tests__/path-validation.test.ts:238
expect(isPathWithinAllowedDirectories('/etc/passwd', allowed)).toBe(true);
How to fix

Remove direct references to sensitive system files. Use a restricted file access layer.

fs operations without path sanitization

medium

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

src/filesystem/__tests__/path-validation.test.ts:16
await fs.writeFile(targetFile, 'test');
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.

src/filesystem/__tests__/path-validation.test.ts:454
await fs.mkdir(allowedDir, { recursive: true });
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.

src/filesystem/__tests__/path-validation.test.ts:455
await fs.mkdir(forbiddenDir, { recursive: true });
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.

src/filesystem/__tests__/path-validation.test.ts:468
await fs.writeFile(targetPath, 'content');
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.

src/filesystem/__tests__/path-validation.test.ts:493
await fs.mkdir(path.dirname(newFilePath), { recursive: true });
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.

src/filesystem/__tests__/path-validation.test.ts:503
await fs.writeFile(targetFile, 'TARGET_CONTENT');
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.

src/filesystem/__tests__/path-validation.test.ts:531
await fs.mkdir(actualTargetDir, { recursive: true });
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.

src/filesystem/__tests__/path-validation.test.ts:533
await fs.writeFile(targetFile, 'FILE_CONTENT');
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.

src/filesystem/__tests__/path-validation.test.ts:574
await fs.mkdir(actualTargetDir, { recursive: true });
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.

src/filesystem/__tests__/path-validation.test.ts:576
await fs.writeFile(targetFile, 'FILE_CONTENT');
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.

src/filesystem/__tests__/path-validation.test.ts:618
await fs.writeFile(actualTarget, 'FINAL_CONTENT');
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.

src/filesystem/__tests__/path-validation.test.ts:660
await fs.mkdir(allowedDir, { recursive: true });
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.

src/filesystem/__tests__/path-validation.test.ts:661
await fs.mkdir(forbiddenDir, { recursive: true });
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.

src/filesystem/__tests__/path-validation.test.ts:662
await fs.writeFile(targetFile, 'ORIGINAL CONTENT', '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.

src/filesystem/__tests__/path-validation.test.ts:692
await fs.writeFile(testPath, 'MODIFIED CONTENT', '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.

src/filesystem/__tests__/path-validation.test.ts:694
const targetContent = await fs.readFile(targetFile, '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.

src/filesystem/__tests__/path-validation.test.ts:755
await fs.writeFile(testPath, 'NEW CONTENT', '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.

src/filesystem/__tests__/path-validation.test.ts:756
const targetContent = await fs.readFile(targetFile, '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.

src/filesystem/__tests__/path-validation.test.ts:799
await fs.mkdir(path.join(sub1Path, 'sub2'), { recursive: true });
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.

src/filesystem/__tests__/path-validation.test.ts:800
await fs.writeFile(deepPath, 'CONTENT', '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.

src/filesystem/__tests__/path-validation.test.ts:821
await fs.writeFile(targetFile, 'ORIGINAL CONTENT', '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.

src/filesystem/__tests__/path-validation.test.ts:832
fs.writeFile(racePath, 'NEW CONTENT', { encoding: 'utf-8', flag: 'wx' })
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.

src/filesystem/__tests__/path-validation.test.ts:836
const targetContent = await fs.readFile(targetFile, '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.

src/filesystem/__tests__/path-validation.test.ts:850
await fs.writeFile(legitFile, 'ORIGINAL', '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.

src/filesystem/__tests__/path-validation.test.ts:860
const content = await fs.readFile(legitFile, '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.

src/filesystem/__tests__/path-validation.test.ts:876
await fs.writeFile(targetFile, 'TARGET CONTENT', '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.

src/filesystem/__tests__/path-validation.test.ts:890
const symlinkContent = await fs.readFile(symlinkPath, '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.

src/filesystem/__tests__/path-validation.test.ts:891
const targetContent = await fs.readFile(targetFile, '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.

src/filesystem/__tests__/path-validation.test.ts:908
await fs.writeFile(legitFile, 'LEGIT CONTENT', '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.

src/filesystem/__tests__/path-validation.test.ts:911
await fs.writeFile(targetFile, 'FORBIDDEN CONTENT', '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.

src/filesystem/__tests__/path-validation.test.ts:914
await fs.unlink(legitFile);
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.

src/filesystem/__tests__/path-validation.test.ts:928
const targetContent = await fs.readFile(targetFile, '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.

src/filesystem/__tests__/path-validation.test.ts:944
await fs.writeFile(legitFile, 'PUBLIC CONTENT', '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.

src/filesystem/__tests__/path-validation.test.ts:947
await fs.writeFile(secretFile, 'SECRET CONTENT', '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.

src/filesystem/__tests__/path-validation.test.ts:953
await fs.unlink(legitFile);
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.

src/filesystem/__tests__/path-validation.test.ts:957
const content = await fs.readFile(legitFile, '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.

src/filesystem/__tests__/path-validation.test.ts:977
await fs.writeFile(forbiddenTarget, 'ORIGINAL CONTENT', '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.

src/filesystem/__tests__/path-validation.test.ts:983
await fs.writeFile(tempFile, 'NEW CONTENT', '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.

src/filesystem/__tests__/path-validation.test.ts:991
const targetContent = await fs.readFile(targetSymlink, '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.

src/filesystem/__tests__/path-validation.test.ts:992
const forbiddenContent = await fs.readFile(forbiddenTarget, '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.

src/filesystem/__tests__/startup-validation.test.ts:48
await fs.mkdir(accessibleDir, { recursive: true });
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.

src/filesystem/__tests__/startup-validation.test.ts:49
await fs.mkdir(accessibleDir2, { recursive: true });
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.

src/filesystem/__tests__/startup-validation.test.ts:89
await fs.writeFile(filePath, 'content');
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.

src/filesystem/__tests__/structured-content.test.ts:27
await fs.writeFile(path.join(testDir, 'test.txt'), 'test content');
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.

src/filesystem/__tests__/structured-content.test.ts:28
await fs.mkdir(path.join(testDir, 'subdir'));
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.

src/filesystem/__tests__/structured-content.test.ts:29
await fs.writeFile(path.join(testDir, 'subdir', 'nested.txt'), 'nested content');
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.

src/filesystem/index.ts:411
await fs.mkdir(validPath, { recursive: true });
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.

src/filesystem/index.ts:437
const entries = await fs.readdir(validPath, { withFileTypes: true });
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.

src/filesystem/index.ts:466
const entries = await fs.readdir(validPath, { withFileTypes: true });
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.

src/filesystem/index.ts:553
const entries = await fs.readdir(validPath, { withFileTypes: true });
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.

src/filesystem/lib.ts:158
return await fs.readFile(filePath, encoding as BufferEncoding);
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.

src/filesystem/lib.ts:165
await fs.writeFile(filePath, content, { encoding: "utf-8", flag: 'wx' });
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.

src/filesystem/lib.ts:173
await fs.writeFile(tempPath, content, '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.

src/filesystem/lib.ts:177
await fs.unlink(tempPath);
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.

src/filesystem/lib.ts:200
const content = normalizeLineEndings(await fs.readFile(filePath, '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.

src/filesystem/lib.ts:271
await fs.writeFile(tempPath, modifiedContent, '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.

src/filesystem/lib.ts:275
await fs.unlink(tempPath);
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.

src/filesystem/lib.ts:384
const entries = await fs.readdir(currentPath, { withFileTypes: true });
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.

src/memory/__tests__/file-path.test.ts:31
await fs.unlink(oldMemoryPath);
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.

src/memory/__tests__/file-path.test.ts:36
await fs.unlink(newMemoryPath);
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.

src/memory/__tests__/file-path.test.ts:86
await fs.writeFile(oldMemoryPath, '{"test":"data"}');
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.

src/memory/__tests__/file-path.test.ts:114
await fs.writeFile(oldMemoryPath, '{"old":"data"}');
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.

src/memory/__tests__/file-path.test.ts:115
await fs.writeFile(newMemoryPath, '{"new":"data"}');
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.

src/memory/__tests__/file-path.test.ts:138
await fs.writeFile(oldMemoryPath, testContent);
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.

src/memory/__tests__/file-path.test.ts:142
const migratedContent = await fs.readFile(newMemoryPath, '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.

src/memory/__tests__/knowledge-graph.test.ts:23
await fs.unlink(testFilePath);
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.

src/memory/__tests__/knowledge-graph.test.ts:386
const fileContent = await fs.readFile(testFilePath, '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.

src/memory/__tests__/knowledge-graph.test.ts:405
const fileContent = await fs.readFile(testFilePath, '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.

src/memory/index.ts:73
const data = await fs.readFile(this.memoryFilePath, "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.

src/memory/index.ts:116
await fs.writeFile(this.memoryFilePath, lines.join("\n"));
How to fix

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