mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-09-17 16:56:37 +08:00
Merge d09801bcab
into 995bef73de
This commit is contained in:
commit
c2163b1609
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user