fix: correct regex for valid API post path validation

This commit is contained in:
Linus Rath
2026-05-18 12:44:54 +02:00
parent 48aa607b56
commit b1eb2b3c9b
+1 -1
View File
@@ -73,7 +73,7 @@ export function isValidApiPostPath(path: unknown): path is string {
if (!path.startsWith('/api/')) return false;
if (path.includes('..')) return false;
if (/[\s'"`;,()?#]/.test(path)) return false;
if (!/^[/A-Za-z0-9._\-]+$/.test(path)) return false;
if (!/^[/A-Za-z0-9._-]+$/.test(path)) return false;
return true;
}