Skip to content

Find, verify, and analyze leaked credentials

Fix azure panic when invalid URL is constructed (#2137)

Dustin Deckera367f9ce344e
diff --git a/pkg/detectors/azurestorage/azurestorage.go b/pkg/detectors/azurestorage/azurestorage.go
index 3926e1a95..d6f221529 100644
--- a/pkg/detectors/azurestorage/azurestorage.go
+++ b/pkg/detectors/azurestorage/azurestorage.go
@@ -62,6 +62,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
url := "https://" + accountName + ".blob.core.windows.net/?comp=list"
req, err := http.NewRequestWithContext(ctx, "GET", url, nil)
+ if err != nil {
+ continue
+ }
req.Header.Set("x-ms-date", now)
req.Header.Set("x-ms-version", "2019-12-12")
req.Header.Set("Authorization", "SharedKey "+accountName+":"+signature)