Fix file traversal

This commit is contained in:
Arkadiy Tetelman authored and Arkadiy Tetelman committed 2026-03-30 18:09:55 -07:00
1 parent e5815840e4
commit cd9602ffac
1 file changed
+1 -1
+1 -1
View File
@@ -44,7 +44,7 @@ func writeFile(outputDir string, filename string, content []byte) (string, error
return "", fmt.Errorf("failed to evalsymlinks on %s: %v", eval, err)
}
if !strings.HasPrefix(base, outputDirAbs) {
if base != outputDirAbs && !strings.HasPrefix(base, outputDirAbs+string(filepath.Separator)) {
return "", fmt.Errorf("invalid filepath: %s", base)
}