Skip to content

Find, verify, and analyze leaked credentials

[chore] - Use http.NewRequestWithContext (#2870)

ahravfccf7c9a4192
diff --git a/pkg/detectors/aeroworkflow/aeroworkflow.go b/pkg/detectors/aeroworkflow/aeroworkflow.go
index 80375b8df..1bbff9e03 100644
--- a/pkg/detectors/aeroworkflow/aeroworkflow.go
+++ b/pkg/detectors/aeroworkflow/aeroworkflow.go
@@ -84,7 +84,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
}
func verifyAeroworkflow(ctx context.Context, client *http.Client, resMatch, resIdMatch string) (bool, error) {
- req, err := http.NewRequest(http.MethodGet, aeroworkflowURL+"/api/"+resIdMatch+"/v1/AeroAppointments", nil)
+ req, err := http.NewRequestWithContext(ctx, http.MethodGet, aeroworkflowURL+"/api/"+resIdMatch+"/v1/AeroAppointments", nil)
if err != nil {
return false, err
}
diff --git a/pkg/detectors/avazapersonalaccesstoken/avazapersonalaccesstoken.go b/pkg/detectors/avazapersonalaccesstoken/avazapersonalaccesstoken.go
index c5213a0bc..b0b7a806b 100644
--- a/pkg/detectors/avazapersonalaccesstoken/avazapersonalaccesstoken.go
+++ b/pkg/detectors/avazapersonalaccesstoken/avazapersonalaccesstoken.go
@@ -49,7 +49,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
}
if verify {
- req, err := http.NewRequest("GET", "https://api.avaza.com/api/Account", nil)
+ req, err := http.NewRequestWithContext(ctx, "GET", "https://api.avaza.com/api/Account", nil)
if err != nil {
continue
}
diff --git a/pkg/detectors/azurebatch/azurebatch.go b/pkg/detectors/azurebatch/azurebatch.go
index bd9e1936f..508c0833a 100644
--- a/pkg/detectors/azurebatch/azurebatch.go
+++ b/pkg/detectors/azurebatch/azurebatch.go
@@ -77,7 +77,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
h := hmac.New(sha256.New, key)
h.Write([]byte(stringToSign))
signature := base64.StdEncoding.EncodeToString(h.Sum(nil))
- req, err := http.NewRequest("GET", url, nil)
+ req, err := http.NewRequestWithContext(ctx, "GET", url, nil)
if err != nil {
continue
}
diff --git a/pkg/detectors/azurecontainerregistry/azurecontainerregistry.go b/pkg/detectors/azurecontainerregistry/azurecontainerregistry.go
index 55c0f4b3f..d5053f6e8 100644
--- a/pkg/detectors/azurecontainerregistry/azurecontainerregistry.go
+++ b/pkg/detectors/azurecontainerregistry/azurecontainerregistry.go
@@ -63,7 +63,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
auth := base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%s:%s", username, password)))
url := fmt.Sprintf("https://%s/v2/", endpoint)
- req, err := http.NewRequest("GET", url, nil)
+ req, err := http.NewRequestWithContext(ctx, "GET", url, nil)
if err != nil {
continue
}
diff --git a/pkg/detectors/borgbase/borgbase.go b/pkg/detectors/borgbase/borgbase.go
index ee81d3148..d44a6c06d 100644
--- a/pkg/detectors/borgbase/borgbase.go
+++ b/pkg/detectors/borgbase/borgbase.go
@@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
timeout := 10 * time.Second
client.Timeout = timeout
payload := strings.NewReader(`{"query":"{ sshList {id, name}}"}`)
- req, err := http.NewRequest("POST", "https://api.borgbase.com/graphql", payload)
+ req, err := http.NewRequestWithContext(ctx, "POST", "https://api.borgbase.com/graphql", payload)
if err != nil {
continue
}
diff --git a/pkg/detectors/caspio/caspio.go b/pkg/detectors/caspio/caspio.go
index 6b9d82508..6dfe2e6d2 100644
--- a/pkg/detectors/caspio/caspio.go
+++ b/pkg/detectors/caspio/caspio.go
@@ -68,7 +68,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
if verify {
payload := strings.NewReader(fmt.Sprintf(`grant_type=client_credentials&client_id=%s&client_secret=%s`, resIdMatch, resMatch))
- req, err := http.NewRequest("POST", fmt.Sprintf("https://%s.caspio.com/oauth/token", resDomainMatch), payload)
+ req, err := http.NewRequestWithContext(ctx, "POST", fmt.Sprintf("https://%s.caspio.com/oauth/token", resDomainMatch), payload)
if err != nil {
continue
}
diff --git a/pkg/detectors/chatfule/chatfule.go b/pkg/detectors/chatfule/chatfule.go
index b11760998..41cdeca43 100644
--- a/pkg/detectors/chatfule/chatfule.go
+++ b/pkg/detectors/chatfule/chatfule.go
@@ -48,7 +48,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
}
if verify {
- req, err := http.NewRequest("GET", "https://dashboard.chatfuel.com/api/bots", nil)
+ req, err := http.NewRequestWithContext(ctx, "GET", "https://dashboard.chatfuel.com/api/bots", nil)
if err != nil {
continue
}
diff --git a/pkg/detectors/checkvist/checkvist.go b/pkg/detectors/checkvist/checkvist.go
index 3ea18a5c8..d35fbd4be 100644
--- a/pkg/detectors/checkvist/checkvist.go
+++ b/pkg/detectors/checkvist/checkvist.go
@@ -62,7 +62,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
payload.Add("username", resEmailMatch)
payload.Add("remote_key", resMatch)
- req, err := http.NewRequest("GET", "https://checkvist.com/auth/login.json?version=2", strings.NewReader(payload.Encode()))
+ req, err := http.NewRequestWithContext(ctx, "GET", "https://checkvist.com/auth/login.json?version=2", strings.NewReader(payload.Encode()))
if err != nil {
continue
}
diff --git a/pkg/detectors/cloudimage/cloudimage.go b/pkg/detectors/cloudimage/cloudimage.go
index 71e7dc2ab..7bd518913 100644
--- a/pkg/detectors/cloudimage/cloudimage.go
+++ b/pkg/detectors/cloudimage/cloudimage.go
@@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
`)
timeout := 10 * time.Second
client.Timeout = timeout
- req, err := http.NewRequest("POST", "https://api.cloudimage.com/invalidate", payload)
+ req, err := http.NewRequestWithContext(ctx, "POST", "https://api.cloudimage.com/invalidate", payload)
if err != nil {
continue
}
diff --git a/pkg/detectors/cloze/cloze.go b/pkg/detectors/cloze/cloze.go
index de157bc5e..3e90294b4 100644
--- a/pkg/detectors/cloze/cloze.go
+++ b/pkg/detectors/cloze/cloze.go
@@ -61,7 +61,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
payload.Add("user", resEmailMatch)
payload.Add("api_key", resMatch)
- req, err := http.NewRequest("GET", "https://api.cloze.com/v1/profile?"+payload.Encode(), nil)
+ req, err := http.NewRequestWithContext(ctx, "GET", "https://api.cloze.com/v1/profile?"+payload.Encode(), nil)
if err != nil {
continue
}
diff --git a/pkg/detectors/convier/convier.go b/pkg/detectors/convier/convier.go
index bd28e1b8a..ff17d32b5 100644
--- a/pkg/detectors/convier/convier.go
+++ b/pkg/detectors/convier/convier.go
@@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
if verify {
timeout := 10 * time.Second
client.Timeout = timeout
- req, err := http.NewRequest("POST", "https://convier.me/api/event", nil)
+ req, err := http.NewRequestWithContext(ctx, "POST", "https://convier.me/api/event", nil)
if err != nil {
continue
}
diff --git a/pkg/detectors/diffbot/diffbot.go b/pkg/detectors/diffbot/diffbot.go
index 9d3914ae2..e4e7197c5 100644
--- a/pkg/detectors/diffbot/diffbot.go
+++ b/pkg/detectors/diffbot/diffbot.go
@@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
if verify {
timeout := 10 * time.Second
client.Timeout = timeout
- req, err := http.NewRequest("GET", fmt.Sprintf("https://api.diffbot.com/v4/account?token=%s", resMatch), nil)
+ req, err := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://api.diffbot.com/v4/account?token=%s", resMatch), nil)
if err != nil {
continue
}
diff --git a/pkg/detectors/eightxeight/eightxeight.go b/pkg/detectors/eightxeight/eightxeight.go
index d2eee9c84..c2965149b 100644
--- a/pkg/detectors/eightxeight/eightxeight.go
+++ b/pkg/detectors/eightxeight/eightxeight.go
@@ -62,7 +62,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
timeout := 10 * time.Second
client.Timeout = timeout
payload := strings.NewReader(`{"source":"abcde","destination":"+6512345678","text":"Hello World!","encoding":"AUTO"}`)
- req, err := http.NewRequest("POST", fmt.Sprintf("https://sms.8x8.com/api/v1/subaccounts/%s/messages", resIdMatch), payload)
+ req, err := http.NewRequestWithContext(ctx, "POST", fmt.Sprintf("https://sms.8x8.com/api/v1/subaccounts/%s/messages", resIdMatch), payload)
if err != nil {
continue
}
diff --git a/pkg/detectors/enablex/enablex.go b/pkg/detectors/enablex/enablex.go
index ab431987b..cdfc0d598 100644
--- a/pkg/detectors/enablex/enablex.go
+++ b/pkg/detectors/enablex/enablex.go
@@ -56,7 +56,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
}
if verify {
- req, err := http.NewRequest("GET", "https://api.enablex.io/voice/v1/call", nil)
+ req, err := http.NewRequestWithContext(ctx, "GET", "https://api.enablex.io/voice/v1/call", nil)
if err != nil {
continue
}
diff --git a/pkg/detectors/flightstats/flightstats.go b/pkg/detectors/flightstats/flightstats.go
index 0a28e06ef..b2f100e0e 100644
--- a/pkg/detectors/flightstats/flightstats.go
+++ b/pkg/detectors/flightstats/flightstats.go
@@ -57,7 +57,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
}
if verify {
- req, err := http.NewRequest("GET", fmt.Sprintf("https://api.flightstats.com/flex/aircraft/rest/v1/json/availableFields?appId=%s&appKey=%s", resId, resMatch), nil)
+ req, err := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://api.flightstats.com/flex/aircraft/rest/v1/json/availableFields?appId=%s&appKey=%s", resId, resMatch), nil)
if err != nil {
continue
}
diff --git a/pkg/detectors/gemini/gemini.go b/pkg/detectors/gemini/gemini.go
index b51d3c364..6c0828d2b 100644
--- a/pkg/detectors/gemini/gemini.go
+++ b/pkg/detectors/gemini/gemini.go
@@ -8,11 +8,12 @@ import (
"encoding/base64"
"encoding/hex"
"encoding/json"
- regexp "github.com/wasilibs/go-re2"
"net/http"
"strings"
"time"
+ regexp "github.com/wasilibs/go-re2"
+
"github.com/trufflesecurity/trufflehog/v3/pkg/common"
"github.com/trufflesecurity/trufflehog/v3/pkg/detectors"
"github.com/trufflesecurity/trufflehog/v3/pkg/pb/detectorspb"
@@ -44,7 +45,7 @@ func (s Scanner) Keywords() []string {
}
// FromData will find and optionally verify Gemini secrets in a given set of bytes.
-func (s Scanner) FromData(_ context.Context, verify bool, data []byte) (results []detectors.Result, err error) {
+func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (results []detectors.Result, err error) {
dataStr := string(data)
idMatches := keyPat.FindAllStringSubmatch(dataStr, -1)
@@ -66,7 +67,7 @@ func (s Scanner) FromData(_ context.Context, verify bool, data []byte) (results
}
if verify {
- req, err := constructRequest(resSecretMatch, resMatch)
+ req, err := constructRequest(ctx, resSecretMatch, resMatch)
if err != nil {
continue
}
@@ -86,8 +87,8 @@ func (s Scanner) FromData(_ context.Context, verify bool, data []byte) (results
return results, nil
}
-func constructRequest(secret, keyID string) (*http.Request, error) {
- req, err := http.NewRequest("POST", baseURL+accountDetail, &bytes.Buffer{})
+func constructRequest(ctx context.Context, secret, keyID string) (*http.Request, error) {
+ req, err := http.NewRequestWithContext(ctx, "POST", baseURL+accountDetail, &bytes.Buffer{})
if err != nil {
return nil, err
}
diff --git a/pkg/detectors/gocanvas/gocanvas.go b/pkg/detectors/gocanvas/gocanvas.go
index 2b4b4d8b2..95cd31cb2 100644
--- a/pkg/detectors/gocanvas/gocanvas.go
+++ b/pkg/detectors/gocanvas/gocanvas.go
@@ -63,7 +63,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
payload := url.Values{}
payload.Add("username", resEmailMatch)
- req, err := http.NewRequest("GET", "https://www.gocanvas.com/apiv2/forms.xml", strings.NewReader(payload.Encode()))
+ req, err := http.NewRequestWithContext(ctx, "GET", "https://www.gocanvas.com/apiv2/forms.xml", strings.NewReader(payload.Encode()))
if err != nil {
continue
}
diff --git a/pkg/detectors/kucoin/kucoin.go b/pkg/detectors/kucoin/kucoin.go
index 176d6429d..3ca40e1b1 100644
--- a/pkg/detectors/kucoin/kucoin.go
+++ b/pkg/detectors/kucoin/kucoin.go
@@ -79,7 +79,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
signature := getKucoinSignature(resSecretMatch, timestamp, method, endpoint, bodyStr)
passPhrase := getKucoinPassphrase(resSecretMatch, resPassphraseMatch)
- req, err := http.NewRequest(method, "https://api.kucoin.com"+endpoint, nil)
+ req, err := http.NewRequestWithContext(ctx, method, "https://api.kucoin.com"+endpoint, nil)
if err != nil {
continue
}
diff --git a/pkg/detectors/livestorm/livestorm.go b/pkg/detectors/livestorm/livestorm.go
index d0bedbcd7..92e6afcdc 100644
--- a/pkg/detectors/livestorm/livestorm.go
+++ b/pkg/detectors/livestorm/livestorm.go
@@ -47,7 +47,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
}
if verify {
- req, err := http.NewRequest("GET", "https://api.livestorm.co/v1/ping", nil)
+ req, err := http.NewRequestWithContext(ctx, "GET", "https://api.livestorm.co/v1/ping", nil)
if err != nil {
continue
}
diff --git a/pkg/detectors/metaapi/metaapi.go b/pkg/detectors/metaapi/metaapi.go
index 121c78b8b..4a89aef1c 100644
--- a/pkg/detectors/metaapi/metaapi.go
+++ b/pkg/detectors/metaapi/metaapi.go
@@ -57,7 +57,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
}
if verify {
- req, err := http.NewRequest("GET", fmt.Sprintf("https://api.meta-api.io/api/spells/%s/runSync", resSpellMatch), nil)
+ req, err := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://api.meta-api.io/api/spells/%s/runSync", resSpellMatch), nil)
if err != nil {
continue
}
diff --git a/pkg/detectors/pandascore/pandascore.go b/pkg/detectors/pandascore/pandascore.go
index 03e36f7cd..23e54577e 100644
--- a/pkg/detectors/pandascore/pandascore.go
+++ b/pkg/detectors/pandascore/pandascore.go
@@ -48,7 +48,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
}
if verify {
- req, err := http.NewRequest("GET", "https://api.pandascore.co/videogames", nil)
+ req, err := http.NewRequestWithContext(ctx, "GET", "https://api.pandascore.co/videogames", nil)
if err != nil {
continue
}
diff --git a/pkg/detectors/pipedream/pipedream.go b/pkg/detectors/pipedream/pipedream.go
index e6d692b4b..ea0d4d8aa 100644
--- a/pkg/detectors/pipedream/pipedream.go
+++ b/pkg/detectors/pipedream/pipedream.go
@@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
if verify {
timeout := 15 * time.Second
client.Timeout = timeout
- req, err := http.NewRequest("GET", "https://api.pipedream.com/v1/users/me", nil)
+ req, err := http.NewRequestWithContext(ctx, "GET", "https://api.pipedream.com/v1/users/me", nil)
if err != nil {
continue
}
diff --git a/pkg/detectors/planviewleankit/planviewleankit.go b/pkg/detectors/planviewleankit/planviewleankit.go
index 079e38b12..7380716eb 100644
--- a/pkg/detectors/planviewleankit/planviewleankit.go
+++ b/pkg/detectors/planviewleankit/planviewleankit.go
@@ -56,7 +56,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
}
if verify {
- req, err := http.NewRequest("GET", fmt.Sprintf("https://%s.leankit.com/io/account", resSubdomainMatch), nil)
+ req, err := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://%s.leankit.com/io/account", resSubdomainMatch), nil)
if err != nil {
continue
}
diff --git a/pkg/detectors/privatekey/privatekey.go b/pkg/detectors/privatekey/privatekey.go
index ab6eefa47..d921aee54 100644
--- a/pkg/detectors/privatekey/privatekey.go
+++ b/pkg/detectors/privatekey/privatekey.go
@@ -90,7 +90,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
wg.Add(1)
go func() {
defer wg.Done()
- data, err := lookupFingerprint(fingerprint, s.IncludeExpired)
+ data, err := lookupFingerprint(ctx, fingerprint, s.IncludeExpired)
if err == nil {
if data != nil {
extraData.Add("certificate_urls", strings.Join(data.CertificateURLs, ", "))
@@ -153,8 +153,8 @@ type result struct {
GitHubUsername string
}
-func lookupFingerprint(publicKeyFingerprintInHex string, includeExpired bool) (*result, error) {
- req, err := http.NewRequest("GET", fmt.Sprintf("https://keychecker.trufflesecurity.com/fingerprint/%s", publicKeyFingerprintInHex), nil)
+func lookupFingerprint(ctx context.Context, publicKeyFingerprintInHex string, includeExpired bool) (*result, error) {
+ req, err := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://keychecker.trufflesecurity.com/fingerprint/%s", publicKeyFingerprintInHex), nil)
if err != nil {
return nil, err
}
diff --git a/pkg/detectors/razorpay/razorpay.go b/pkg/detectors/razorpay/razorpay.go
index 4a7819aba..4f809eda9 100644
--- a/pkg/detectors/razorpay/razorpay.go
+++ b/pkg/detectors/razorpay/razorpay.go
@@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
}
if verify {
- req, err := http.NewRequest("GET", "https://api.razorpay.com/v1/items?count=1", nil)
+ req, err := http.NewRequestWithContext(ctx, "GET", "https://api.razorpay.com/v1/items?count=1", nil)
if err != nil {
continue
}
diff --git a/pkg/detectors/repairshopr/repairshopr.go b/pkg/detectors/repairshopr/repairshopr.go
index 37f9182be..c702cbbeb 100644
--- a/pkg/detectors/repairshopr/repairshopr.go
+++ b/pkg/detectors/repairshopr/repairshopr.go
@@ -55,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
}
if verify {
- req, err := http.NewRequest("GET", "https://"+resDomainMatch+".repairshopr.com/api/v1/appointment_types", nil)
+ req, err := http.NewRequestWithContext(ctx, "GET", "https://"+resDomainMatch+".repairshopr.com/api/v1/appointment_types", nil)
if err != nil {
continue
}
diff --git a/pkg/detectors/sirv/sirv.go b/pkg/detectors/sirv/sirv.go
index 566553267..b6a7531a6 100644
--- a/pkg/detectors/sirv/sirv.go
+++ b/pkg/detectors/sirv/sirv.go
@@ -60,7 +60,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
timeout := 10 * time.Second
client.Timeout = timeout
payload := strings.NewReader(fmt.Sprintf(`{"clientId":"%s","clientSecret":"%s"}`, resIdMatch, resMatch))
- req, err := http.NewRequest("POST", "https://api.sirv.com/v2/token", payload)
+ req, err := http.NewRequestWithContext(ctx, "POST", "https://api.sirv.com/v2/token", payload)
if err != nil {
continue
}
diff --git a/pkg/detectors/sugester/sugester.go b/pkg/detectors/sugester/sugester.go
index 794f13b15..64054d152 100644
--- a/pkg/detectors/sugester/sugester.go
+++ b/pkg/detectors/sugester/sugester.go
@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
}
if verify {
- req, err := http.NewRequest("GET", "https://"+resDomainMatch+".sugester.com/app/clients.json?api_token="+resMatch, nil)
+ req, err := http.NewRequestWithContext(ctx, "GET", "https://"+resDomainMatch+".sugester.com/app/clients.json?api_token="+resMatch, nil)
if err != nil {
continue
}
diff --git a/pkg/detectors/theoddsapi/theoddsapi.go b/pkg/detectors/theoddsapi/theoddsapi.go
index 2b9b06183..ca0b315cf 100644
--- a/pkg/detectors/theoddsapi/theoddsapi.go
+++ b/pkg/detectors/theoddsapi/theoddsapi.go
@@ -47,7 +47,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
}
if verify {
- req, err := http.NewRequest("GET", "https://api.the-odds-api.com/v4/sports/?apiKey="+resMatch, nil)
+ req, err := http.NewRequestWithContext(ctx, "GET", "https://api.the-odds-api.com/v4/sports/?apiKey="+resMatch, nil)
if err != nil {
continue
}
diff --git a/pkg/detectors/uploadcare/uploadcare.go b/pkg/detectors/uploadcare/uploadcare.go
index 665f158ef..6866aa75c 100644
--- a/pkg/detectors/uploadcare/uploadcare.go
+++ b/pkg/detectors/uploadcare/uploadcare.go
@@ -55,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
}
if verify {
- req, err := http.NewRequest("GET", "https://api.uploadcare.com/files/", nil)
+ req, err := http.NewRequestWithContext(ctx, "GET", "https://api.uploadcare.com/files/", nil)
if err != nil {
continue
}
diff --git a/pkg/detectors/uri/uri.go b/pkg/detectors/uri/uri.go
index 8015b0f21..11bdcebd7 100644
--- a/pkg/detectors/uri/uri.go
+++ b/pkg/detectors/uri/uri.go
@@ -118,7 +118,7 @@ func verifyURL(ctx context.Context, client *http.Client, u *url.URL) (bool, erro
u.User = nil
nonCredentialedURL := u.String()
- req, err := http.NewRequest("GET", credentialedURL, nil)
+ req, err := http.NewRequestWithContext(ctx, "GET", credentialedURL, nil)
if err != nil {
return false, err
}
@@ -136,7 +136,7 @@ func verifyURL(ctx context.Context, client *http.Client, u *url.URL) (bool, erro
time.Sleep(time.Millisecond * 10)
- req, err = http.NewRequest("GET", nonCredentialedURL, nil)
+ req, err = http.NewRequestWithContext(ctx, "GET", nonCredentialedURL, nil)
if err != nil {
return false, err
}