Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/filesystem/path-validation.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import path from 'path';
import { normalizePath } from './path-utils.js';

/**
* Checks if an absolute path is within any of the allowed directories.
Expand Down Expand Up @@ -27,7 +28,7 @@ export function isPathWithinAllowedDirectories(absolutePath: string, allowedDire
// Normalize the input path
let normalizedPath: string;
try {
normalizedPath = path.resolve(path.normalize(absolutePath));
normalizedPath = normalizePath(path.resolve(path.normalize(absolutePath)));
} catch {
return false;
}
Expand All @@ -51,7 +52,7 @@ export function isPathWithinAllowedDirectories(absolutePath: string, allowedDire
// Normalize the allowed directory
let normalizedDir: string;
try {
normalizedDir = path.resolve(path.normalize(dir));
normalizedDir = normalizePath(path.resolve(path.normalize(dir)));
} catch {
return false;
}
Expand Down
Loading