fix: sanitize jobId and fix typo in filename sanitization

- Fix typo: santizedFileName -> sanitizedFileName in upload.tsx
- Add sanitize(jobId) in download.tsx for defense-in-depth path traversal protection
  Even though jobId is validated against the database, sanitizing it prevents
  any potential path traversal via malicious job IDs.
This commit is contained in:
GenzNewZ Bot 2026-04-24 21:11:35 -04:00
parent 1ba82cf1b2
commit 678424b2d2
2 changed files with 5 additions and 5 deletions

View file

@ -24,7 +24,7 @@ export const download = new Elysia()
const jobId = decodeURIComponent(params.jobId);
const fileName = sanitize(decodeURIComponent(params.fileName));
const filePath = `${outputDir}${userId}/${jobId}/${fileName}`;
const filePath = `${outputDir}${userId}/${sanitize(jobId)}/${fileName}`;
return Bun.file(filePath);
},
{