We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 844d4f5 commit c845424Copy full SHA for c845424
cmd/api/main.go
@@ -249,12 +249,11 @@ func copyFile(src, dst string) error {
249
// Validate and clean paths to prevent directory traversal
250
cleanSrc := filepath.Clean(src)
251
cleanDst := filepath.Clean(dst)
252
-
+
253
// Additional security check: ensure paths don't contain ".." or other suspicious patterns
254
if !filepath.IsAbs(cleanSrc) || !filepath.IsAbs(cleanDst) {
255
return fmt.Errorf("paths must be absolute")
256
}
257
258
// #nosec G304 - Path traversal mitigation: paths are validated and cleaned above
259
sourceFile, err := os.Open(cleanSrc)
260
if err != nil {
0 commit comments