Skip to content

Commit

Permalink
Fixing warning from CodeQL saying if uploaded scan zip has .. in a pa…
Browse files Browse the repository at this point in the history
…th it may reference outside zip directory
  • Loading branch information
Peter Nemere committed Nov 15, 2024
1 parent 4f86d62 commit 016584d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions api/ws/handlers/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,10 @@ func processEM(importId string, zipReader *zip.Reader, zippedData []byte, destBu
sdf_raw_zipPath := ""

for _, f := range zipReader.File {
if strings.Contains(f.Name, "..") {
return fmt.Errorf("Found invalid path in zip that references ..: %v", f.Name)
}

if !f.FileInfo().IsDir() {
// Add to list of files we're interested in
if strings.HasSuffix(f.Name, "sdf_raw.txt") {
Expand Down

0 comments on commit 016584d

Please sign in to comment.