This commit is contained in:
MirzaSamadAhmedBaig 2025-08-10 17:10:10 +05:00 committed by GitHub
commit c2163b1609
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -62,7 +62,12 @@ async function handle(
endpoint += "/"; endpoint += "/";
} }
const endpointPath = params.path.join("/"); // Sanitize path components to prevent path traversal attacks
const sanitizedPathComponents = params.path
.filter(component => component && component !== '.' && component !== '..')
.map(component => encodeURIComponent(component));
const endpointPath = sanitizedPathComponents.join("/");
const targetPath = `${endpoint}${endpointPath}`; const targetPath = `${endpoint}${endpointPath}`;
// only allow MKCOL, GET, PUT // only allow MKCOL, GET, PUT