From b19898953b7bd61d2e3c635da42e84ef5f96cadc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20W=C3=A5reus?= Date: Thu, 9 Nov 2023 11:18:36 +0100 Subject: [PATCH] fix linting errors --- internal/fingerprint/fingerprint.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/fingerprint/fingerprint.go b/internal/fingerprint/fingerprint.go index fb329252..8a6346bd 100644 --- a/internal/fingerprint/fingerprint.go +++ b/internal/fingerprint/fingerprint.go @@ -305,7 +305,10 @@ func inMemFingerprintingCompressedContent(filename string, exclusions []string) fingerprints := []FileFingerprint{} for _, f := range r.File { - longFileName := filepath.Join(filename, f.Name) // Use filepath.Join for compatibility + if filepath.IsAbs(f.Name) || strings.HasPrefix(f.Name, "..") { + continue + } + longFileName := filepath.Join(filename, f.Name) // #nosec if !shouldProcessFile(f.FileInfo(), exclusions, longFileName) { continue @@ -318,6 +321,7 @@ func inMemFingerprintingCompressedContent(filename string, exclusions []string) _, err = io.Copy(hasher, rc) // #nosec if err != nil { rc.Close() + return nil, err }