Skip to content
Merged
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
6 changes: 2 additions & 4 deletions src/server/local-directory-routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ async function listAllowedDirectory(requestedPath: string): Promise<LocalBrowser
try {
// safePath is the canonical path returned by resolveAllowedPath after
// lexical and realpath containment checks against allowed roots.
// codeql[js/path-injection]
stat = await fs.stat(safePath);
stat = await fs.stat(safePath); // lgtm[js/path-injection]
} catch (err: unknown) {
if (hasErrorCode(err, "ENOENT")) {
throw new LocalBrowserError(400, "Path does not exist");
Expand All @@ -122,8 +121,7 @@ async function listAllowedDirectory(requestedPath: string): Promise<LocalBrowser
try {
// safePath is the canonical path returned by resolveAllowedPath after
// lexical and realpath containment checks against allowed roots.
// codeql[js/path-injection]
entries = await fs.readdir(safePath, { withFileTypes: true });
entries = await fs.readdir(safePath, { withFileTypes: true }); // lgtm[js/path-injection]
} catch (err: unknown) {
throw new LocalBrowserError(403, "Access denied");
}
Expand Down