security: fix path traversal vulnerability in conversion API (#532)
This commit is contained in:
parent
1ba82cf1b2
commit
0965928949
2 changed files with 16 additions and 6 deletions
|
|
@ -47,7 +47,12 @@ export const convert = new Elysia().use(userService).post(
|
|||
const convertTo = normalizeFiletype(body.convert_to.split(",")[0] ?? "");
|
||||
const converterName = body.convert_to.split(",")[1];
|
||||
|
||||
if (!converterName) {
|
||||
if (
|
||||
!converterName ||
|
||||
convertTo.includes("/") ||
|
||||
convertTo.includes("\\") ||
|
||||
convertTo.includes("..")
|
||||
) {
|
||||
return redirect(`${WEBROOT}/`, 302);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue