Skip to content
Closed
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: 5 additions & 1 deletion packages/web/src/features/fileTree/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,11 @@ export const getFolderContents = async (params: { repoName: string, revisionName

// @note: we don't allow directory traversal
// or null bytes in the path.
if (path.includes('..') || path.includes('\0')) {
// We split by '/' and check if any segment starts with '..'
// to allow legitimate paths containing '..' (e.g., '[...path]')
// while still blocking directory traversal attempts.
const pathSegments = path.split('/');
if (pathSegments.some(segment => segment.startsWith('..')) || path.includes('\0')) {
return notFound();
}

Expand Down