diff --git a/pkg/detectors/abbysale/abbysale.go b/pkg/detectors/abbysale/abbysale.go index 8f057505..7923297b 100644 --- a/pkg/detectors/abbysale/abbysale.go +++ b/pkg/detectors/abbysale/abbysale.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.abyssale.com/ready", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.abyssale.com/ready", nil) req.Header.Add("x-api-key", fmt.Sprintf("%s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/abstract/abstract.go b/pkg/detectors/abstract/abstract.go index d7216eff..5fa627da 100644 --- a/pkg/detectors/abstract/abstract.go +++ b/pkg/detectors/abstract/abstract.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://exchange-rates.abstractapi.com/v1/live/?api_key=%s&base=USD", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://exchange-rates.abstractapi.com/v1/live/?api_key=%s&base=USD", resMatch), nil) req.Header.Add("Content-Type", "application/json") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/abuseipdb/abuseipdb.go b/pkg/detectors/abuseipdb/abuseipdb.go index e2c05abb..7e3c347a 100644 --- a/pkg/detectors/abuseipdb/abuseipdb.go +++ b/pkg/detectors/abuseipdb/abuseipdb.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.abuseipdb.com/api/v2/check?ipAddress=118.25.6.39", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.abuseipdb.com/api/v2/check?ipAddress=118.25.6.39", nil) req.Header.Add("Key", resMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/accuweather/accuweather.go b/pkg/detectors/accuweather/accuweather.go index ded2fc81..c0fd0516 100644 --- a/pkg/detectors/accuweather/accuweather.go +++ b/pkg/detectors/accuweather/accuweather.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "http://dataservice.accuweather.com/locations/v1/cities/autocomplete?apikey="+resMatch+"&q=----&language=en-us", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "http://dataservice.accuweather.com/locations/v1/cities/autocomplete?apikey="+resMatch+"&q=----&language=en-us", nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/adafruitio/adafruitio.go b/pkg/detectors/adafruitio/adafruitio.go index a064ab20..2f066edc 100644 --- a/pkg/detectors/adafruitio/adafruitio.go +++ b/pkg/detectors/adafruitio/adafruitio.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://io.adafruit.com/api/v2/ladybugtest/feeds/?x-aio-key="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://io.adafruit.com/api/v2/ladybugtest/feeds/?x-aio-key="+resMatch, nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/adobeio/adobeio.go b/pkg/detectors/adobeio/adobeio.go index d254c878..d530db0f 100644 --- a/pkg/detectors/adobeio/adobeio.go +++ b/pkg/detectors/adobeio/adobeio.go @@ -57,7 +57,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://stock.adobe.io/Rest/Media/1/Search/Files?locale=en_US%2526search_parameters%255Bwords%255D=kittens", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://stock.adobe.io/Rest/Media/1/Search/Files?locale=en_US%2526search_parameters%255Bwords%255D=kittens", nil) req.Header.Add("x-api-key", resMatch) req.Header.Add("x-product", resIdMatch) res, err := client.Do(req) diff --git a/pkg/detectors/adzuna/adzuna.go b/pkg/detectors/adzuna/adzuna.go index f4e53979..6a1de3d2 100644 --- a/pkg/detectors/adzuna/adzuna.go +++ b/pkg/detectors/adzuna/adzuna.go @@ -58,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://api.adzuna.com/v1/api/jobs/gb/search/1?app_id=%s&app_key=%s", resIdMatch, resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://api.adzuna.com/v1/api/jobs/gb/search/1?app_id=%s&app_key=%s", resIdMatch, resMatch), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/agora/agora.go b/pkg/detectors/agora/agora.go index 1c6054d9..7d4840b7 100644 --- a/pkg/detectors/agora/agora.go +++ b/pkg/detectors/agora/agora.go @@ -59,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.agora.io/dev/v1/projects", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.agora.io/dev/v1/projects", nil) req.SetBasicAuth(resSecret, resMatch) res, err := client.Do(req) diff --git a/pkg/detectors/airbrakeprojectkey/airbrakeprojectkey.go b/pkg/detectors/airbrakeprojectkey/airbrakeprojectkey.go index 8f536dd9..6d5eb47b 100644 --- a/pkg/detectors/airbrakeprojectkey/airbrakeprojectkey.go +++ b/pkg/detectors/airbrakeprojectkey/airbrakeprojectkey.go @@ -62,7 +62,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { payload := strings.NewReader(`{"environment":"production","username":"john","email":"john@smith.com","repository":"https://github.com/airbrake/airbrake","revision":"38748467ea579e7ae64f7815452307c9d05e05c5","version":"v2.0"}`) - req, _ := http.NewRequest("POST", "https://api.airbrake.io/api/v4/projects/"+resIdMatch+"/deploys?key="+resMatch, payload) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://api.airbrake.io/api/v4/projects/"+resIdMatch+"/deploys?key="+resMatch, payload) req.Header.Add("Content-Type", "application/json") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/airbrakeuserkey/airbrakeuserkey.go b/pkg/detectors/airbrakeuserkey/airbrakeuserkey.go index 5ba94519..7221e7eb 100644 --- a/pkg/detectors/airbrakeuserkey/airbrakeuserkey.go +++ b/pkg/detectors/airbrakeuserkey/airbrakeuserkey.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.airbrake.io/api/v4/projects?key="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.airbrake.io/api/v4/projects?key="+resMatch, nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/airship/airship.go b/pkg/detectors/airship/airship.go index 9d81e7e2..5ecfccd7 100644 --- a/pkg/detectors/airship/airship.go +++ b/pkg/detectors/airship/airship.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://go.urbanairship.com/api/schedules", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://go.urbanairship.com/api/schedules", nil) req.Header.Add("Accept", "application/vnd.urbanairship+json; version=3") req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/airtableapikey/airtableapikey.go b/pkg/detectors/airtableapikey/airtableapikey.go index f7751f7b..698f46d7 100644 --- a/pkg/detectors/airtableapikey/airtableapikey.go +++ b/pkg/detectors/airtableapikey/airtableapikey.go @@ -58,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.airtable.com/v0/"+appRes+"/Projects", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.airtable.com/v0/"+appRes+"/Projects", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", keyRes)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/airvisual/airvisual.go b/pkg/detectors/airvisual/airvisual.go index e509eb32..80fe09ad 100644 --- a/pkg/detectors/airvisual/airvisual.go +++ b/pkg/detectors/airvisual/airvisual.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("http://api.airvisual.com/v2/countries?key=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("http://api.airvisual.com/v2/countries?key=%s", resMatch), nil) req.Header.Add("Accept", "application/vnd.airvisual+json; version=3") req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/alconost/alconost.go b/pkg/detectors/alconost/alconost.go index 7da2ee13..1b3342e3 100644 --- a/pkg/detectors/alconost/alconost.go +++ b/pkg/detectors/alconost/alconost.go @@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { data := fmt.Sprintf("%s:", resMatch) sEnc := b64.StdEncoding.EncodeToString([]byte(data)) - req, _ := http.NewRequest("GET", "https://nitro.alconost.com/api/v1/account", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://nitro.alconost.com/api/v1/account", nil) req.Header.Add("Content-Type", "application/json") req.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc)) res, err := client.Do(req) diff --git a/pkg/detectors/alegra/alegra.go b/pkg/detectors/alegra/alegra.go index 1aa765c9..3320a738 100644 --- a/pkg/detectors/alegra/alegra.go +++ b/pkg/detectors/alegra/alegra.go @@ -59,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.alegra.com/api/v1/users", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.alegra.com/api/v1/users", nil) req.SetBasicAuth(userPatMatch, tokenPatMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/aletheiaapi/aletheiaapi.go b/pkg/detectors/aletheiaapi/aletheiaapi.go index a367665f..1585e315 100644 --- a/pkg/detectors/aletheiaapi/aletheiaapi.go +++ b/pkg/detectors/aletheiaapi/aletheiaapi.go @@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { timeout := 10 * time.Second client.Timeout = timeout - req, _ := http.NewRequest("GET", "https://api.aletheiaapi.com/StockData?symbol=msft&summary=true", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.aletheiaapi.com/StockData?symbol=msft&summary=true", nil) req.Header.Add("Key", resMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/algoliaadminkey/algoliaadminkey.go b/pkg/detectors/algoliaadminkey/algoliaadminkey.go index fd7c079a..43d29445 100644 --- a/pkg/detectors/algoliaadminkey/algoliaadminkey.go +++ b/pkg/detectors/algoliaadminkey/algoliaadminkey.go @@ -57,7 +57,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://"+resIdMatch+"-dsn.algolia.net/1/keys", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://"+resIdMatch+"-dsn.algolia.net/1/keys", nil) req.Header.Add("X-Algolia-Application-Id", resIdMatch) req.Header.Add("X-Algolia-API-Key", resMatch) res, err := client.Do(req) diff --git a/pkg/detectors/alienvault/alienvault.go b/pkg/detectors/alienvault/alienvault.go index 092db305..2d2658a7 100644 --- a/pkg/detectors/alienvault/alienvault.go +++ b/pkg/detectors/alienvault/alienvault.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://otx.alienvault.com/api/v1/users/me", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://otx.alienvault.com/api/v1/users/me", nil) req.Header.Add("X-OTX-API-KEY", resMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/allsports/allsports.go b/pkg/detectors/allsports/allsports.go index 37727bd6..1328bf24 100644 --- a/pkg/detectors/allsports/allsports.go +++ b/pkg/detectors/allsports/allsports.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://apiv2.allsportsapi.com/football/?met=Countries&APIkey="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://apiv2.allsportsapi.com/football/?met=Countries&APIkey="+resMatch, nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/amadeus/amadeus.go b/pkg/detectors/amadeus/amadeus.go index 450b03ac..1e36da82 100644 --- a/pkg/detectors/amadeus/amadeus.go +++ b/pkg/detectors/amadeus/amadeus.go @@ -60,7 +60,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { payload := strings.NewReader("grant_type=client_credentials&client_id=" + resMatch + "&client_secret=" + resSecret) - req, _ := http.NewRequest("POST", "https://test.api.amadeus.com/v1/security/oauth2/token", payload) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://test.api.amadeus.com/v1/security/oauth2/token", payload) req.Header.Add("Content-Type", "application/x-www-form-urlencoded") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/ambee/ambee.go b/pkg/detectors/ambee/ambee.go index cf1c6bcc..29188479 100644 --- a/pkg/detectors/ambee/ambee.go +++ b/pkg/detectors/ambee/ambee.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.ambeedata.com/latest/by-lat-lng?lat=12&lng=77", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.ambeedata.com/latest/by-lat-lng?lat=12&lng=77", nil) req.Header.Add("Content-Type", "application/json") req.Header.Add("x-api-key", resMatch) res, err := client.Do(req) diff --git a/pkg/detectors/amplitudeapikey/amplitudeapikey.go b/pkg/detectors/amplitudeapikey/amplitudeapikey.go index 4a2da41b..9623050c 100644 --- a/pkg/detectors/amplitudeapikey/amplitudeapikey.go +++ b/pkg/detectors/amplitudeapikey/amplitudeapikey.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { payload := strings.NewReader("api_key=" + resMatch + "&identification=%5B%7B%22user_id%22%3A%22datamonster%40gmail.com%22%2C%20%22user_properties%22%3A%7B%22Age%22%3A%2235%22%7D%2C%20%22groups%22%3A%7B%22company_id%22%3A%221234%22%7D%2C%20%22country%22%3A%22United%20States%22%7D%5D") - req, _ := http.NewRequest("POST", "https://api.amplitude.com/identify", payload) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://api.amplitude.com/identify", payload) req.Header.Add("Content-Type", "application/x-www-form-urlencoded") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/anypoint/anypoint.go b/pkg/detectors/anypoint/anypoint.go index ea48c7b9..f0a5f2aa 100644 --- a/pkg/detectors/anypoint/anypoint.go +++ b/pkg/detectors/anypoint/anypoint.go @@ -58,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://anypoint.mulesoft.com/apiplatform/repository/v2/organizations/%s/apis/by-name?apiName=%s", orgRes, ""), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://anypoint.mulesoft.com/apiplatform/repository/v2/organizations/%s/apis/by-name?apiName=%s", orgRes, ""), nil) req.Header.Add("Content-Type", "application/json") req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/apacta/apacta.go b/pkg/detectors/apacta/apacta.go index ee6025e7..0465996a 100644 --- a/pkg/detectors/apacta/apacta.go +++ b/pkg/detectors/apacta/apacta.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://app.apacta.com/api/v1/time_entries?api_key=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://app.apacta.com/api/v1/time_entries?api_key=%s", resMatch), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/api2cart/api2cart.go b/pkg/detectors/api2cart/api2cart.go index 560fc78a..d76ac176 100644 --- a/pkg/detectors/api2cart/api2cart.go +++ b/pkg/detectors/api2cart/api2cart.go @@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://api.api2cart.com/v1.1/account.cart.list.json?api_key=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://api.api2cart.com/v1.1/account.cart.list.json?api_key=%s", resMatch), nil) req.Header.Add("Accept", "application/json") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/apideck/apideck.go b/pkg/detectors/apideck/apideck.go index b840ac76..9795d766 100644 --- a/pkg/detectors/apideck/apideck.go +++ b/pkg/detectors/apideck/apideck.go @@ -59,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://unify.apideck.com/vault/consumers", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://unify.apideck.com/vault/consumers", nil) req.Header.Add("x-apideck-app-id", resIdMatch) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/apiflash/apiflash.go b/pkg/detectors/apiflash/apiflash.go index 187926de..4edffc9b 100644 --- a/pkg/detectors/apiflash/apiflash.go +++ b/pkg/detectors/apiflash/apiflash.go @@ -58,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://api.apiflash.com/v1/urltoimage?url=%s&access_key=%s", resUrlMatch, resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://api.apiflash.com/v1/urltoimage?url=%s&access_key=%s", resUrlMatch, resMatch), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/apifonica/apifonica.go b/pkg/detectors/apifonica/apifonica.go index 88093491..29492fe6 100644 --- a/pkg/detectors/apifonica/apifonica.go +++ b/pkg/detectors/apifonica/apifonica.go @@ -61,7 +61,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { data := fmt.Sprintf("%s:%s", resMatch, resToken) sEnc := b64.StdEncoding.EncodeToString([]byte(data)) - req, _ := http.NewRequest("GET", "https://api.apifonica.com/v2/accounts", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.apifonica.com/v2/accounts", nil) req.Header.Add("Content-Type", "application/json") req.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc)) res, err := client.Do(req) diff --git a/pkg/detectors/apify/apify.go b/pkg/detectors/apify/apify.go index 7abb9584..8155a8e0 100644 --- a/pkg/detectors/apify/apify.go +++ b/pkg/detectors/apify/apify.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.apify.com/v2/acts?token="+resMatch+"&my=true&offset=10&limit=99&desc=true", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.apify.com/v2/acts?token="+resMatch+"&my=true&offset=10&limit=99&desc=true", nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/apimatic/apimatic.go b/pkg/detectors/apimatic/apimatic.go index a92b76ab..51aa91be 100644 --- a/pkg/detectors/apimatic/apimatic.go +++ b/pkg/detectors/apimatic/apimatic.go @@ -61,7 +61,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { timeout := 10 * time.Second client.Timeout = timeout - req, _ := http.NewRequest("GET", "https://www.apimatic.io/api/code-generations", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://www.apimatic.io/api/code-generations", nil) req.SetBasicAuth(userPatMatch, passPatMatch) res, err := client.Do(req) diff --git a/pkg/detectors/apiscience/apiscience.go b/pkg/detectors/apiscience/apiscience.go index 57411db7..0aa15f8a 100644 --- a/pkg/detectors/apiscience/apiscience.go +++ b/pkg/detectors/apiscience/apiscience.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.apiscience.com/v1/monitors", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.apiscience.com/v1/monitors", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/apollo/apollo.go b/pkg/detectors/apollo/apollo.go index 776435ce..50f40905 100644 --- a/pkg/detectors/apollo/apollo.go +++ b/pkg/detectors/apollo/apollo.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://api.apollo.io/v1/account_stages?api_key=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://api.apollo.io/v1/account_stages?api_key=%s", resMatch), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/appcues/appcues.go b/pkg/detectors/appcues/appcues.go index 4696f56a..e3757e06 100644 --- a/pkg/detectors/appcues/appcues.go +++ b/pkg/detectors/appcues/appcues.go @@ -68,7 +68,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result Raw: []byte(resMatch), } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://api.appcues.com/v2/accounts/%s/flows", resIdMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://api.appcues.com/v2/accounts/%s/flows", resIdMatch), nil) req.SetBasicAuth(resUserMatch, resMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/appfollow/appfollow.go b/pkg/detectors/appfollow/appfollow.go index 318cbadf..4ee06499 100644 --- a/pkg/detectors/appfollow/appfollow.go +++ b/pkg/detectors/appfollow/appfollow.go @@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { data := fmt.Sprintf("%s:", resMatch) sEnc := b64.StdEncoding.EncodeToString([]byte(data)) - req, _ := http.NewRequest("GET", "https://api.appfollow.io/test", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.appfollow.io/test", nil) req.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/appsynergy/appsynergy.go b/pkg/detectors/appsynergy/appsynergy.go index dc838fab..36bd0d30 100644 --- a/pkg/detectors/appsynergy/appsynergy.go +++ b/pkg/detectors/appsynergy/appsynergy.go @@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { payload := strings.NewReader(`{"html":"

Hello World

","filename":"HelloWorld.pdf"}`) - req, _ := http.NewRequest("POST", fmt.Sprintf("https://www.appsynergy.com/api?action=HTML2PDF&apiKey=%s", resMatch), payload) + req, _ := http.NewRequestWithContext(ctx, "POST", fmt.Sprintf("https://www.appsynergy.com/api?action=HTML2PDF&apiKey=%s", resMatch), payload) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/apptivo/apptivo.go b/pkg/detectors/apptivo/apptivo.go index 15c47f8c..bd1c27bc 100644 --- a/pkg/detectors/apptivo/apptivo.go +++ b/pkg/detectors/apptivo/apptivo.go @@ -59,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://api.apptivo.com/app/dao/v6/leads?a=getConfigData&apiKey=%s&accessKey=%s", resMatch, resIdMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://api.apptivo.com/app/dao/v6/leads?a=getConfigData&apiKey=%s&accessKey=%s", resMatch, resIdMatch), nil) res, err := client.Do(req) if err == nil { bodyBytes, err := ioutil.ReadAll(res.Body) diff --git a/pkg/detectors/artifactory/artifactory.go b/pkg/detectors/artifactory/artifactory.go index 9cc96939..77629109 100644 --- a/pkg/detectors/artifactory/artifactory.go +++ b/pkg/detectors/artifactory/artifactory.go @@ -60,7 +60,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://"+resURLMatch+"/artifactory/api/storageinfo", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://"+resURLMatch+"/artifactory/api/storageinfo", nil) req.Header.Add("X-JFrog-Art-Api", resMatch) res, err := client.Do(req) diff --git a/pkg/detectors/artsy/artsy.go b/pkg/detectors/artsy/artsy.go index c6090fd3..aedc2944 100644 --- a/pkg/detectors/artsy/artsy.go +++ b/pkg/detectors/artsy/artsy.go @@ -59,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("POST", "https://api.artsy.net/api/tokens/xapp_token?client_id="+resIdMatch+"&client_secret="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://api.artsy.net/api/tokens/xapp_token?client_id="+resIdMatch+"&client_secret="+resMatch, nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/asanaoauth/asanaoauth.go b/pkg/detectors/asanaoauth/asanaoauth.go index eb25bc6d..585c5ebb 100644 --- a/pkg/detectors/asanaoauth/asanaoauth.go +++ b/pkg/detectors/asanaoauth/asanaoauth.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://app.asana.com/api/1.0/users/me", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://app.asana.com/api/1.0/users/me", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/asanapersonalaccesstoken/asanapersonalaccesstoken.go b/pkg/detectors/asanapersonalaccesstoken/asanapersonalaccesstoken.go index e06aeb01..24017460 100644 --- a/pkg/detectors/asanapersonalaccesstoken/asanapersonalaccesstoken.go +++ b/pkg/detectors/asanapersonalaccesstoken/asanapersonalaccesstoken.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://app.asana.com/api/1.0/users/me", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://app.asana.com/api/1.0/users/me", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/assemblyai/assemblyai.go b/pkg/detectors/assemblyai/assemblyai.go index c5ea0789..9f728ad4 100644 --- a/pkg/detectors/assemblyai/assemblyai.go +++ b/pkg/detectors/assemblyai/assemblyai.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.assemblyai.com/v2/transcript", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.assemblyai.com/v2/transcript", nil) req.Header.Add("Content-Type", "application/json") req.Header.Add("Authorization", resMatch) res, err := client.Do(req) diff --git a/pkg/detectors/audd/audd.go b/pkg/detectors/audd/audd.go index c3c0ab90..4837308b 100644 --- a/pkg/detectors/audd/audd.go +++ b/pkg/detectors/audd/audd.go @@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://api.audd.io/setCallbackUrl/?api_token=%s&url=https://yourwebsite.com/callbacks_handler/", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://api.audd.io/setCallbackUrl/?api_token=%s&url=https://yourwebsite.com/callbacks_handler/", resMatch), nil) res, err := client.Do(req) if err == nil { bodyBytes, err := ioutil.ReadAll(res.Body) diff --git a/pkg/detectors/auth0managementapitoken/auth0managementapitoken.go b/pkg/detectors/auth0managementapitoken/auth0managementapitoken.go index f892aaeb..c6303a62 100644 --- a/pkg/detectors/auth0managementapitoken/auth0managementapitoken.go +++ b/pkg/detectors/auth0managementapitoken/auth0managementapitoken.go @@ -68,7 +68,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result curl -H "Authorization: Bearer $token" https://domain/api/v2/users */ - req, _ := http.NewRequest("GET", "https://"+domainRes+"/api/v2/users", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://"+domainRes+"/api/v2/users", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", managementApiTokenRes)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/auth0oauth/auth0oauth.go b/pkg/detectors/auth0oauth/auth0oauth.go index d287f14e..782ab332 100644 --- a/pkg/detectors/auth0oauth/auth0oauth.go +++ b/pkg/detectors/auth0oauth/auth0oauth.go @@ -82,7 +82,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result data.Set("code", "AUTHORIZATION_CODE") data.Set("redirect_uri", "undefined") - req, _ := http.NewRequest(http.MethodPost, "https://"+domainRes+"/oauth/token", strings.NewReader(data.Encode())) // URL-encoded payload + req, _ := http.NewRequestWithContext(ctx, http.MethodPost, "https://"+domainRes+"/oauth/token", strings.NewReader(data.Encode())) // URL-encoded payload req.Header.Add("Content-Type", "application/x-www-form-urlencoded") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/autodesk/autodesk.go b/pkg/detectors/autodesk/autodesk.go index 0c7600fb..abf72c04 100644 --- a/pkg/detectors/autodesk/autodesk.go +++ b/pkg/detectors/autodesk/autodesk.go @@ -59,7 +59,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`, resMatch, resSecret)) - req, _ := http.NewRequest("POST", "https://developer.api.autodesk.com/authentication/v1/authenticate", payload) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://developer.api.autodesk.com/authentication/v1/authenticate", payload) req.Header.Add("Content-Type", "application/x-www-form-urlencoded") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/autoklose/autoklose.go b/pkg/detectors/autoklose/autoklose.go index 3b31c999..1753a4c5 100644 --- a/pkg/detectors/autoklose/autoklose.go +++ b/pkg/detectors/autoklose/autoklose.go @@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://api.autoklose.com/api/campaigns/?api_token=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://api.autoklose.com/api/campaigns/?api_token=%s", resMatch), nil) res, err := client.Do(req) if err == nil { bodyBytes, err := ioutil.ReadAll(res.Body) diff --git a/pkg/detectors/autopilot/autopilot.go b/pkg/detectors/autopilot/autopilot.go index f4adcccc..d98306ae 100644 --- a/pkg/detectors/autopilot/autopilot.go +++ b/pkg/detectors/autopilot/autopilot.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api2.autopilothq.com/v1/account", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api2.autopilothq.com/v1/account", nil) req.Header.Add("autopilotapikey", resMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/aviationstack/aviationstack.go b/pkg/detectors/aviationstack/aviationstack.go index f1fcc40c..a2c205a5 100644 --- a/pkg/detectors/aviationstack/aviationstack.go +++ b/pkg/detectors/aviationstack/aviationstack.go @@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { timeout := 10 * time.Second client.Timeout = timeout - req, _ := http.NewRequest("GET", fmt.Sprintf("http://api.aviationstack.com/v1/flights?access_key=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("http://api.aviationstack.com/v1/flights?access_key=%s", resMatch), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/axonaut/axonaut.go b/pkg/detectors/axonaut/axonaut.go index fef4d9e1..19d6fe52 100644 --- a/pkg/detectors/axonaut/axonaut.go +++ b/pkg/detectors/axonaut/axonaut.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://axonaut.com/api/v2/companies?type=all&sort=id", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://axonaut.com/api/v2/companies?type=all&sort=id", nil) req.Header.Add("userApiKey", resMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/aylien/aylien.go b/pkg/detectors/aylien/aylien.go index c5329c43..7288da96 100644 --- a/pkg/detectors/aylien/aylien.go +++ b/pkg/detectors/aylien/aylien.go @@ -57,7 +57,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result Raw: []byte(resMatch), } if verify { - req, _ := http.NewRequest("GET", "https://api.aylien.com/news/stories", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.aylien.com/news/stories", nil) req.Header.Add("X-AYLIEN-NewsAPI-Application-ID", resIdMatch) req.Header.Add("X-AYLIEN-NewsAPI-Application-Key", resMatch) res, err := client.Do(req) diff --git a/pkg/detectors/ayrshare/ayrshare.go b/pkg/detectors/ayrshare/ayrshare.go index 603e6b53..56a73f17 100644 --- a/pkg/detectors/ayrshare/ayrshare.go +++ b/pkg/detectors/ayrshare/ayrshare.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://app.ayrshare.com/api/analytics/links", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://app.ayrshare.com/api/analytics/links", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/bannerbear/bannerbear.go b/pkg/detectors/bannerbear/bannerbear.go index ef7a98a6..a965b331 100644 --- a/pkg/detectors/bannerbear/bannerbear.go +++ b/pkg/detectors/bannerbear/bannerbear.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.bannerbear.com/v2/auth", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.bannerbear.com/v2/auth", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/baremetrics/baremetrics.go b/pkg/detectors/baremetrics/baremetrics.go index f97af971..5f29ff4b 100644 --- a/pkg/detectors/baremetrics/baremetrics.go +++ b/pkg/detectors/baremetrics/baremetrics.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.baremetrics.com/v1/account", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.baremetrics.com/v1/account", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/baseapiio/baseapiio.go b/pkg/detectors/baseapiio/baseapiio.go index ce004750..f0ec50ff 100644 --- a/pkg/detectors/baseapiio/baseapiio.go +++ b/pkg/detectors/baseapiio/baseapiio.go @@ -56,7 +56,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result payload := &bytes.Buffer{} writer := multipart.NewWriter(payload) _ = writer.WriteField("name", "\"My Form\"") - req, _ := http.NewRequest("POST", "https://api.base-api.io/v1/forms", payload) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://api.base-api.io/v1/forms", payload) req.Header.Set("Content-Type", writer.FormDataContentType()) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/beamer/beamer.go b/pkg/detectors/beamer/beamer.go index d71c16db..35f4ef41 100644 --- a/pkg/detectors/beamer/beamer.go +++ b/pkg/detectors/beamer/beamer.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.getbeamer.com/v0/url", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.getbeamer.com/v0/url", nil) req.Header.Add("Beamer-Api-Key", resMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/beebole/beebole.go b/pkg/detectors/beebole/beebole.go index 37f6e972..d2d83743 100644 --- a/pkg/detectors/beebole/beebole.go +++ b/pkg/detectors/beebole/beebole.go @@ -55,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result data := fmt.Sprintf("%s:X", resMatch) sEnc := b64.StdEncoding.EncodeToString([]byte(data)) payload := strings.NewReader(`{"service": "custom_field.list"}`) - req, _ := http.NewRequest("POST", "https://beebole-apps.com/api/v2", payload) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://beebole-apps.com/api/v2", payload) req.Header.Add("Content-Type", "application/json") req.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc)) res, err := client.Do(req) diff --git a/pkg/detectors/besttime/besttime.go b/pkg/detectors/besttime/besttime.go index d7b8b8da..6a64ea7e 100644 --- a/pkg/detectors/besttime/besttime.go +++ b/pkg/detectors/besttime/besttime.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://besttime.app/api/v1/keys/"+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://besttime.app/api/v1/keys/"+resMatch, nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/billomat/billomat.go b/pkg/detectors/billomat/billomat.go index e576b85c..ab4e6f2d 100644 --- a/pkg/detectors/billomat/billomat.go +++ b/pkg/detectors/billomat/billomat.go @@ -58,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://%s.billomat.net/api/v2/clients/myself", resId), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://%s.billomat.net/api/v2/clients/myself", resId), nil) req.Header.Add("Content-Type", "application/json") req.Header.Add("X-BillomatApiKey", resMatch) res, err := client.Do(req) diff --git a/pkg/detectors/bitbar/bitbar.go b/pkg/detectors/bitbar/bitbar.go index be8579fd..249dffd3 100644 --- a/pkg/detectors/bitbar/bitbar.go +++ b/pkg/detectors/bitbar/bitbar.go @@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { data := fmt.Sprintf("%s:", resMatch) baseToken := b64.StdEncoding.EncodeToString([]byte(data)) - req, _ := http.NewRequest("GET", "https://cloud.bitbar.com/api/me", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://cloud.bitbar.com/api/me", nil) req.Header.Add("Content-Type", "application/json") req.Header.Add("Authorization", fmt.Sprintf("Basic %s", baseToken)) res, err := client.Do(req) diff --git a/pkg/detectors/bitcoinaverage/bitcoinaverage.go b/pkg/detectors/bitcoinaverage/bitcoinaverage.go index 5c25241e..23427b8a 100644 --- a/pkg/detectors/bitcoinaverage/bitcoinaverage.go +++ b/pkg/detectors/bitcoinaverage/bitcoinaverage.go @@ -49,7 +49,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result Raw: []byte(resMatch), } if verify { - req, _ := http.NewRequest("GET", "https://apiv2.bitcoinaverage.com/websocket/get_ticket", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://apiv2.bitcoinaverage.com/websocket/get_ticket", nil) req.Header.Add("x-ba-key", resMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/bitlyaccesstoken/bitlyaccesstoken.go b/pkg/detectors/bitlyaccesstoken/bitlyaccesstoken.go index bb2b340d..71ab0c3c 100644 --- a/pkg/detectors/bitlyaccesstoken/bitlyaccesstoken.go +++ b/pkg/detectors/bitlyaccesstoken/bitlyaccesstoken.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api-ssl.bitly.com/v4/user", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api-ssl.bitly.com/v4/user", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/bitmex/bitmex.go b/pkg/detectors/bitmex/bitmex.go index 647edbfb..0ff028c9 100644 --- a/pkg/detectors/bitmex/bitmex.go +++ b/pkg/detectors/bitmex/bitmex.go @@ -72,7 +72,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result signature := getBitmexSignature(timestamp, resSecretMatch, action, path, payload.Encode()) - req, _ := http.NewRequest(action, "https://www.bitmex.com"+path, strings.NewReader(payload.Encode())) + req, _ := http.NewRequestWithContext(ctx, action, "https://www.bitmex.com"+path, strings.NewReader(payload.Encode())) req.Header.Add("api-expires", timestamp) req.Header.Add("api-key", resMatch) req.Header.Add("api-signature", signature) diff --git a/pkg/detectors/blablabus/blablabus.go b/pkg/detectors/blablabus/blablabus.go index 528db930..82ecc7fe 100644 --- a/pkg/detectors/blablabus/blablabus.go +++ b/pkg/detectors/blablabus/blablabus.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.idbus.com/v3/stops", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.idbus.com/v3/stops", nil) req.Header.Add("Content-Type", "application/json") req.Header.Add("Authorization", fmt.Sprintf("Token %s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/blazemeter/blazemeter.go b/pkg/detectors/blazemeter/blazemeter.go index 10a8b3f6..d4c7b793 100644 --- a/pkg/detectors/blazemeter/blazemeter.go +++ b/pkg/detectors/blazemeter/blazemeter.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.runscope.com/account", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.runscope.com/account", nil) req.Header.Add("Content-Type", "application/json") req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/blitapp/blitapp.go b/pkg/detectors/blitapp/blitapp.go index 8fc4842f..ac50bae1 100644 --- a/pkg/detectors/blitapp/blitapp.go +++ b/pkg/detectors/blitapp/blitapp.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://blitapp.com/api/apps/all", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://blitapp.com/api/apps/all", nil) req.Header.Add("API-Key", resMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/blogger/blogger.go b/pkg/detectors/blogger/blogger.go index b99ce1f0..d75956c6 100644 --- a/pkg/detectors/blogger/blogger.go +++ b/pkg/detectors/blogger/blogger.go @@ -49,7 +49,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://www.googleapis.com/blogger/v3/blogs/2399953?key="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://www.googleapis.com/blogger/v3/blogs/2399953?key="+resMatch, nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/bombbomb/bombbomb.go b/pkg/detectors/bombbomb/bombbomb.go index 5e8b0e38..a9a9e75e 100644 --- a/pkg/detectors/bombbomb/bombbomb.go +++ b/pkg/detectors/bombbomb/bombbomb.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.bombbomb.com/v2/lists/", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.bombbomb.com/v2/lists/", nil) req.Header.Add("Authorization", resMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/brandfetch/brandfetch.go b/pkg/detectors/brandfetch/brandfetch.go index b5738e08..c3b3db66 100644 --- a/pkg/detectors/brandfetch/brandfetch.go +++ b/pkg/detectors/brandfetch/brandfetch.go @@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result payload := strings.NewReader(`{ "domain": "www.example.com" }`) - req, _ := http.NewRequest("POST", "https://api.brandfetch.io/v1/color", payload) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://api.brandfetch.io/v1/color", payload) req.Header.Add("Content-Type", "application/json") req.Header.Add("x-api-key", fmt.Sprintf("%s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/browshot/browshot.go b/pkg/detectors/browshot/browshot.go index 41fe5d4d..120813e8 100644 --- a/pkg/detectors/browshot/browshot.go +++ b/pkg/detectors/browshot/browshot.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.browshot.com/api/v1/instance/list?key="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.browshot.com/api/v1/instance/list?key="+resMatch, nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/buddyns/buddyns.go b/pkg/detectors/buddyns/buddyns.go index a79424db..968a8c85 100644 --- a/pkg/detectors/buddyns/buddyns.go +++ b/pkg/detectors/buddyns/buddyns.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://www.buddyns.com/api/v2/zone/", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://www.buddyns.com/api/v2/zone/", nil) req.Header.Add("Content-Type", "application/json") req.Header.Add("Authorization", fmt.Sprintf("Token %s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/bugherd/bugherd.go b/pkg/detectors/bugherd/bugherd.go index 410685ae..02a29a21 100644 --- a/pkg/detectors/bugherd/bugherd.go +++ b/pkg/detectors/bugherd/bugherd.go @@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { data := fmt.Sprintf("%s:x", resMatch) sEnc := b64.StdEncoding.EncodeToString([]byte(data)) - req, _ := http.NewRequest("GET", "https://www.bugherd.com/api_v2/projects.json", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://www.bugherd.com/api_v2/projects.json", nil) req.Header.Add("Content-Type", "application/json") req.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc)) res, err := client.Do(req) diff --git a/pkg/detectors/bugsnag/bugsnag.go b/pkg/detectors/bugsnag/bugsnag.go index 9e63e98f..9173f936 100644 --- a/pkg/detectors/bugsnag/bugsnag.go +++ b/pkg/detectors/bugsnag/bugsnag.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.bugsnag.com/user/organizations?admin", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.bugsnag.com/user/organizations?admin", nil) req.Header.Add("Content-Type", "application/json") req.Header.Add("Authorization", fmt.Sprintf("token %s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/buildkite/buildkite.go b/pkg/detectors/buildkite/buildkite.go index 38efe88a..09216c16 100644 --- a/pkg/detectors/buildkite/buildkite.go +++ b/pkg/detectors/buildkite/buildkite.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.buildkite.com/v2/user", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.buildkite.com/v2/user", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/bulbul/bulbul.go b/pkg/detectors/bulbul/bulbul.go index 5bac39df..80383dba 100644 --- a/pkg/detectors/bulbul/bulbul.go +++ b/pkg/detectors/bulbul/bulbul.go @@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://prod-api.bulbul.io/view_all_users?api_key=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://prod-api.bulbul.io/view_all_users?api_key=%s", resMatch), nil) res, err := client.Do(req) if err == nil { bodyBytes, err := ioutil.ReadAll(res.Body) diff --git a/pkg/detectors/buttercms/buttercms.go b/pkg/detectors/buttercms/buttercms.go index 9ed90654..46bdfc3e 100644 --- a/pkg/detectors/buttercms/buttercms.go +++ b/pkg/detectors/buttercms/buttercms.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.buttercms.com/v2/posts/?auth_token="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.buttercms.com/v2/posts/?auth_token="+resMatch, nil) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/caflou/caflou.go b/pkg/detectors/caflou/caflou.go index 4209f33b..ca212698 100644 --- a/pkg/detectors/caflou/caflou.go +++ b/pkg/detectors/caflou/caflou.go @@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { timeout := 10 * time.Second client.Timeout = timeout - req, _ := http.NewRequest("GET", "https://app.caflou.com/api/v1/accounts", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://app.caflou.com/api/v1/accounts", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/calendarific/calendarific.go b/pkg/detectors/calendarific/calendarific.go index 3fd685b9..09667c11 100644 --- a/pkg/detectors/calendarific/calendarific.go +++ b/pkg/detectors/calendarific/calendarific.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://calendarific.com/api/v2/holidays?&api_key="+resMatch+"&country=US&year=2019", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://calendarific.com/api/v2/holidays?&api_key="+resMatch+"&country=US&year=2019", nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/calendlyapikey/calendlyapikey.go b/pkg/detectors/calendlyapikey/calendlyapikey.go index a48b8778..f234647d 100644 --- a/pkg/detectors/calendlyapikey/calendlyapikey.go +++ b/pkg/detectors/calendlyapikey/calendlyapikey.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.calendly.com/users/me", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.calendly.com/users/me", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/calorieninja/calorieninja.go b/pkg/detectors/calorieninja/calorieninja.go index d0b49f7f..f7b1b4c5 100644 --- a/pkg/detectors/calorieninja/calorieninja.go +++ b/pkg/detectors/calorieninja/calorieninja.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.calorieninjas.com/v1/nutrition?query", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.calorieninjas.com/v1/nutrition?query", nil) req.Header.Add("Content-Type", "application/json") req.Header.Add("X-Api-Key", resMatch) res, err := client.Do(req) diff --git a/pkg/detectors/campayn/campayn.go b/pkg/detectors/campayn/campayn.go index 02f51626..6521788b 100644 --- a/pkg/detectors/campayn/campayn.go +++ b/pkg/detectors/campayn/campayn.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://campayn.com/api/v1/lists", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://campayn.com/api/v1/lists", nil) req.Header.Add("Authorization", "TRUEREST apikey="+resMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/cannyio/cannyio.go b/pkg/detectors/cannyio/cannyio.go index aa36a6fd..2e93b769 100644 --- a/pkg/detectors/cannyio/cannyio.go +++ b/pkg/detectors/cannyio/cannyio.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { payload := strings.NewReader("apiKey=" + resMatch) - req, _ := http.NewRequest("POST", "https://canny.io/api/v1/boards/list", payload) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://canny.io/api/v1/boards/list", payload) req.Header.Add("Content-Type", "application/x-www-form-urlencoded") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/capsulecrm/capsulecrm.go b/pkg/detectors/capsulecrm/capsulecrm.go index a8ac7e37..76e28f11 100644 --- a/pkg/detectors/capsulecrm/capsulecrm.go +++ b/pkg/detectors/capsulecrm/capsulecrm.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.capsulecrm.com/api/v2/users", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.capsulecrm.com/api/v2/users", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/carboninterface/carboninterface.go b/pkg/detectors/carboninterface/carboninterface.go index 46e46732..fc6678ed 100644 --- a/pkg/detectors/carboninterface/carboninterface.go +++ b/pkg/detectors/carboninterface/carboninterface.go @@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { payload := strings.NewReader(`{"type":"flight","passengers":2,"legs":[{"departure_airport":"sfo","destination_airport":"yyz"},{"departure_airport":"yyz","destination_airport":"sfo"}]}`) - req, _ := http.NewRequest("POST", "https://www.carboninterface.com/api/v1/estimates", payload) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://www.carboninterface.com/api/v1/estimates", payload) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) req.Header.Add("Content-type", "application/json") res, err := client.Do(req) diff --git a/pkg/detectors/cashboard/cashboard.go b/pkg/detectors/cashboard/cashboard.go index 958e1e7f..34822c57 100644 --- a/pkg/detectors/cashboard/cashboard.go +++ b/pkg/detectors/cashboard/cashboard.go @@ -62,7 +62,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { data := fmt.Sprintf("%s:%s", resUser, resMatch) sEnc := b64.StdEncoding.EncodeToString([]byte(data)) - req, _ := http.NewRequest("GET", "https://api.cashboardapp.com/account.xml", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.cashboardapp.com/account.xml", nil) req.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc)) res, err := client.Do(req) diff --git a/pkg/detectors/censys/censys.go b/pkg/detectors/censys/censys.go index 1b6cac49..4e3e8939 100644 --- a/pkg/detectors/censys/censys.go +++ b/pkg/detectors/censys/censys.go @@ -57,7 +57,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://search.censys.io/api/v1/account", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://search.censys.io/api/v1/account", nil) req.SetBasicAuth(userPatMatch, tokenPatMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/centralstationcrm/centralstationcrm.go b/pkg/detectors/centralstationcrm/centralstationcrm.go index 8abfe192..19bfbb8f 100644 --- a/pkg/detectors/centralstationcrm/centralstationcrm.go +++ b/pkg/detectors/centralstationcrm/centralstationcrm.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.centralstationcrm.net/api/users.json", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.centralstationcrm.net/api/users.json", nil) req.Header.Add("X-apikey", resMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/chatbot/chatbot.go b/pkg/detectors/chatbot/chatbot.go index 8c9f21f5..ae320b2a 100644 --- a/pkg/detectors/chatbot/chatbot.go +++ b/pkg/detectors/chatbot/chatbot.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.chatbot.com/stories", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.chatbot.com/stories", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/checio/checio.go b/pkg/detectors/checio/checio.go index 09598fe9..29407d71 100644 --- a/pkg/detectors/checio/checio.go +++ b/pkg/detectors/checio/checio.go @@ -49,7 +49,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.chec.io/v1/products?limit=25", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.chec.io/v1/products?limit=25", nil) req.Header.Add("X-Authorization", resMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/checklyhq/checklyhq.go b/pkg/detectors/checklyhq/checklyhq.go index 6a231adf..b148134f 100644 --- a/pkg/detectors/checklyhq/checklyhq.go +++ b/pkg/detectors/checklyhq/checklyhq.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.checklyhq.com/v1/checks", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.checklyhq.com/v1/checks", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/checkout/checkout.go b/pkg/detectors/checkout/checkout.go index d9cd4cbd..cf00960a 100644 --- a/pkg/detectors/checkout/checkout.go +++ b/pkg/detectors/checkout/checkout.go @@ -60,7 +60,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { //Used the app's sandbox environment for this case since I can't create a live account. - req, _ := http.NewRequest("GET", "https://api.sandbox.checkout.com/customers/"+resIdMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.sandbox.checkout.com/customers/"+resIdMatch, nil) req.Header.Add("Authorization", resMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/cicero/cicero.go b/pkg/detectors/cicero/cicero.go index a0ae478f..a78c7087 100644 --- a/pkg/detectors/cicero/cicero.go +++ b/pkg/detectors/cicero/cicero.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://cicero.azavea.com/v3.1/account/credits_remaining?key=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://cicero.azavea.com/v3.1/account/credits_remaining?key=%s", resMatch), nil) req.Header.Add("Content-Type", "application/json") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/clarifai/clarifai.go b/pkg/detectors/clarifai/clarifai.go index 4c1b59c7..b2ee7acc 100644 --- a/pkg/detectors/clarifai/clarifai.go +++ b/pkg/detectors/clarifai/clarifai.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { // test for api key - req, _ := http.NewRequest("GET", "https://api.clarifai.com/v2/inputs", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.clarifai.com/v2/inputs", nil) req.Header.Add("Authorization", fmt.Sprintf("Key %s", resMatch)) res, err := client.Do(req) if err == nil { @@ -63,7 +63,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if !s1.Verified { // test for pat - req, _ := http.NewRequest("GET", "https://api.clarifai.com/v2/users/me", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.clarifai.com/v2/users/me", nil) req.Header.Add("Authorization", fmt.Sprintf("Key %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/clearbit/clearbit.go b/pkg/detectors/clearbit/clearbit.go index 0b94d26f..32583787 100644 --- a/pkg/detectors/clearbit/clearbit.go +++ b/pkg/detectors/clearbit/clearbit.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://person.clearbit.com/v1/people/email/alex@alexmaccaw.com", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://person.clearbit.com/v1/people/email/alex@alexmaccaw.com", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/clickhelp/clickhelp.go b/pkg/detectors/clickhelp/clickhelp.go index 65880dc4..d152806b 100644 --- a/pkg/detectors/clickhelp/clickhelp.go +++ b/pkg/detectors/clickhelp/clickhelp.go @@ -69,7 +69,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { data := fmt.Sprintf("%s:%s", resEmail, resKey) sEnc := b64.StdEncoding.EncodeToString([]byte(data)) - req, _ := http.NewRequest("GET", fmt.Sprintf("https://%s/api/v1/projects", resServer), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://%s/api/v1/projects", resServer), nil) req.Header.Add("Content-Type", "application/json") req.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc)) res, err := client.Do(req) diff --git a/pkg/detectors/clicksendsms/clicksendsms.go b/pkg/detectors/clicksendsms/clicksendsms.go index e515e6ce..de055c9b 100644 --- a/pkg/detectors/clicksendsms/clicksendsms.go +++ b/pkg/detectors/clicksendsms/clicksendsms.go @@ -63,7 +63,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result data := fmt.Sprintf("%s:%s", resIdMatch, resMatch) sEnc := b64.StdEncoding.EncodeToString([]byte(data)) - req, _ := http.NewRequest("GET", "https://rest.clicksend.com/v3/account", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://rest.clicksend.com/v3/account", nil) req.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/clickuppersonaltoken/clickuppersonaltoken.go b/pkg/detectors/clickuppersonaltoken/clickuppersonaltoken.go index 84d0f2e6..9bb5060c 100644 --- a/pkg/detectors/clickuppersonaltoken/clickuppersonaltoken.go +++ b/pkg/detectors/clickuppersonaltoken/clickuppersonaltoken.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.clickup.com/api/v2/user", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.clickup.com/api/v2/user", nil) req.Header.Add("Authorization", resMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/clinchpad/clinchpad.go b/pkg/detectors/clinchpad/clinchpad.go index ef77d675..5e936f2d 100644 --- a/pkg/detectors/clinchpad/clinchpad.go +++ b/pkg/detectors/clinchpad/clinchpad.go @@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { data := fmt.Sprintf("api-key:%s", resMatch) sEnc := b64.StdEncoding.EncodeToString([]byte(data)) - req, _ := http.NewRequest("GET", "https://www.clinchpad.com/api/v1/pipelines", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://www.clinchpad.com/api/v1/pipelines", nil) req.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/clockify/clockify.go b/pkg/detectors/clockify/clockify.go index ac1663a1..a08cd401 100644 --- a/pkg/detectors/clockify/clockify.go +++ b/pkg/detectors/clockify/clockify.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.clockify.me/api/v1/user", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.clockify.me/api/v1/user", nil) req.Header.Add("content-type", "application/json") req.Header.Add("X-Api-Key", fmt.Sprintf("%s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/clockworksms/clockworksms.go b/pkg/detectors/clockworksms/clockworksms.go index 3882c1d2..0c4123e0 100644 --- a/pkg/detectors/clockworksms/clockworksms.go +++ b/pkg/detectors/clockworksms/clockworksms.go @@ -58,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.textanywhere.com/API/v1.0/REST/status", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.textanywhere.com/API/v1.0/REST/status", nil) req.Header.Add("user_key", resMatch) req.Header.Add("access_token", tokenRes) res, err := client.Do(req) diff --git a/pkg/detectors/closecrm/close.go b/pkg/detectors/closecrm/close.go index 680d44bf..7190f9b8 100644 --- a/pkg/detectors/closecrm/close.go +++ b/pkg/detectors/closecrm/close.go @@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { data := fmt.Sprintf("%s:", resMatch) sEnc := b64.StdEncoding.EncodeToString([]byte(data)) - req, _ := http.NewRequest("GET", "https://api.close.com/api/v1/me/", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.close.com/api/v1/me/", nil) req.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc)) req.Header.Add("Content-Type", "application/json") res, err := client.Do(req) diff --git a/pkg/detectors/cloudelements/cloudelements.go b/pkg/detectors/cloudelements/cloudelements.go index 5ad92c7c..f03437f0 100644 --- a/pkg/detectors/cloudelements/cloudelements.go +++ b/pkg/detectors/cloudelements/cloudelements.go @@ -60,7 +60,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://staging.cloud-elements.com/elements/api-v2/accounts", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://staging.cloud-elements.com/elements/api-v2/accounts", nil) req.Header.Add("Authorization", fmt.Sprintf("User %s, Organization %s", resMatch, resOrgMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/cloudflareapitoken/cloudflareapitoken.go b/pkg/detectors/cloudflareapitoken/cloudflareapitoken.go index f66e2ca9..526f71b8 100644 --- a/pkg/detectors/cloudflareapitoken/cloudflareapitoken.go +++ b/pkg/detectors/cloudflareapitoken/cloudflareapitoken.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.cloudflare.com/client/v4/user/tokens/verify", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.cloudflare.com/client/v4/user/tokens/verify", nil) req.Header.Add("Content-Type", "application/json") req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/cloudflarecakey/cloudflarecakey.go b/pkg/detectors/cloudflarecakey/cloudflarecakey.go index 7c00cffd..2c77129c 100644 --- a/pkg/detectors/cloudflarecakey/cloudflarecakey.go +++ b/pkg/detectors/cloudflarecakey/cloudflarecakey.go @@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.cloudflare.com/client/v4/certificates?zone_id=a", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.cloudflare.com/client/v4/certificates?zone_id=a", nil) req.Header.Add("Content-Type", "application/json") req.Header.Add("user-agent", "curl/7.68.0") // pretend to be from curl so we do not wait 100+ seconds -> nice try did not work diff --git a/pkg/detectors/cloudflareglobalapikey/cloudflareglobalapikey.go b/pkg/detectors/cloudflareglobalapikey/cloudflareglobalapikey.go index 5563ec26..f7936a08 100644 --- a/pkg/detectors/cloudflareglobalapikey/cloudflareglobalapikey.go +++ b/pkg/detectors/cloudflareglobalapikey/cloudflareglobalapikey.go @@ -64,7 +64,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.cloudflare.com/client/v4/user", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.cloudflare.com/client/v4/user", nil) req.Header.Add("X-Auth-Email", emailRes) req.Header.Add("X-Auth-Key", apiKeyRes) req.Header.Add("Content-Type", "application/json") diff --git a/pkg/detectors/cloudmersive/cloudmersive.go b/pkg/detectors/cloudmersive/cloudmersive.go index d915b840..2ad964ec 100644 --- a/pkg/detectors/cloudmersive/cloudmersive.go +++ b/pkg/detectors/cloudmersive/cloudmersive.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { payload := strings.NewReader(`{"AddressString":"string","CapitalizationMode":"string"}`) - req, _ := http.NewRequest("POST", "https://api.cloudmersive.com/validate/address/parse", payload) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://api.cloudmersive.com/validate/address/parse", payload) req.Header.Add("Content-Type", "application/json") req.Header.Add("Apikey", resMatch) res, err := client.Do(req) diff --git a/pkg/detectors/cloudplan/cloudplan.go b/pkg/detectors/cloudplan/cloudplan.go index 46d6628f..9e81b591 100644 --- a/pkg/detectors/cloudplan/cloudplan.go +++ b/pkg/detectors/cloudplan/cloudplan.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.cloudplan.biz/api/user/me", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.cloudplan.biz/api/user/me", nil) req.Header.Add("session_id", resMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/cloverly/cloverly.go b/pkg/detectors/cloverly/cloverly.go index 367fb77a..574ea95c 100644 --- a/pkg/detectors/cloverly/cloverly.go +++ b/pkg/detectors/cloverly/cloverly.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.cloverly.com/2019-03-beta/account", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.cloverly.com/2019-03-beta/account", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/clustdoc/clustdoc.go b/pkg/detectors/clustdoc/clustdoc.go index e4c77483..1aa5a53e 100644 --- a/pkg/detectors/clustdoc/clustdoc.go +++ b/pkg/detectors/clustdoc/clustdoc.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://clustdoc.com/api/users", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://clustdoc.com/api/users", nil) req.Header.Add("Accept", "application/json") req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/codacy/codacy.go b/pkg/detectors/codacy/codacy.go index 79b8f5f1..9839546d 100644 --- a/pkg/detectors/codacy/codacy.go +++ b/pkg/detectors/codacy/codacy.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://app.codacy.com/api/v3/version", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://app.codacy.com/api/v3/version", nil) req.Header.Add("Accept", "application/json") req.Header.Add("api-token", resMatch) res, err := client.Do(req) diff --git a/pkg/detectors/coinapi/coinapi.go b/pkg/detectors/coinapi/coinapi.go index e178c641..3c90c3e4 100644 --- a/pkg/detectors/coinapi/coinapi.go +++ b/pkg/detectors/coinapi/coinapi.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://rest.coinapi.io/v1/exchanges", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://rest.coinapi.io/v1/exchanges", nil) req.Header.Add("X-CoinAPI-Key", resMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/coinbase/coinbase.go b/pkg/detectors/coinbase/coinbase.go index faa137ba..f9543afb 100644 --- a/pkg/detectors/coinbase/coinbase.go +++ b/pkg/detectors/coinbase/coinbase.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.coinbase.com/v2/user", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.coinbase.com/v2/user", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/coinlayer/coinlayer.go b/pkg/detectors/coinlayer/coinlayer.go index 8e5a78b8..53951022 100644 --- a/pkg/detectors/coinlayer/coinlayer.go +++ b/pkg/detectors/coinlayer/coinlayer.go @@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("http://api.coinlayer.com/api/live?access_key=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("http://api.coinlayer.com/api/live?access_key=%s", resMatch), nil) res, err := client.Do(req) if err == nil { bodyBytes, err := ioutil.ReadAll(res.Body) diff --git a/pkg/detectors/coinlib/coinlib.go b/pkg/detectors/coinlib/coinlib.go index 425a7255..a8dc0530 100644 --- a/pkg/detectors/coinlib/coinlib.go +++ b/pkg/detectors/coinlib/coinlib.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://coinlib.io/api/v1/global?key=%s&pref=EUR", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://coinlib.io/api/v1/global?key=%s&pref=EUR", resMatch), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/commercejs/commercejs.go b/pkg/detectors/commercejs/commercejs.go index 7e918184..83016775 100644 --- a/pkg/detectors/commercejs/commercejs.go +++ b/pkg/detectors/commercejs/commercejs.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.chec.io/v1/categories", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.chec.io/v1/categories", nil) req.Header.Add("X-Authorization", resMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/commodities/commodities.go b/pkg/detectors/commodities/commodities.go index 35f9e543..03b9cc0f 100644 --- a/pkg/detectors/commodities/commodities.go +++ b/pkg/detectors/commodities/commodities.go @@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { client.Timeout = 5 * time.Second - req, _ := http.NewRequest("GET", "https://commodities-api.com/api/latest?access_key="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://commodities-api.com/api/latest?access_key="+resMatch, nil) res, err := client.Do(req) if err == nil { bodyBytes, err := ioutil.ReadAll(res.Body) diff --git a/pkg/detectors/companyhub/companyhub.go b/pkg/detectors/companyhub/companyhub.go index 23c0fcc8..abd5ccad 100644 --- a/pkg/detectors/companyhub/companyhub.go +++ b/pkg/detectors/companyhub/companyhub.go @@ -59,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.companyhub.com/v1/me", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.companyhub.com/v1/me", nil) req.Header.Add("Authorization", fmt.Sprintf("%s %s", resIdMatch, resMatch)) req.Header.Add("Content-Type", "application/json") res, err := client.Do(req) diff --git a/pkg/detectors/confluent/confluent.go b/pkg/detectors/confluent/confluent.go index 611be5d7..f5c92979 100644 --- a/pkg/detectors/confluent/confluent.go +++ b/pkg/detectors/confluent/confluent.go @@ -62,7 +62,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { data := fmt.Sprintf("%s:%s", resMatch, resSecret) sEnc := b64.StdEncoding.EncodeToString([]byte(data)) - req, _ := http.NewRequest("GET", "https://api.telemetry.confluent.cloud/v2/metrics/cloud/descriptors/resources", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.telemetry.confluent.cloud/v2/metrics/cloud/descriptors/resources", nil) req.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/contentfulpersonalaccesstoken/contentfulpersonalaccesstoken.go b/pkg/detectors/contentfulpersonalaccesstoken/contentfulpersonalaccesstoken.go index ddf9a160..9bd403ae 100644 --- a/pkg/detectors/contentfulpersonalaccesstoken/contentfulpersonalaccesstoken.go +++ b/pkg/detectors/contentfulpersonalaccesstoken/contentfulpersonalaccesstoken.go @@ -49,7 +49,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.contentful.com/organizations", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.contentful.com/organizations", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", keyRes)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/convertkit/convertkit.go b/pkg/detectors/convertkit/convertkit.go index e4d5cd53..2807ece2 100644 --- a/pkg/detectors/convertkit/convertkit.go +++ b/pkg/detectors/convertkit/convertkit.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.convertkit.com/v3/forms?api_key="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.convertkit.com/v3/forms?api_key="+resMatch, nil) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/copper/copper.go b/pkg/detectors/copper/copper.go index 8d5d52d4..310797f1 100644 --- a/pkg/detectors/copper/copper.go +++ b/pkg/detectors/copper/copper.go @@ -62,7 +62,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result "page_size": 25, "sort_by": "name" }`) - req, _ := http.NewRequest("POST", "https://api.copper.com/developer_api/v1/tasks/search", payload) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://api.copper.com/developer_api/v1/tasks/search", payload) req.Header.Add("X-PW-AccessToken", resMatch) req.Header.Add("X-PW-Application", "developer_api") req.Header.Add("X-PW-UserEmail", resIdMatch) diff --git a/pkg/detectors/countrylayer/countrylayer.go b/pkg/detectors/countrylayer/countrylayer.go index 3d3ab664..a3ea6bac 100644 --- a/pkg/detectors/countrylayer/countrylayer.go +++ b/pkg/detectors/countrylayer/countrylayer.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("http://api.countrylayer.com/v2/all?access_key=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("http://api.countrylayer.com/v2/all?access_key=%s", resMatch), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/courier/courier.go b/pkg/detectors/courier/courier.go index 46e35a8c..4dbede76 100644 --- a/pkg/detectors/courier/courier.go +++ b/pkg/detectors/courier/courier.go @@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.courier.com/preferences", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.courier.com/preferences", nil) req.Header.Add("Accept", "application/json") req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/coveralls/coveralls.go b/pkg/detectors/coveralls/coveralls.go index 884bccb1..54320d17 100644 --- a/pkg/detectors/coveralls/coveralls.go +++ b/pkg/detectors/coveralls/coveralls.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://coveralls.io/api/repos/github/secretscanner02/scanner", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://coveralls.io/api/repos/github/secretscanner02/scanner", nil) req.Header.Add("Authorization", fmt.Sprintf("token %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/crowdin/crowdin.go b/pkg/detectors/crowdin/crowdin.go index 636f3bc7..f846691c 100644 --- a/pkg/detectors/crowdin/crowdin.go +++ b/pkg/detectors/crowdin/crowdin.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { - req, _ := http.NewRequest("GET", "https://api.crowdin.com/api/v2/storages", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.crowdin.com/api/v2/storages", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/cryptocompare/cryptocompare.go b/pkg/detectors/cryptocompare/cryptocompare.go index 54ba064f..62c9d2e6 100644 --- a/pkg/detectors/cryptocompare/cryptocompare.go +++ b/pkg/detectors/cryptocompare/cryptocompare.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://min-api.cryptocompare.com/data/blockchain/list?api_key="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://min-api.cryptocompare.com/data/blockchain/list?api_key="+resMatch, nil) res, err := client.Do(req) if err == nil { bodyBytes, err := ioutil.ReadAll(res.Body) diff --git a/pkg/detectors/currencycloud/currencycloud.go b/pkg/detectors/currencycloud/currencycloud.go index bfc84320..d6b1db7e 100644 --- a/pkg/detectors/currencycloud/currencycloud.go +++ b/pkg/detectors/currencycloud/currencycloud.go @@ -61,7 +61,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { // Get authentication token payload := strings.NewReader(`{"login_id":"` + resEmailMatch + `","api_key":"` + resMatch + `"`) - req, _ := http.NewRequest("POST", "https://devapi.currencycloud.com/v2/authenticate/api", payload) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://devapi.currencycloud.com/v2/authenticate/api", payload) req.Header.Add("Content-Type", "application/json") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/currencyfreaks/currencyfreaks.go b/pkg/detectors/currencyfreaks/currencyfreaks.go index 9b5e6427..b5240377 100644 --- a/pkg/detectors/currencyfreaks/currencyfreaks.go +++ b/pkg/detectors/currencyfreaks/currencyfreaks.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.currencyfreaks.com/latest?apikey="+resMatch+"&format=xml", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.currencyfreaks.com/latest?apikey="+resMatch+"&format=xml", nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/currencylayer/currencylayer.go b/pkg/detectors/currencylayer/currencylayer.go index 1b1abcbf..0ad6359a 100644 --- a/pkg/detectors/currencylayer/currencylayer.go +++ b/pkg/detectors/currencylayer/currencylayer.go @@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("http://api.currencylayer.com/live?access_key=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("http://api.currencylayer.com/live?access_key=%s", resMatch), nil) res, err := client.Do(req) if err == nil { bodyBytes, err2 := ioutil.ReadAll(res.Body) diff --git a/pkg/detectors/currencyscoop/currencyscoop.go b/pkg/detectors/currencyscoop/currencyscoop.go index 5c032a34..110305e2 100644 --- a/pkg/detectors/currencyscoop/currencyscoop.go +++ b/pkg/detectors/currencyscoop/currencyscoop.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://api.currencyscoop.com/v1/latest?api_key=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://api.currencyscoop.com/v1/latest?api_key=%s", resMatch), nil) req.Header.Add("Content-Type", "application/json") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/currentsapi/currentsapi.go b/pkg/detectors/currentsapi/currentsapi.go index 46f3c6ff..efc219be 100644 --- a/pkg/detectors/currentsapi/currentsapi.go +++ b/pkg/detectors/currentsapi/currentsapi.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.currentsapi.services/v1/latest-news", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.currentsapi.services/v1/latest-news", nil) req.Header.Add("Authorization", resMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/customerguru/customerguru.go b/pkg/detectors/customerguru/customerguru.go index 12e6bc8f..e9f8e83a 100644 --- a/pkg/detectors/customerguru/customerguru.go +++ b/pkg/detectors/customerguru/customerguru.go @@ -58,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://customer.guru/export/customers?api_secret="+resIdMatch+"&api_token="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://customer.guru/export/customers?api_secret="+resIdMatch+"&api_token="+resMatch, nil) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/customerio/customerio.go b/pkg/detectors/customerio/customerio.go index 6c0fabdd..06d09638 100644 --- a/pkg/detectors/customerio/customerio.go +++ b/pkg/detectors/customerio/customerio.go @@ -63,7 +63,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result data := fmt.Sprintf("%s:%s", resIdMatch, resMatch) sEnc := b64.StdEncoding.EncodeToString([]byte(data)) - req, _ := http.NewRequest("POST", "https://track.customer.io/api/v1/customers/5/events", payload) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://track.customer.io/api/v1/customers/5/events", payload) req.Header.Add("Content-Type", "application/x-www-form-urlencoded") req.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc)) res, err := client.Do(req) diff --git a/pkg/detectors/d7network/d7network.go b/pkg/detectors/d7network/d7network.go index 50523b48..8a6659ca 100644 --- a/pkg/detectors/d7network/d7network.go +++ b/pkg/detectors/d7network/d7network.go @@ -47,7 +47,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://rest-api.d7networks.com/secure/balance", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://rest-api.d7networks.com/secure/balance", nil) req.Header.Add("Authorization", "Basic "+resMatch) res, err := http.DefaultClient.Do(req) if err == nil { diff --git a/pkg/detectors/dailyco/dailyco.go b/pkg/detectors/dailyco/dailyco.go index 48ff4185..e06a0e48 100644 --- a/pkg/detectors/dailyco/dailyco.go +++ b/pkg/detectors/dailyco/dailyco.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.daily.co/v1/rooms", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.daily.co/v1/rooms", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/dandelion/dandelion.go b/pkg/detectors/dandelion/dandelion.go index 778e548d..34b77d6c 100644 --- a/pkg/detectors/dandelion/dandelion.go +++ b/pkg/detectors/dandelion/dandelion.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://api.dandelion.eu/datatxt/li/v1/?text=Smart&token=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://api.dandelion.eu/datatxt/li/v1/?text=Smart&token=%s", resMatch), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/datadogtoken/datadogtoken.go b/pkg/detectors/datadogtoken/datadogtoken.go index 3599df8a..6eb8ea1e 100644 --- a/pkg/detectors/datadogtoken/datadogtoken.go +++ b/pkg/detectors/datadogtoken/datadogtoken.go @@ -59,7 +59,10 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { - req, _ := http.NewRequest("GET", "https://api.datadoghq.com/api/v2/users", nil) + req, err := http.NewRequestWithContext(ctx, "GET", "https://api.datadoghq.com/api/v2/users", nil) + if err != nil { + continue + } req.Header.Add("Content-Type", "application/json") req.Header.Add("DD-API-KEY", resApiMatch) req.Header.Add("DD-APPLICATION-KEY", resMatch) diff --git a/pkg/detectors/datafire/datafire.go b/pkg/detectors/datafire/datafire.go index f7023863..04f477dd 100644 --- a/pkg/detectors/datafire/datafire.go +++ b/pkg/detectors/datafire/datafire.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.datafire.io/projects/", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.datafire.io/projects/", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/datagov/datagov.go b/pkg/detectors/datagov/datagov.go index e45930ec..234a6956 100644 --- a/pkg/detectors/datagov/datagov.go +++ b/pkg/detectors/datagov/datagov.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://api.ers.usda.gov/data/arms/state?api_key=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://api.ers.usda.gov/data/arms/state?api_key=%s", resMatch), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/debounce/debounce.go b/pkg/detectors/debounce/debounce.go index 698f4826..d19183ec 100644 --- a/pkg/detectors/debounce/debounce.go +++ b/pkg/detectors/debounce/debounce.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.debounce.io/v1/?api="+resMatch+"&email=some@gmail.com", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.debounce.io/v1/?api="+resMatch+"&email=some@gmail.com", nil) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/deepai/deepai.go b/pkg/detectors/deepai/deepai.go index 91e507f3..50673f69 100644 --- a/pkg/detectors/deepai/deepai.go +++ b/pkg/detectors/deepai/deepai.go @@ -64,7 +64,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result continue } writer.Close() - req, _ := http.NewRequest("POST", "https://api.deepai.org/api/text-tagging", bytes.NewReader(body.Bytes())) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://api.deepai.org/api/text-tagging", bytes.NewReader(body.Bytes())) req.Header.Add("Content-Type", writer.FormDataContentType()) req.Header.Add("api-key", resMatch) res, err := client.Do(req) diff --git a/pkg/detectors/deepgram/deepgram.go b/pkg/detectors/deepgram/deepgram.go index 449c46c7..a337ed24 100644 --- a/pkg/detectors/deepgram/deepgram.go +++ b/pkg/detectors/deepgram/deepgram.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.deepgram.com/v1/projects", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.deepgram.com/v1/projects", nil) req.Header.Add("Content-Type", "application/json") req.Header.Add("Authorization", fmt.Sprintf("Token %s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/delighted/delighted.go b/pkg/detectors/delighted/delighted.go index 5534fcc3..f7dd459d 100644 --- a/pkg/detectors/delighted/delighted.go +++ b/pkg/detectors/delighted/delighted.go @@ -58,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result "email": "jony@appleseed.com", "properties": { "Purchase Experience": "Mobile App", "State": "CA" } }`) - req, _ := http.NewRequest("POST", "https://api.delighted.com/v1/people.json", payload) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://api.delighted.com/v1/people.json", payload) req.Header.Add("Content-Type", "application/json") req.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc)) res, err := client.Do(req) diff --git a/pkg/detectors/deputy/deputy.go b/pkg/detectors/deputy/deputy.go index eee28933..49c8d9b3 100644 --- a/pkg/detectors/deputy/deputy.go +++ b/pkg/detectors/deputy/deputy.go @@ -59,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://%s/api/v1/me", resURL), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://%s/api/v1/me", resURL), nil) req.Header.Add("Content-Type", "application/json") req.Header.Add("Authorization", fmt.Sprintf("OAuth %s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/detectlanguage/detectlanguage.go b/pkg/detectors/detectlanguage/detectlanguage.go index 00e2283d..ee41ac0e 100644 --- a/pkg/detectors/detectlanguage/detectlanguage.go +++ b/pkg/detectors/detectlanguage/detectlanguage.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://ws.detectlanguage.com/0.2/user/status", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://ws.detectlanguage.com/0.2/user/status", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/dfuse/dfuse.go b/pkg/detectors/dfuse/dfuse.go index c7ac971e..12f95ed1 100644 --- a/pkg/detectors/dfuse/dfuse.go +++ b/pkg/detectors/dfuse/dfuse.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { payload := strings.NewReader(`{"api_key":"` + resMatch + `"}`) - req, _ := http.NewRequest("POST", "https://auth.dfuse.io/v1/auth/issue", payload) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://auth.dfuse.io/v1/auth/issue", payload) req.Header.Add("Content-Type", "application/json") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/digitaloceantoken/digitaloceantoken.go b/pkg/detectors/digitaloceantoken/digitaloceantoken.go index 2ce7084c..02e834b4 100644 --- a/pkg/detectors/digitaloceantoken/digitaloceantoken.go +++ b/pkg/detectors/digitaloceantoken/digitaloceantoken.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.digitalocean.com/v2/account", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.digitalocean.com/v2/account", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/discordbottoken/discordbottoken.go b/pkg/detectors/discordbottoken/discordbottoken.go index da5fc4a1..f8a61084 100644 --- a/pkg/detectors/discordbottoken/discordbottoken.go +++ b/pkg/detectors/discordbottoken/discordbottoken.go @@ -57,7 +57,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://discord.com/api/v8/users/"+resId, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://discord.com/api/v8/users/"+resId, nil) req.Header.Add("Authorization", fmt.Sprintf("Bot %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/discordwebhook/discordwebhook.go b/pkg/detectors/discordwebhook/discordwebhook.go index c2fd9227..6f105087 100644 --- a/pkg/detectors/discordwebhook/discordwebhook.go +++ b/pkg/detectors/discordwebhook/discordwebhook.go @@ -49,7 +49,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", resMatch, nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/ditto/ditto.go b/pkg/detectors/ditto/ditto.go index 124e64b2..e945816b 100644 --- a/pkg/detectors/ditto/ditto.go +++ b/pkg/detectors/ditto/ditto.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.dittowords.com/variants", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.dittowords.com/variants", nil) req.Header.Add("Authorization", fmt.Sprintf("token %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/dnscheck/dnscheck.go b/pkg/detectors/dnscheck/dnscheck.go index f9c94d40..218af6eb 100644 --- a/pkg/detectors/dnscheck/dnscheck.go +++ b/pkg/detectors/dnscheck/dnscheck.go @@ -58,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://www.dnscheck.co/api/v1/groups/"+resIdMatch+"?api_key="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://www.dnscheck.co/api/v1/groups/"+resIdMatch+"?api_key="+resMatch, nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/documo/documo.go b/pkg/detectors/documo/documo.go index d174a57b..08df3ad3 100644 --- a/pkg/detectors/documo/documo.go +++ b/pkg/detectors/documo/documo.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.documo.com/v1/me", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.documo.com/v1/me", nil) req.Header.Add("Content-Type", "application/json") req.Header.Add("Authorization", fmt.Sprintf("Basic %s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/doppler/doppler.go b/pkg/detectors/doppler/doppler.go index ecb5106e..219d0646 100644 --- a/pkg/detectors/doppler/doppler.go +++ b/pkg/detectors/doppler/doppler.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.doppler.com/v3/workplace", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.doppler.com/v3/workplace", nil) req.Header.Add("Accept", "application/json") req.SetBasicAuth(resMatch, "") res, err := client.Do(req) diff --git a/pkg/detectors/dotmailer/dotmailer.go b/pkg/detectors/dotmailer/dotmailer.go index 42135d02..78f482db 100644 --- a/pkg/detectors/dotmailer/dotmailer.go +++ b/pkg/detectors/dotmailer/dotmailer.go @@ -61,7 +61,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { timeout := 10 * time.Second client.Timeout = timeout - req, _ := http.NewRequest("GET", "https://r3-api.dotmailer.com/v2/account-info", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://r3-api.dotmailer.com/v2/account-info", nil) req.SetBasicAuth(resMatch, resPassMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/dovico/dovico.go b/pkg/detectors/dovico/dovico.go index 93ad4de4..c7315f0c 100644 --- a/pkg/detectors/dovico/dovico.go +++ b/pkg/detectors/dovico/dovico.go @@ -58,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.dovico.com/Employees/?version=7", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.dovico.com/Employees/?version=7", nil) req.Header.Add("Content-Type", "application/json") req.Header.Add("Authorization", fmt.Sprintf(`WRAP access_token="client=%s&user_token=%s"`, resMatch, resUser)) res, err := client.Do(req) diff --git a/pkg/detectors/dronahq/dronahq.go b/pkg/detectors/dronahq/dronahq.go index afcdfb7e..baa76064 100644 --- a/pkg/detectors/dronahq/dronahq.go +++ b/pkg/detectors/dronahq/dronahq.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://plugin.api.dronahq.com/users/?tokenkey=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://plugin.api.dronahq.com/users/?tokenkey=%s", resMatch), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/droneci/droneci.go b/pkg/detectors/droneci/droneci.go index 52104a96..9eef3538 100644 --- a/pkg/detectors/droneci/droneci.go +++ b/pkg/detectors/droneci/droneci.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://cloud.drone.io/api/user", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://cloud.drone.io/api/user", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/dropbox/dropbox.go b/pkg/detectors/dropbox/dropbox.go index 922cdf77..81b74209 100644 --- a/pkg/detectors/dropbox/dropbox.go +++ b/pkg/detectors/dropbox/dropbox.go @@ -47,7 +47,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result client := common.SaneHttpClient() - req, _ := http.NewRequest("POST", baseURL, nil) + req, _ := http.NewRequestWithContext(ctx, "POST", baseURL, nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", match[1])) res, err := client.Do(req) if err != nil { diff --git a/pkg/detectors/dwolla/dwolla.go b/pkg/detectors/dwolla/dwolla.go index e0d1f2ef..52bbdb20 100644 --- a/pkg/detectors/dwolla/dwolla.go +++ b/pkg/detectors/dwolla/dwolla.go @@ -66,7 +66,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result encoded := b64.StdEncoding.EncodeToString([]byte(data)) payload := strings.NewReader("grant_type=client_credentials") - req, _ := http.NewRequest("POST", "https://api-sandbox.dwolla.com/token", payload) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://api-sandbox.dwolla.com/token", payload) req.Header.Add("Content-Type", "application/x-www-form-urlencoded") req.Header.Add("Authorization", fmt.Sprintf("Basic %s", encoded)) diff --git a/pkg/detectors/dynalist/dynalist.go b/pkg/detectors/dynalist/dynalist.go index 2bc22fe3..c7105a89 100644 --- a/pkg/detectors/dynalist/dynalist.go +++ b/pkg/detectors/dynalist/dynalist.go @@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { payload := strings.NewReader(fmt.Sprintf(`{"token": "%s"}`, resMatch)) - req, _ := http.NewRequest("POST", "https://dynalist.io/api/v1/file/list", payload) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://dynalist.io/api/v1/file/list", payload) req.Header.Add("Content-Type", "application/json") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/dyspatch/dyspatch.go b/pkg/detectors/dyspatch/dyspatch.go index 3a462ddc..7206f329 100644 --- a/pkg/detectors/dyspatch/dyspatch.go +++ b/pkg/detectors/dyspatch/dyspatch.go @@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.dyspatch.io/templates", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.dyspatch.io/templates", nil) req.Header.Add("Accept", "application/vnd.dyspatch.2020.11+json") req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/eagleeyenetworks/eagleeyenetworks.go b/pkg/detectors/eagleeyenetworks/eagleeyenetworks.go index f4bcbb82..a9caad7e 100644 --- a/pkg/detectors/eagleeyenetworks/eagleeyenetworks.go +++ b/pkg/detectors/eagleeyenetworks/eagleeyenetworks.go @@ -60,7 +60,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { payload := strings.NewReader(fmt.Sprintf(`{"username": "%s", "password": "%s"}`, resEmailPatMatch, resMatch)) - req, _ := http.NewRequest("POST", "https://login.eagleeyenetworks.com/g/aaa/authenticate", payload) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://login.eagleeyenetworks.com/g/aaa/authenticate", payload) req.Header.Add("Content-Type", "application/json") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/easyinsight/easyinsight.go b/pkg/detectors/easyinsight/easyinsight.go index 0786901b..73a95859 100644 --- a/pkg/detectors/easyinsight/easyinsight.go +++ b/pkg/detectors/easyinsight/easyinsight.go @@ -62,7 +62,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { data := fmt.Sprintf("%s:%s", resIdMatch, resMatch) sEnc := b64.StdEncoding.EncodeToString([]byte(data)) - req, _ := http.NewRequest("GET", "https://www.easy-insight.com/app/api/users.json", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://www.easy-insight.com/app/api/users.json", nil) req.Header.Add("Content-Type", "application/json") req.Header.Add("Accept", "application/json") req.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc)) diff --git a/pkg/detectors/edamam/edamam.go b/pkg/detectors/edamam/edamam.go index 6699119f..06cd01f2 100644 --- a/pkg/detectors/edamam/edamam.go +++ b/pkg/detectors/edamam/edamam.go @@ -57,7 +57,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://api.edamam.com/auto-complete?app_id=%s&app_key=%s&q=%s", resId, resMatch, ""), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://api.edamam.com/auto-complete?app_id=%s&app_key=%s&q=%s", resId, resMatch, ""), nil) req.Header.Add("Content-Type", "application/json") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/edenai/edenai.go b/pkg/detectors/edenai/edenai.go index 3066d88d..aea9d033 100644 --- a/pkg/detectors/edenai/edenai.go +++ b/pkg/detectors/edenai/edenai.go @@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.edenai.run/v1/automl/text/project", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.edenai.run/v1/automl/text/project", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/elasticemail/elasticemail.go b/pkg/detectors/elasticemail/elasticemail.go index 36e10352..27e98e36 100644 --- a/pkg/detectors/elasticemail/elasticemail.go +++ b/pkg/detectors/elasticemail/elasticemail.go @@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.elasticemail.com/v2/account/profileoverview?apikey="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.elasticemail.com/v2/account/profileoverview?apikey="+resMatch, nil) res, err := client.Do(req) if err != nil { continue diff --git a/pkg/detectors/enigma/enigma.go b/pkg/detectors/enigma/enigma.go index 8f08373e..eda00db5 100644 --- a/pkg/detectors/enigma/enigma.go +++ b/pkg/detectors/enigma/enigma.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { payload := strings.NewReader(`{"name":"Enigma Technologies, Inc.","person":{"first_name":"","last_name":""},"address":{"street_address1":"245 5th Ave","street_address2":"","city":"New York","state":"NY","postal_code":"10016"}}`) - req, _ := http.NewRequest("POST", "https://api.enigma.com/businesses/match", payload) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://api.enigma.com/businesses/match", payload) req.Header.Add("Content-Type", "application/json") req.Header.Add("x-api-key", resMatch) res, err := client.Do(req) diff --git a/pkg/detectors/ethplorer/ethplorer.go b/pkg/detectors/ethplorer/ethplorer.go index 1a78357a..bf5a1853 100644 --- a/pkg/detectors/ethplorer/ethplorer.go +++ b/pkg/detectors/ethplorer/ethplorer.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { payload := strings.NewReader("apiKey=" + resMatch + "&addresses=0xb2930b35844a230f00e51431acae96fe543a0347%2C0xb52d3141ee731fac89927476c6a5207b37cd72ff") - req, _ := http.NewRequest("POST", "https://api-mon.ethplorer.io/createPool", payload) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://api-mon.ethplorer.io/createPool", payload) req.Header.Add("accept", "application/json") req.Header.Add("Content-Type", "application/x-www-form-urlencoded") res, err := client.Do(req) diff --git a/pkg/detectors/etsyapikey/etsyapikey.go b/pkg/detectors/etsyapikey/etsyapikey.go index 0d82d8c6..43476601 100644 --- a/pkg/detectors/etsyapikey/etsyapikey.go +++ b/pkg/detectors/etsyapikey/etsyapikey.go @@ -51,7 +51,10 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://openapi.etsy.com/v2/listings/active?api_key="+resMatch, nil) + req, err := http.NewRequestWithContext(ctx, "GET", "https://openapi.etsy.com/v2/listings/active?api_key="+resMatch, nil) + if err != nil { + continue + } res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/everhour/everhour.go b/pkg/detectors/everhour/everhour.go index bac3481f..e9c105ec 100644 --- a/pkg/detectors/everhour/everhour.go +++ b/pkg/detectors/everhour/everhour.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.everhour.com/clients", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.everhour.com/clients", nil) req.Header.Add("Content-Type", "application/json") req.Header.Add("X-Api-Key", fmt.Sprintf("%s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/exchangerateapi/exchangerateapi.go b/pkg/detectors/exchangerateapi/exchangerateapi.go index 45cbb257..91de5432 100644 --- a/pkg/detectors/exchangerateapi/exchangerateapi.go +++ b/pkg/detectors/exchangerateapi/exchangerateapi.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://v6.exchangerate-api.com/v6/%s/latest/USD", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://v6.exchangerate-api.com/v6/%s/latest/USD", resMatch), nil) req.Header.Add("Accept", "application/vnd.exchangerateapi+json; version=3") req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/exchangeratesapi/exchangeratesapi.go b/pkg/detectors/exchangeratesapi/exchangeratesapi.go index a9f23d33..b32c4169 100644 --- a/pkg/detectors/exchangeratesapi/exchangeratesapi.go +++ b/pkg/detectors/exchangeratesapi/exchangeratesapi.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("http://api.exchangeratesapi.io/v1/latest?access_key=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("http://api.exchangeratesapi.io/v1/latest?access_key=%s", resMatch), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/facebookoauth/facebookoauth.go b/pkg/detectors/facebookoauth/facebookoauth.go index cbf2ec9a..f4e704cd 100644 --- a/pkg/detectors/facebookoauth/facebookoauth.go +++ b/pkg/detectors/facebookoauth/facebookoauth.go @@ -61,7 +61,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { // thanks https://stackoverflow.com/questions/15621471/validate-a-facebook-app-id-and-app-secret - req, _ := http.NewRequest("GET", fmt.Sprintf("https://graph.facebook.com/%s?fields=roles&access_token=%s|%s", apiIdRes, apiIdRes, apiSecretRes), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://graph.facebook.com/%s?fields=roles&access_token=%s|%s", apiIdRes, apiIdRes, apiSecretRes), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/faceplusplus/faceplusplus.go b/pkg/detectors/faceplusplus/faceplusplus.go index 81f48133..77b5202c 100644 --- a/pkg/detectors/faceplusplus/faceplusplus.go +++ b/pkg/detectors/faceplusplus/faceplusplus.go @@ -58,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("POST", fmt.Sprintf("https://api-us.faceplusplus.com/facepp/v3/faceset/getfacesets?api_key=%s&api_secret=%s", resMatch, resSecret), nil) + req, _ := http.NewRequestWithContext(ctx, "POST", fmt.Sprintf("https://api-us.faceplusplus.com/facepp/v3/faceset/getfacesets?api_key=%s&api_secret=%s", resMatch, resSecret), nil) req.Header.Add("Content-Type", "application/json") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/fakejson/fakejson.go b/pkg/detectors/fakejson/fakejson.go index 2624693e..2a527685 100644 --- a/pkg/detectors/fakejson/fakejson.go +++ b/pkg/detectors/fakejson/fakejson.go @@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { payload := strings.NewReader(fmt.Sprintf(`{"token":"%s","data":{"user_name":"nameFirst","user_email":"internetEmail","_repeat":3}}`, resMatch)) - req, _ := http.NewRequest("POST", "https://app.fakejson.com/q", payload) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://app.fakejson.com/q", payload) req.Header.Add("Content-Type", "application/json") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/fastforex/fastforex.go b/pkg/detectors/fastforex/fastforex.go index 3772d4ea..c033670b 100644 --- a/pkg/detectors/fastforex/fastforex.go +++ b/pkg/detectors/fastforex/fastforex.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://api.fastforex.io/fetch-all?api_key=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://api.fastforex.io/fetch-all?api_key=%s", resMatch), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/fastlypersonaltoken/fastlypersonaltoken.go b/pkg/detectors/fastlypersonaltoken/fastlypersonaltoken.go index 837ca340..f85e18cb 100644 --- a/pkg/detectors/fastlypersonaltoken/fastlypersonaltoken.go +++ b/pkg/detectors/fastlypersonaltoken/fastlypersonaltoken.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.fastly.com/services", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.fastly.com/services", nil) req.Header.Add("Fastly-Key", fmt.Sprintf("%s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/feedier/feedier.go b/pkg/detectors/feedier/feedier.go index 4b5aa729..88657a1b 100644 --- a/pkg/detectors/feedier/feedier.go +++ b/pkg/detectors/feedier/feedier.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.feedier.com/v1/carriers", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.feedier.com/v1/carriers", nil) req.Header.Add("Accept", "application/json") req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/fetchrss/fetchrss.go b/pkg/detectors/fetchrss/fetchrss.go index 7c68183a..91e62a9e 100644 --- a/pkg/detectors/fetchrss/fetchrss.go +++ b/pkg/detectors/fetchrss/fetchrss.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "http://fetchrss.com/api/v1/feed/create?auth="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "http://fetchrss.com/api/v1/feed/create?auth="+resMatch, nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/figmapersonalaccesstoken/figmapersonalaccesstoken.go b/pkg/detectors/figmapersonalaccesstoken/figmapersonalaccesstoken.go index 590a59ae..76d67e29 100644 --- a/pkg/detectors/figmapersonalaccesstoken/figmapersonalaccesstoken.go +++ b/pkg/detectors/figmapersonalaccesstoken/figmapersonalaccesstoken.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.figma.com/v1/me", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.figma.com/v1/me", nil) req.Header.Add("X-Figma-Token", fmt.Sprintf("%s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/fileio/fileio.go b/pkg/detectors/fileio/fileio.go index 96b0a764..47b21ae8 100644 --- a/pkg/detectors/fileio/fileio.go +++ b/pkg/detectors/fileio/fileio.go @@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://file.io/", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://file.io/", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/finage/finage.go b/pkg/detectors/finage/finage.go index d5268663..80b5406d 100644 --- a/pkg/detectors/finage/finage.go +++ b/pkg/detectors/finage/finage.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://api.finage.co.uk/symbol-list/crypto?apikey=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://api.finage.co.uk/symbol-list/crypto?apikey=%s", resMatch), nil) req.Header.Add("Content-Type", "application/json") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/financialmodelingprep/financialmodelingprep.go b/pkg/detectors/financialmodelingprep/financialmodelingprep.go index 019b6437..85c0a9e4 100644 --- a/pkg/detectors/financialmodelingprep/financialmodelingprep.go +++ b/pkg/detectors/financialmodelingprep/financialmodelingprep.go @@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://financialmodelingprep.com/api/v3/financial-statement-symbol-lists?apikey=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://financialmodelingprep.com/api/v3/financial-statement-symbol-lists?apikey=%s", resMatch), nil) res, err := client.Do(req) if err == nil { bodyBytes, err := ioutil.ReadAll(res.Body) diff --git a/pkg/detectors/findl/findl.go b/pkg/detectors/findl/findl.go index 2007b5d8..c507e6b7 100644 --- a/pkg/detectors/findl/findl.go +++ b/pkg/detectors/findl/findl.go @@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { timeout := 5 * time.Second client.Timeout = timeout - req, _ := http.NewRequest("GET", "https://api.findl.com/v1.0/query?limit=6", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.findl.com/v1.0/query?limit=6", nil) req.Header.Add("X-API-Key", resMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/finnhub/finnhub.go b/pkg/detectors/finnhub/finnhub.go index 5e751c50..b776cbad 100644 --- a/pkg/detectors/finnhub/finnhub.go +++ b/pkg/detectors/finnhub/finnhub.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://finnhub.io/api/v1/calendar/economic?token=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://finnhub.io/api/v1/calendar/economic?token=%s", resMatch), nil) req.Header.Add("Content-Type", "application/json") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/fixerio/fixerio.go b/pkg/detectors/fixerio/fixerio.go index 41d8bc28..0dbd25c0 100644 --- a/pkg/detectors/fixerio/fixerio.go +++ b/pkg/detectors/fixerio/fixerio.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "http://data.fixer.io/api/latest?access_key="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "http://data.fixer.io/api/latest?access_key="+resMatch, nil) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/flatio/flatio.go b/pkg/detectors/flatio/flatio.go index 7d7b6a21..5dcadaba 100644 --- a/pkg/detectors/flatio/flatio.go +++ b/pkg/detectors/flatio/flatio.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.flat.io/v2/me", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.flat.io/v2/me", nil) req.Header.Add("Accept", "application/json") req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/fleetbase/fleetbase.go b/pkg/detectors/fleetbase/fleetbase.go index 00d258a4..8cb436b6 100644 --- a/pkg/detectors/fleetbase/fleetbase.go +++ b/pkg/detectors/fleetbase/fleetbase.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.fleetbase.io/v1/contacts/", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.fleetbase.io/v1/contacts/", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/flickr/flickr.go b/pkg/detectors/flickr/flickr.go index 84f658b0..890e3ec4 100644 --- a/pkg/detectors/flickr/flickr.go +++ b/pkg/detectors/flickr/flickr.go @@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://www.flickr.com/services/rest/?method=flickr.tags.getHotList&api_key=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://www.flickr.com/services/rest/?method=flickr.tags.getHotList&api_key=%s", resMatch), nil) req.Header.Add("Content-Type", "application/json") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/flightapi/flightapi.go b/pkg/detectors/flightapi/flightapi.go index f0f1114a..502e2440 100644 --- a/pkg/detectors/flightapi/flightapi.go +++ b/pkg/detectors/flightapi/flightapi.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://api.flightapi.io/iata/%s/london/airport", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://api.flightapi.io/iata/%s/london/airport", resMatch), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/float/float.go b/pkg/detectors/float/float.go index a5320f76..5ba9d9f5 100644 --- a/pkg/detectors/float/float.go +++ b/pkg/detectors/float/float.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.float.com/v3/people", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.float.com/v3/people", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/flowflu/flowflu.go b/pkg/detectors/flowflu/flowflu.go index bd35f5d4..a3c69bee 100644 --- a/pkg/detectors/flowflu/flowflu.go +++ b/pkg/detectors/flowflu/flowflu.go @@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://secretscanner.flowlu.com/api/v1/module/crm/lead/list?api_key=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://secretscanner.flowlu.com/api/v1/module/crm/lead/list?api_key=%s", resMatch), nil) res, err := client.Do(req) if err == nil { bodyBytes, err := ioutil.ReadAll(res.Body) diff --git a/pkg/detectors/flutterwave/flutterwave.go b/pkg/detectors/flutterwave/flutterwave.go index 7c0a1d17..1ed7320b 100644 --- a/pkg/detectors/flutterwave/flutterwave.go +++ b/pkg/detectors/flutterwave/flutterwave.go @@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.flutterwave.com/v3/subaccounts", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.flutterwave.com/v3/subaccounts", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/fmfw/fmfw.go b/pkg/detectors/fmfw/fmfw.go index e251fe9b..a642c358 100644 --- a/pkg/detectors/fmfw/fmfw.go +++ b/pkg/detectors/fmfw/fmfw.go @@ -62,7 +62,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { timeout := 10 * time.Second client.Timeout = timeout - req, _ := http.NewRequest("GET", "https://api.fmfw.io/api/3/spot/balance", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.fmfw.io/api/3/spot/balance", nil) req.SetBasicAuth(userPatMatch, tokenPatMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/foursquare/foursquare.go b/pkg/detectors/foursquare/foursquare.go index e0215756..26ae11f3 100644 --- a/pkg/detectors/foursquare/foursquare.go +++ b/pkg/detectors/foursquare/foursquare.go @@ -57,7 +57,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://api.foursquare.com/v2/venues/trending?client_id=%s&client_secret=%s&v=20211019&near=LA", resMatch, resSecret), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://api.foursquare.com/v2/venues/trending?client_id=%s&client_secret=%s&v=20211019&near=LA", resMatch, resSecret), nil) req.Header.Add("Content-Type", "application/json") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/frameio/frameio.go b/pkg/detectors/frameio/frameio.go index 52c51d4f..43f25e1d 100644 --- a/pkg/detectors/frameio/frameio.go +++ b/pkg/detectors/frameio/frameio.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.frame.io/v2/me", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.frame.io/v2/me", nil) req.Header.Add("Content-Type", "application/json") req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/freshbooks/freshbooks.go b/pkg/detectors/freshbooks/freshbooks.go index b2c84d18..f5e1b978 100644 --- a/pkg/detectors/freshbooks/freshbooks.go +++ b/pkg/detectors/freshbooks/freshbooks.go @@ -59,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf(`https://auth.freshbooks.com/oauth/authorize?client_id=%s&redirect_uri=%s&response_type=code`, resMatch, resURI), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf(`https://auth.freshbooks.com/oauth/authorize?client_id=%s&redirect_uri=%s&response_type=code`, resMatch, resURI), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/freshdesk/freshdesk.go b/pkg/detectors/freshdesk/freshdesk.go index 3e7c7af0..dbe31aa2 100644 --- a/pkg/detectors/freshdesk/freshdesk.go +++ b/pkg/detectors/freshdesk/freshdesk.go @@ -61,7 +61,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { data := fmt.Sprintf("%s:X", resMatch) sEnc := b64.StdEncoding.EncodeToString([]byte(data)) - req, _ := http.NewRequest("GET", fmt.Sprintf("https://%s/api/v2/tickets", resURL), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://%s/api/v2/tickets", resURL), nil) req.Header.Add("Content-Type", "application/json") req.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc)) res, err := client.Do(req) diff --git a/pkg/detectors/front/front.go b/pkg/detectors/front/front.go index 667a043e..fb6fdf4a 100644 --- a/pkg/detectors/front/front.go +++ b/pkg/detectors/front/front.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api2.frontapp.com/accounts", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api2.frontapp.com/accounts", nil) req.Header.Add("Accept", "application/json") req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/fulcrum/fulcrum.go b/pkg/detectors/fulcrum/fulcrum.go index fb7e5058..f323599f 100644 --- a/pkg/detectors/fulcrum/fulcrum.go +++ b/pkg/detectors/fulcrum/fulcrum.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.fulcrumapp.com/api/v2/forms.json", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.fulcrumapp.com/api/v2/forms.json", nil) req.Header.Add("Accept", "application/json") req.Header.Add("X-ApiToken", fmt.Sprintf("%s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/fullstory/fullstory.go b/pkg/detectors/fullstory/fullstory.go index 2a927e7e..74ea02f2 100644 --- a/pkg/detectors/fullstory/fullstory.go +++ b/pkg/detectors/fullstory/fullstory.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.fullstory.com/operations/v1", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.fullstory.com/operations/v1", nil) req.Header.Add("Authorization", fmt.Sprintf("Basic %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/fusebill/fusebill.go b/pkg/detectors/fusebill/fusebill.go index c161efb2..51d36286 100644 --- a/pkg/detectors/fusebill/fusebill.go +++ b/pkg/detectors/fusebill/fusebill.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://secure.fusebill.com/v1/customers?pageSize=100&pageNumber=0", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://secure.fusebill.com/v1/customers?pageSize=100&pageNumber=0", nil) req.Header.Add("Authorization", fmt.Sprintf("Basic %s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/fxmarket/fxmarket.go b/pkg/detectors/fxmarket/fxmarket.go index 17d7b8a2..c4c248ac 100644 --- a/pkg/detectors/fxmarket/fxmarket.go +++ b/pkg/detectors/fxmarket/fxmarket.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://fxmarketapi.com/apilive?api_key=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://fxmarketapi.com/apilive?api_key=%s", resMatch), nil) req.Header.Add("Content-Type", "application/json") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/geckoboard/geckoboard.go b/pkg/detectors/geckoboard/geckoboard.go index 7b935aae..5237321e 100644 --- a/pkg/detectors/geckoboard/geckoboard.go +++ b/pkg/detectors/geckoboard/geckoboard.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.geckoboard.com/", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.geckoboard.com/", nil) req.Header.Add("Authorization", fmt.Sprintf("Basic %s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/gengo/gengo.go b/pkg/detectors/gengo/gengo.go index 89c3b22c..1a9e9765 100644 --- a/pkg/detectors/gengo/gengo.go +++ b/pkg/detectors/gengo/gengo.go @@ -71,7 +71,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result timestamp := strconv.FormatInt(time.Now().Unix(), 10) signature := getGengoSignature(timestamp, resSecretMatch) - req, _ := http.NewRequest("GET", fmt.Sprintf("http://api.gengo.com/v2/account/me?ts=%s&api_key=%s&api_sig=%s", timestamp, resMatch, signature), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("http://api.gengo.com/v2/account/me?ts=%s&api_key=%s&api_sig=%s", timestamp, resMatch, signature), nil) req.Header.Add("Accept", "application/json") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/geoapify/geoapify.go b/pkg/detectors/geoapify/geoapify.go index a66bd2fa..4b00e5c8 100644 --- a/pkg/detectors/geoapify/geoapify.go +++ b/pkg/detectors/geoapify/geoapify.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://api.geoapify.com/v1/geocode/search?text=California&apiKey=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://api.geoapify.com/v1/geocode/search?text=California&apiKey=%s", resMatch), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/geocode/geocode.go b/pkg/detectors/geocode/geocode.go index 52fc3a0d..33bc5226 100644 --- a/pkg/detectors/geocode/geocode.go +++ b/pkg/detectors/geocode/geocode.go @@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://geocode.xyz/51.4647,0.0079?json=1&auth=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://geocode.xyz/51.4647,0.0079?json=1&auth=%s", resMatch), nil) res, err := client.Do(req) if err == nil { bodyBytes, err := ioutil.ReadAll(res.Body) diff --git a/pkg/detectors/geocodify/geocodify.go b/pkg/detectors/geocodify/geocodify.go index f7687f72..02665644 100644 --- a/pkg/detectors/geocodify/geocodify.go +++ b/pkg/detectors/geocodify/geocodify.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.geocodify.com/v2/geocode?api_key="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.geocodify.com/v2/geocode?api_key="+resMatch, nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/geocodio/geocodio.go b/pkg/detectors/geocodio/geocodio.go index f0c9ab57..0a349ba3 100644 --- a/pkg/detectors/geocodio/geocodio.go +++ b/pkg/detectors/geocodio/geocodio.go @@ -58,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://api.geocod.io/v1.6/geocode?q=%s&api_key=%s", resSearchMatch, resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://api.geocod.io/v1.6/geocode?q=%s&api_key=%s", resSearchMatch, resMatch), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/geoipifi/geoipifi.go b/pkg/detectors/geoipifi/geoipifi.go index 300ee4ec..12a29c5d 100644 --- a/pkg/detectors/geoipifi/geoipifi.go +++ b/pkg/detectors/geoipifi/geoipifi.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://geo.ipify.org/api/v2/country?apiKey="+resMatch+"&ipAddress=8.8.8.8", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://geo.ipify.org/api/v2/country?apiKey="+resMatch+"&ipAddress=8.8.8.8", nil) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/getemail/getemail.go b/pkg/detectors/getemail/getemail.go index 41951ded..f84fbb87 100644 --- a/pkg/detectors/getemail/getemail.go +++ b/pkg/detectors/getemail/getemail.go @@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://api.getemail.io/v1/find-mail?firstname=Larry&lastname=Page&domain=google.com&api_key=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://api.getemail.io/v1/find-mail?firstname=Larry&lastname=Page&domain=google.com&api_key=%s", resMatch), nil) res, err := client.Do(req) if err == nil { bodyBytes, err := ioutil.ReadAll(res.Body) diff --git a/pkg/detectors/getemails/getemails.go b/pkg/detectors/getemails/getemails.go index 2f5f5c4b..ddf83eec 100644 --- a/pkg/detectors/getemails/getemails.go +++ b/pkg/detectors/getemails/getemails.go @@ -59,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.getemails.com/api/v1/contacts", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.getemails.com/api/v1/contacts", nil) req.Header.Add("api-key", resMatch) req.Header.Add("api-id", resIdMatch) diff --git a/pkg/detectors/getgeoapi/getgeoapi.go b/pkg/detectors/getgeoapi/getgeoapi.go index 092e84b1..17d0feee 100644 --- a/pkg/detectors/getgeoapi/getgeoapi.go +++ b/pkg/detectors/getgeoapi/getgeoapi.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://api.getgeoapi.com/v2/currency/list?api_key=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://api.getgeoapi.com/v2/currency/list?api_key=%s", resMatch), nil) req.Header.Add("Content-Type", "application/json") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/getgist/getgist.go b/pkg/detectors/getgist/getgist.go index 8b1fd3bf..57cfafa1 100644 --- a/pkg/detectors/getgist/getgist.go +++ b/pkg/detectors/getgist/getgist.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.getgist.com/contacts/", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.getgist.com/contacts/", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/getsandbox/getsandbox.go b/pkg/detectors/getsandbox/getsandbox.go index 5399115b..385bb7ad 100644 --- a/pkg/detectors/getsandbox/getsandbox.go +++ b/pkg/detectors/getsandbox/getsandbox.go @@ -59,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://getsandbox.com/api/1/sandboxes/%s", resIdMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://getsandbox.com/api/1/sandboxes/%s", resIdMatch), nil) req.Header.Add("API-Key", resMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/githubapp/githubapp.go b/pkg/detectors/githubapp/githubapp.go index d9da9d06..635e5eec 100644 --- a/pkg/detectors/githubapp/githubapp.go +++ b/pkg/detectors/githubapp/githubapp.go @@ -82,7 +82,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } //end get token - req, _ := http.NewRequest("GET", "https://api.github.com/app", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.github.com/app", nil) req.Header.Add("Accept", "application/vnd.github.v3+json") req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", tokenString)) res, err := client.Do(req) diff --git a/pkg/detectors/gitlab/gitlab.go b/pkg/detectors/gitlab/gitlab.go index cea05d9b..04c112e5 100644 --- a/pkg/detectors/gitlab/gitlab.go +++ b/pkg/detectors/gitlab/gitlab.go @@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result client := common.SaneHttpClient() // test `read_user` scope - req, _ := http.NewRequest("GET", baseURL+"/user", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", baseURL+"/user", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", match[1])) res, err := client.Do(req) if err != nil { diff --git a/pkg/detectors/gitlabv2/gitlab.go b/pkg/detectors/gitlabv2/gitlab.go index c7b69a58..c8f91a1c 100644 --- a/pkg/detectors/gitlabv2/gitlab.go +++ b/pkg/detectors/gitlabv2/gitlab.go @@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result client := common.SaneHttpClient() // test `read_user` scope - req, _ := http.NewRequest("GET", baseURL+"/user", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", baseURL+"/user", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", match[1])) res, err := client.Do(req) if err != nil { diff --git a/pkg/detectors/gitter/gitter.go b/pkg/detectors/gitter/gitter.go index 9f81ff24..67c44034 100644 --- a/pkg/detectors/gitter/gitter.go +++ b/pkg/detectors/gitter/gitter.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.gitter.im/v1/user/me", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.gitter.im/v1/user/me", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/glassnode/glassnode.go b/pkg/detectors/glassnode/glassnode.go index 1b7e7b98..252b0fdc 100644 --- a/pkg/detectors/glassnode/glassnode.go +++ b/pkg/detectors/glassnode/glassnode.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.glassnode.com/v1/metrics/indicators/sopr?a=btc&api_key="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.glassnode.com/v1/metrics/indicators/sopr?a=btc&api_key="+resMatch, nil) req.Header.Add("Content-Type", "application/json") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/gocardless/gocardless.go b/pkg/detectors/gocardless/gocardless.go index a6da73df..9688be58 100644 --- a/pkg/detectors/gocardless/gocardless.go +++ b/pkg/detectors/gocardless/gocardless.go @@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.gocardless.com/customers/", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.gocardless.com/customers/", nil) req.Header.Add("Content-Type", "application/json") req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) req.Header.Add("GoCardless-Version", "2015-07-06") diff --git a/pkg/detectors/goodday/goodday.go b/pkg/detectors/goodday/goodday.go index fa081eaa..d6dae654 100644 --- a/pkg/detectors/goodday/goodday.go +++ b/pkg/detectors/goodday/goodday.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.goodday.work/2.0/users", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.goodday.work/2.0/users", nil) req.Header.Add("gd-api-token", resMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/graphcms/graphcms.go b/pkg/detectors/graphcms/graphcms.go index a55a9123..0a0ef572 100644 --- a/pkg/detectors/graphcms/graphcms.go +++ b/pkg/detectors/graphcms/graphcms.go @@ -61,7 +61,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { payload := strings.NewReader(`{users {id name}}`) - req, _ := http.NewRequest("POST", "https://api-ap-northeast-1.graphcms.com/v2/"+resIdMatch+"/master", payload) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://api-ap-northeast-1.graphcms.com/v2/"+resIdMatch+"/master", payload) req.Header.Add("Content-Type", "application/graphql") req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) diff --git a/pkg/detectors/graphhopper/graphhopper.go b/pkg/detectors/graphhopper/graphhopper.go index 68cf762b..fed10583 100644 --- a/pkg/detectors/graphhopper/graphhopper.go +++ b/pkg/detectors/graphhopper/graphhopper.go @@ -47,7 +47,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result Raw: []byte(resMatch), } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://graphhopper.com/api/1/geocode?q=Philippines&key=%s&type=json", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://graphhopper.com/api/1/geocode?q=Philippines&key=%s&type=json", resMatch), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/groovehq/groovehq.go b/pkg/detectors/groovehq/groovehq.go index 9835a95f..e2d3d5c2 100644 --- a/pkg/detectors/groovehq/groovehq.go +++ b/pkg/detectors/groovehq/groovehq.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.groovehq.com/v1/me", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.groovehq.com/v1/me", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/guardianapi/guardianapi.go b/pkg/detectors/guardianapi/guardianapi.go index 25f152ca..1058c94e 100644 --- a/pkg/detectors/guardianapi/guardianapi.go +++ b/pkg/detectors/guardianapi/guardianapi.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://content.guardianapis.com/search?api-key="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://content.guardianapis.com/search?api-key="+resMatch, nil) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/guru/guru.go b/pkg/detectors/guru/guru.go index 2bc3f187..46e9a971 100644 --- a/pkg/detectors/guru/guru.go +++ b/pkg/detectors/guru/guru.go @@ -65,7 +65,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result data := fmt.Sprintf("%s:%s", unameMatch, keyMatch) encoded := b64.StdEncoding.EncodeToString([]byte(data)) - req, _ := http.NewRequest("GET", "https://api.getguru.com/api/v1/teams/teamId/stats", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.getguru.com/api/v1/teams/teamId/stats", nil) req.Header.Add("Authorization", fmt.Sprintf("Basic %s", encoded)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/gyazo/gyazo.go b/pkg/detectors/gyazo/gyazo.go index d3d56596..e3a541fb 100644 --- a/pkg/detectors/gyazo/gyazo.go +++ b/pkg/detectors/gyazo/gyazo.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.gyazo.com/api/images?access_token="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.gyazo.com/api/images?access_token="+resMatch, nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/happi/happi.go b/pkg/detectors/happi/happi.go index 41435064..402bdf4e 100644 --- a/pkg/detectors/happi/happi.go +++ b/pkg/detectors/happi/happi.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.happi.dev/v1/exchange", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.happi.dev/v1/exchange", nil) req.Header.Add("x-happi-key", resMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/happyscribe/happyscribe.go b/pkg/detectors/happyscribe/happyscribe.go index 266fdf32..a2635129 100644 --- a/pkg/detectors/happyscribe/happyscribe.go +++ b/pkg/detectors/happyscribe/happyscribe.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://www.happyscribe.com/api/v1/transcriptions", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://www.happyscribe.com/api/v1/transcriptions", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/harvest/harvest.go b/pkg/detectors/harvest/harvest.go index 2dcf9b17..016704d9 100644 --- a/pkg/detectors/harvest/harvest.go +++ b/pkg/detectors/harvest/harvest.go @@ -57,7 +57,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.harvestapp.com/v2/users/me?access_token="+resMatch+"&account_id="+resIdMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.harvestapp.com/v2/users/me?access_token="+resMatch+"&account_id="+resIdMatch, nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/hellosign/hellosign.go b/pkg/detectors/hellosign/hellosign.go index 27afad88..5f5a1471 100644 --- a/pkg/detectors/hellosign/hellosign.go +++ b/pkg/detectors/hellosign/hellosign.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.hellosign.com/v3/account", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.hellosign.com/v3/account", nil) req.SetBasicAuth(resMatch, "") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/helpcrunch/helpcrunch.go b/pkg/detectors/helpcrunch/helpcrunch.go index 8f3f885f..e88bf104 100644 --- a/pkg/detectors/helpcrunch/helpcrunch.go +++ b/pkg/detectors/helpcrunch/helpcrunch.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.helpcrunch.com/v1/departments", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.helpcrunch.com/v1/departments", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/helpscout/helpscout.go b/pkg/detectors/helpscout/helpscout.go index a4c29432..5009ee20 100644 --- a/pkg/detectors/helpscout/helpscout.go +++ b/pkg/detectors/helpscout/helpscout.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://docsapi.helpscout.net/v1/collections", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://docsapi.helpscout.net/v1/collections", nil) req.Header.Add("Authorization", fmt.Sprintf("Basic %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/hereapi/hereapi.go b/pkg/detectors/hereapi/hereapi.go index 71f6497e..611be4bb 100644 --- a/pkg/detectors/hereapi/hereapi.go +++ b/pkg/detectors/hereapi/hereapi.go @@ -49,7 +49,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://weather.ls.hereapi.com/weather/1.0/report.json?product=alerts&name=Argentina&apiKey=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://weather.ls.hereapi.com/weather/1.0/report.json?product=alerts&name=Argentina&apiKey=%s", resMatch), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/heroku/heroku.go b/pkg/detectors/heroku/heroku.go index 6836dac6..dca48ae1 100644 --- a/pkg/detectors/heroku/heroku.go +++ b/pkg/detectors/heroku/heroku.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.heroku.com/apps", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.heroku.com/apps", nil) req.Header.Add("Accept", "application/vnd.heroku+json; version=3") req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/hive/hive.go b/pkg/detectors/hive/hive.go index c8d7dfca..04464edc 100644 --- a/pkg/detectors/hive/hive.go +++ b/pkg/detectors/hive/hive.go @@ -59,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://app.hive.com/api/v1/testcredentials?user_id="+idMatch+"&api_key="+keyMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://app.hive.com/api/v1/testcredentials?user_id="+idMatch+"&api_key="+keyMatch, nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/hiveage/hiveage.go b/pkg/detectors/hiveage/hiveage.go index 5a6fa05b..ad84b853 100644 --- a/pkg/detectors/hiveage/hiveage.go +++ b/pkg/detectors/hiveage/hiveage.go @@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { data := fmt.Sprintf("%s:", resMatch) encoded := b64.StdEncoding.EncodeToString([]byte(data)) - req, _ := http.NewRequest("GET", "https://mltb8350.hiveage.com/api/network", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://mltb8350.hiveage.com/api/network", nil) req.Header.Add("Accept", "application/json") req.Header.Add("Authorization", fmt.Sprintf("Basic %s", encoded)) res, err := client.Do(req) diff --git a/pkg/detectors/holidayapi/holidayapi.go b/pkg/detectors/holidayapi/holidayapi.go index 9a4bdffd..cc779bd5 100644 --- a/pkg/detectors/holidayapi/holidayapi.go +++ b/pkg/detectors/holidayapi/holidayapi.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://holidayapi.com/v1/holidays?key=%s&country=PH&year=2020", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://holidayapi.com/v1/holidays?key=%s&country=PH&year=2020", resMatch), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/host/host.go b/pkg/detectors/host/host.go index b56597e2..b1f59575 100644 --- a/pkg/detectors/host/host.go +++ b/pkg/detectors/host/host.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://host.io/api/domains/ip/8.8.8.8?token=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://host.io/api/domains/ip/8.8.8.8?token=%s", resMatch), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/hubspotapikey/hubspotapikey.go b/pkg/detectors/hubspotapikey/hubspotapikey.go index 26762efb..92546b13 100644 --- a/pkg/detectors/hubspotapikey/hubspotapikey.go +++ b/pkg/detectors/hubspotapikey/hubspotapikey.go @@ -46,7 +46,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.hubapi.com/contacts/v1/lists?hapikey="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.hubapi.com/contacts/v1/lists?hapikey="+resMatch, nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/humanity/humanity.go b/pkg/detectors/humanity/humanity.go index 7844522c..7a6d07d0 100644 --- a/pkg/detectors/humanity/humanity.go +++ b/pkg/detectors/humanity/humanity.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://www.humanity.com/api/v2/me?access_token="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://www.humanity.com/api/v2/me?access_token="+resMatch, nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/hunter/hunter.go b/pkg/detectors/hunter/hunter.go index fae8200b..963d01ca 100644 --- a/pkg/detectors/hunter/hunter.go +++ b/pkg/detectors/hunter/hunter.go @@ -49,7 +49,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.hunter.io/v2/leads_lists?api_key="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.hunter.io/v2/leads_lists?api_key="+resMatch, nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/hypertrack/hypertrack.go b/pkg/detectors/hypertrack/hypertrack.go index 294f0b1f..3eb43d61 100644 --- a/pkg/detectors/hypertrack/hypertrack.go +++ b/pkg/detectors/hypertrack/hypertrack.go @@ -59,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://v3.api.hypertrack.com/trips/", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://v3.api.hypertrack.com/trips/", nil) req.SetBasicAuth(resAccMatch, resMatch) req.Header.Add("Content-Type", "application/json") res, err := client.Do(req) diff --git a/pkg/detectors/ibmclouduserkey/ibmclouduserkey.go b/pkg/detectors/ibmclouduserkey/ibmclouduserkey.go index b4a5724f..52d174e7 100644 --- a/pkg/detectors/ibmclouduserkey/ibmclouduserkey.go +++ b/pkg/detectors/ibmclouduserkey/ibmclouduserkey.go @@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { payload := strings.NewReader(`apikey=` + resMatch + `&grant_type=urn%3Aibm%3Aparams%3Aoauth%3Agrant-type%3Aapikey`) - req, _ := http.NewRequest("POST", "https://iam.ng.bluemix.net/identity/token", payload) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://iam.ng.bluemix.net/identity/token", payload) req.Header.Add("Content-Type", "application/x-www-form-urlencoded") req.Header.Add("Authorization", "Basic Yng6Yng=") res, err := client.Do(req) diff --git a/pkg/detectors/iconfinder/iconfinder.go b/pkg/detectors/iconfinder/iconfinder.go index 05ebd571..d2e8ba4b 100644 --- a/pkg/detectors/iconfinder/iconfinder.go +++ b/pkg/detectors/iconfinder/iconfinder.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.iconfinder.com/v4/iconsets", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.iconfinder.com/v4/iconsets", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/iexcloud/iexcloud.go b/pkg/detectors/iexcloud/iexcloud.go index bb3a9a4a..d5ad41cf 100644 --- a/pkg/detectors/iexcloud/iexcloud.go +++ b/pkg/detectors/iexcloud/iexcloud.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://cloud.iexapis.com/v1/stock/aapl/quote?token=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://cloud.iexapis.com/v1/stock/aapl/quote?token=%s", resMatch), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/imagekit/imagekit.go b/pkg/detectors/imagekit/imagekit.go index 63f25fea..03c220d8 100644 --- a/pkg/detectors/imagekit/imagekit.go +++ b/pkg/detectors/imagekit/imagekit.go @@ -49,7 +49,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result Raw: []byte(resMatch), } if verify { - req, _ := http.NewRequest("GET", "https://api.imagekit.io/v1/files", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.imagekit.io/v1/files", nil) req.SetBasicAuth(resMatch, "") res, err := client.Do(req) diff --git a/pkg/detectors/imagga/imagga.go b/pkg/detectors/imagga/imagga.go index ade80e1a..0f57e495 100644 --- a/pkg/detectors/imagga/imagga.go +++ b/pkg/detectors/imagga/imagga.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.imagga.com/v2/usage", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.imagga.com/v2/usage", nil) req.Header.Add("Content-Type", "application/json") req.Header.Add("Authorization", fmt.Sprintf("Basic %s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/impala/impala.go b/pkg/detectors/impala/impala.go index 7a8795bf..e23c2575 100644 --- a/pkg/detectors/impala/impala.go +++ b/pkg/detectors/impala/impala.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://sandbox.impala.travel/v1/bookings", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://sandbox.impala.travel/v1/bookings", nil) req.Header.Add("x-api-key", fmt.Sprintf("%s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/insightly/insightly.go b/pkg/detectors/insightly/insightly.go index 68dd4ba0..235cd30e 100644 --- a/pkg/detectors/insightly/insightly.go +++ b/pkg/detectors/insightly/insightly.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.na1.insightly.com/v3.1/Contacts?top=2", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.na1.insightly.com/v3.1/Contacts?top=2", nil) req.SetBasicAuth(resMatch, "") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/integromat/integromat.go b/pkg/detectors/integromat/integromat.go index fb2f40cb..88b33915 100644 --- a/pkg/detectors/integromat/integromat.go +++ b/pkg/detectors/integromat/integromat.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.integromat.com/v1/whoami", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.integromat.com/v1/whoami", nil) req.Header.Add("Authorization", fmt.Sprintf("Token %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/intercom/intercom.go b/pkg/detectors/intercom/intercom.go index aa49c8cf..47ad7d4f 100644 --- a/pkg/detectors/intercom/intercom.go +++ b/pkg/detectors/intercom/intercom.go @@ -58,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.intercom.io/contacts?per_page=5", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.intercom.io/contacts?per_page=5", nil) req.Header.Add("Authorization", "Bearer "+resMatch) req.Header.Add("Accept", "application/json") diff --git a/pkg/detectors/intrinio/intrinio.go b/pkg/detectors/intrinio/intrinio.go index c7dd854f..98f4e5fd 100644 --- a/pkg/detectors/intrinio/intrinio.go +++ b/pkg/detectors/intrinio/intrinio.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://api-v2.intrinio.com/securities?api_key=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://api-v2.intrinio.com/securities?api_key=%s", resMatch), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/invoiceocean/invoiceocean.go b/pkg/detectors/invoiceocean/invoiceocean.go index 01a27c71..776209f7 100644 --- a/pkg/detectors/invoiceocean/invoiceocean.go +++ b/pkg/detectors/invoiceocean/invoiceocean.go @@ -59,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://%s/invoices.json?period=this_month&api_token=%s", resURL, resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://%s/invoices.json?period=this_month&api_token=%s", resURL, resMatch), nil) req.Header.Add("Content-Type", "application/json") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/ipapi/ipapi.go b/pkg/detectors/ipapi/ipapi.go index b3d4a13d..7c8940fb 100644 --- a/pkg/detectors/ipapi/ipapi.go +++ b/pkg/detectors/ipapi/ipapi.go @@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("http://api.ipapi.com/49.146.239.251?access_key=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("http://api.ipapi.com/49.146.239.251?access_key=%s", resMatch), nil) res, err := client.Do(req) if err == nil { bodyBytes, err := ioutil.ReadAll(res.Body) diff --git a/pkg/detectors/ipgeolocation/ipgeolocation.go b/pkg/detectors/ipgeolocation/ipgeolocation.go index 5b6bc7ea..e232ef63 100644 --- a/pkg/detectors/ipgeolocation/ipgeolocation.go +++ b/pkg/detectors/ipgeolocation/ipgeolocation.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://api.ipgeolocation.io/ipgeo?apiKey=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://api.ipgeolocation.io/ipgeo?apiKey=%s", resMatch), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/ipify/ipify.go b/pkg/detectors/ipify/ipify.go index b134a585..f46eb7ce 100644 --- a/pkg/detectors/ipify/ipify.go +++ b/pkg/detectors/ipify/ipify.go @@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { timeout := 10 * time.Second client.Timeout = timeout - req, _ := http.NewRequest("GET", fmt.Sprintf("https://geo.ipify.org/api/v2/country?apiKey=%s&ipAddress=8.8.8.8", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://geo.ipify.org/api/v2/country?apiKey=%s&ipAddress=8.8.8.8", resMatch), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/ipinfodb/ipinfodb.go b/pkg/detectors/ipinfodb/ipinfodb.go index a3bc991a..d73f1cec 100644 --- a/pkg/detectors/ipinfodb/ipinfodb.go +++ b/pkg/detectors/ipinfodb/ipinfodb.go @@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://api.ipinfodb.com/v3/ip-country/?key=%s&ip=8.8.8.8&format=json", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://api.ipinfodb.com/v3/ip-country/?key=%s&ip=8.8.8.8&format=json", resMatch), nil) res, err := client.Do(req) if err == nil { bodyBytes, err := ioutil.ReadAll(res.Body) diff --git a/pkg/detectors/ipquality/ipquality.go b/pkg/detectors/ipquality/ipquality.go index c8b153bb..55936aef 100644 --- a/pkg/detectors/ipquality/ipquality.go +++ b/pkg/detectors/ipquality/ipquality.go @@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://www.ipqualityscore.com/api/json/account/%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://www.ipqualityscore.com/api/json/account/%s", resMatch), nil) req.Header.Add("Content-Type", "application/json") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/ipstack/ipstack.go b/pkg/detectors/ipstack/ipstack.go index 4f714b97..3dc92d59 100644 --- a/pkg/detectors/ipstack/ipstack.go +++ b/pkg/detectors/ipstack/ipstack.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.ipstack.com/134.201.250.155?access_key="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.ipstack.com/134.201.250.155?access_key="+resMatch, nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/jiratoken/jiratoken.go b/pkg/detectors/jiratoken/jiratoken.go index f5b5f84b..0ab744d9 100644 --- a/pkg/detectors/jiratoken/jiratoken.go +++ b/pkg/detectors/jiratoken/jiratoken.go @@ -69,7 +69,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result data := fmt.Sprintf("%s:%s", resEmail, resToken) sEnc := b64.StdEncoding.EncodeToString([]byte(data)) - req, _ := http.NewRequest("GET", "https://"+resDomain+"/rest/api/3/dashboard", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://"+resDomain+"/rest/api/3/dashboard", nil) req.Header.Add("Accept", "application/json") req.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc)) res, err := client.Do(req) diff --git a/pkg/detectors/jotform/jotform.go b/pkg/detectors/jotform/jotform.go index acf1a19f..7fae90f4 100644 --- a/pkg/detectors/jotform/jotform.go +++ b/pkg/detectors/jotform/jotform.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.jotform.com/user?apiKey="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.jotform.com/user?apiKey="+resMatch, nil) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/jumpcloud/jumpcloud.go b/pkg/detectors/jumpcloud/jumpcloud.go index 57cf63bf..078bf656 100644 --- a/pkg/detectors/jumpcloud/jumpcloud.go +++ b/pkg/detectors/jumpcloud/jumpcloud.go @@ -49,7 +49,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://console.jumpcloud.com/api/v2/systemgroups", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://console.jumpcloud.com/api/v2/systemgroups", nil) req.Header.Add("x-api-key", resMatch) res, err := client.Do(req) diff --git a/pkg/detectors/juro/juro.go b/pkg/detectors/juro/juro.go index 88152051..4ea58b5a 100644 --- a/pkg/detectors/juro/juro.go +++ b/pkg/detectors/juro/juro.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.juro.com/v3/templates", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.juro.com/v3/templates", nil) req.Header.Add("x-api-key", resMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/kanban/kanban.go b/pkg/detectors/kanban/kanban.go index fc42f879..37fe1e9c 100644 --- a/pkg/detectors/kanban/kanban.go +++ b/pkg/detectors/kanban/kanban.go @@ -58,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://%s/api/v3/users/current.json", resURL), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://%s/api/v3/users/current.json", resURL), nil) req.Header.Add("Accept", "application/vnd.kanban+json; version=3") req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/karmacrm/karmacrm.go b/pkg/detectors/karmacrm/karmacrm.go index 99ff87dc..2fa93ea5 100644 --- a/pkg/detectors/karmacrm/karmacrm.go +++ b/pkg/detectors/karmacrm/karmacrm.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://app.karmacrm.com/api/v3/contacts.json?api_token=%s&page=1", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://app.karmacrm.com/api/v3/contacts.json?api_token=%s&page=1", resMatch), nil) req.Header.Add("Accept", "application/vnd.karmacrm+json; version=3") req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/keenio/keenio.go b/pkg/detectors/keenio/keenio.go index 0e54489e..7159e164 100644 --- a/pkg/detectors/keenio/keenio.go +++ b/pkg/detectors/keenio/keenio.go @@ -59,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.keen.io/3.0/organizations/"+resIdMatch+"/projects", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.keen.io/3.0/organizations/"+resIdMatch+"/projects", nil) req.Header.Add("Content-Type", "application/json") req.Header.Add("Authorization", fmt.Sprintf("%s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/kickbox/kickbox.go b/pkg/detectors/kickbox/kickbox.go index 9bb50faa..617d192d 100644 --- a/pkg/detectors/kickbox/kickbox.go +++ b/pkg/detectors/kickbox/kickbox.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.kickbox.com/v2/verify?email=kickbox@example.com&apikey="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.kickbox.com/v2/verify?email=kickbox@example.com&apikey="+resMatch, nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/kontent/kontent.go b/pkg/detectors/kontent/kontent.go index c47401b7..1c480fff 100644 --- a/pkg/detectors/kontent/kontent.go +++ b/pkg/detectors/kontent/kontent.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://deliver.kontent.ai/%s/items", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://deliver.kontent.ai/%s/items", resMatch), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/kraken/kraken.go b/pkg/detectors/kraken/kraken.go index f18d2bd3..a5b6382b 100644 --- a/pkg/detectors/kraken/kraken.go +++ b/pkg/detectors/kraken/kraken.go @@ -78,7 +78,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result b64DecodedSecret, _ := base64.StdEncoding.DecodeString(resPrivKeyMatch) signature := getKrakenSignature("/0/private/Balance", payload, b64DecodedSecret) - req, _ := http.NewRequest("POST", "https://api.kraken.com/0/private/Balance", strings.NewReader(payload.Encode())) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://api.kraken.com/0/private/Balance", strings.NewReader(payload.Encode())) req.Header.Add("Content-Type", "application/x-www-form-urlencoded") req.Header.Add("API-Key", resMatch) req.Header.Add("API-Sign", signature) diff --git a/pkg/detectors/kylas/kylas.go b/pkg/detectors/kylas/kylas.go index 4221ba81..86df8f0b 100644 --- a/pkg/detectors/kylas/kylas.go +++ b/pkg/detectors/kylas/kylas.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.kylas.io/v1/contacts", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.kylas.io/v1/contacts", nil) req.Header.Add("Content-Type", "application/json") req.Header.Add("api-key", resMatch) res, err := client.Do(req) diff --git a/pkg/detectors/languagelayer/languagelayer.go b/pkg/detectors/languagelayer/languagelayer.go index 16ba43cd..1393d892 100644 --- a/pkg/detectors/languagelayer/languagelayer.go +++ b/pkg/detectors/languagelayer/languagelayer.go @@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("http://api.languagelayer.com/languages?access_key=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("http://api.languagelayer.com/languages?access_key=%s", resMatch), nil) res, err := client.Do(req) if err == nil { bodyBytes, err := ioutil.ReadAll(res.Body) diff --git a/pkg/detectors/lastfm/lastfm.go b/pkg/detectors/lastfm/lastfm.go index ee72205a..b610c5c5 100644 --- a/pkg/detectors/lastfm/lastfm.go +++ b/pkg/detectors/lastfm/lastfm.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "http://ws.audioscrobbler.com/2.0/?method=artist.getSimilar&api_key="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "http://ws.audioscrobbler.com/2.0/?method=artist.getSimilar&api_key="+resMatch, nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/launchdarkly/launchdarkly.go b/pkg/detectors/launchdarkly/launchdarkly.go index a9c3749c..484b1f16 100644 --- a/pkg/detectors/launchdarkly/launchdarkly.go +++ b/pkg/detectors/launchdarkly/launchdarkly.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://app.launchdarkly.com/api/v2/tokens", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://app.launchdarkly.com/api/v2/tokens", nil) req.Header.Add("Authorization", resMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/leadfeeder/leadfeeder.go b/pkg/detectors/leadfeeder/leadfeeder.go index 6c861a7d..8a9cb2e4 100644 --- a/pkg/detectors/leadfeeder/leadfeeder.go +++ b/pkg/detectors/leadfeeder/leadfeeder.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.leadfeeder.com/accounts", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.leadfeeder.com/accounts", nil) req.Header.Add("Authorization", fmt.Sprintf("Token token=%s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/lessannoyingcrm/lessannoyingcrm.go b/pkg/detectors/lessannoyingcrm/lessannoyingcrm.go index 24b8bdb9..f2c3b6ee 100644 --- a/pkg/detectors/lessannoyingcrm/lessannoyingcrm.go +++ b/pkg/detectors/lessannoyingcrm/lessannoyingcrm.go @@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { userCode := strings.Split(resMatch, "-") - req, _ := http.NewRequest("GET", fmt.Sprintf("https://api.lessannoyingcrm.com?UserCode=%s&APIToken=%s&Function=GetUserInfo", userCode, resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://api.lessannoyingcrm.com?UserCode=%s&APIToken=%s&Function=GetUserInfo", userCode, resMatch), nil) req.Header.Add("Accept", "application/vnd.lessannoyingcrm+json; version=3") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/lexigram/lexigram.go b/pkg/detectors/lexigram/lexigram.go index df143a19..8afb112f 100644 --- a/pkg/detectors/lexigram/lexigram.go +++ b/pkg/detectors/lexigram/lexigram.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.lexigram.io/v1/lexigraph/search?q=diabetes", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.lexigram.io/v1/lexigraph/search?q=diabetes", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/linearapi/linearapi.go b/pkg/detectors/linearapi/linearapi.go index 104be36e..78ecbd2c 100644 --- a/pkg/detectors/linearapi/linearapi.go +++ b/pkg/detectors/linearapi/linearapi.go @@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { reqDataQuery := strings.NewReader(`{ "query": "{ viewer { id name } }" }`) - req, _ := http.NewRequest("POST", "https://api.linear.app/graphql", reqDataQuery) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://api.linear.app/graphql", reqDataQuery) req.Header.Add("Content-Type", "application/json") req.Header.Add("Authorization", resMatch) diff --git a/pkg/detectors/linemessaging/linemessaging.go b/pkg/detectors/linemessaging/linemessaging.go index a110f170..e33536d1 100644 --- a/pkg/detectors/linemessaging/linemessaging.go +++ b/pkg/detectors/linemessaging/linemessaging.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.line.me/v2/bot/info", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.line.me/v2/bot/info", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/linenotify/linenotify.go b/pkg/detectors/linenotify/linenotify.go index 99a65df2..cb550179 100644 --- a/pkg/detectors/linenotify/linenotify.go +++ b/pkg/detectors/linenotify/linenotify.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("POST", "https://notify-api.line.me/api/notify?message=Notification Successful", nil) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://notify-api.line.me/api/notify?message=Notification Successful", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/linkpreview/linkpreview.go b/pkg/detectors/linkpreview/linkpreview.go index 89084549..042ab635 100644 --- a/pkg/detectors/linkpreview/linkpreview.go +++ b/pkg/detectors/linkpreview/linkpreview.go @@ -49,7 +49,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("http://api.linkpreview.net/?key=%s&q=http://google.com", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("http://api.linkpreview.net/?key=%s&q=http://google.com", resMatch), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/liveagent/liveagent.go b/pkg/detectors/liveagent/liveagent.go index 5ad90bc9..f0399c39 100644 --- a/pkg/detectors/liveagent/liveagent.go +++ b/pkg/detectors/liveagent/liveagent.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://secretscanner.ladesk.com/api/v3/agents", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://secretscanner.ladesk.com/api/v3/agents", nil) req.Header.Add("apikey", resMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/lob/lob.go b/pkg/detectors/lob/lob.go index cbd63f0d..e0062bd4 100644 --- a/pkg/detectors/lob/lob.go +++ b/pkg/detectors/lob/lob.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.lob.com/v1/addresses", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.lob.com/v1/addresses", nil) req.SetBasicAuth(resMatch, "") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/locationiq/locationiq.go b/pkg/detectors/locationiq/locationiq.go index eafd3435..cb16290d 100644 --- a/pkg/detectors/locationiq/locationiq.go +++ b/pkg/detectors/locationiq/locationiq.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://us1.locationiq.com/v1/reverse.php?key="+resMatch+"&lat=-37.870662&lon=144.9803321&format=json", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://us1.locationiq.com/v1/reverse.php?key="+resMatch+"&lat=-37.870662&lon=144.9803321&format=json", nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/loginradius/loginradius.go b/pkg/detectors/loginradius/loginradius.go index eccbff10..35dea4eb 100644 --- a/pkg/detectors/loginradius/loginradius.go +++ b/pkg/detectors/loginradius/loginradius.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.loginradius.com/identity/v2/serverinfo?apikey="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.loginradius.com/identity/v2/serverinfo?apikey="+resMatch, nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/lokalisetoken/lokalisetoken.go b/pkg/detectors/lokalisetoken/lokalisetoken.go index c79046af..aa1463e3 100644 --- a/pkg/detectors/lokalisetoken/lokalisetoken.go +++ b/pkg/detectors/lokalisetoken/lokalisetoken.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.lokalise.com/api2/system/languages", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.lokalise.com/api2/system/languages", nil) req.Header.Add("x-api-token", resMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/loyverse/loyverse.go b/pkg/detectors/loyverse/loyverse.go index 9b70fba3..ab6f3a63 100644 --- a/pkg/detectors/loyverse/loyverse.go +++ b/pkg/detectors/loyverse/loyverse.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.loyverse.com/v1.0/merchant/", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.loyverse.com/v1.0/merchant/", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/luno/luno.go b/pkg/detectors/luno/luno.go index f40468b5..7d447f09 100644 --- a/pkg/detectors/luno/luno.go +++ b/pkg/detectors/luno/luno.go @@ -59,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.luno.com/api/1/balance", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.luno.com/api/1/balance", nil) req.SetBasicAuth(userPatMatch, tokenPatMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/m3o/m3o.go b/pkg/detectors/m3o/m3o.go index b94d6700..99ea9d3c 100644 --- a/pkg/detectors/m3o/m3o.go +++ b/pkg/detectors/m3o/m3o.go @@ -55,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result "days": 2, "location": "London" }`) - req, _ := http.NewRequest("POST", "https://api.m3o.com/v1/weather/Forecast", payload) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://api.m3o.com/v1/weather/Forecast", payload) req.Header.Add("Content-Type", "application/json") req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/macaddress/macaddress.go b/pkg/detectors/macaddress/macaddress.go index cc40fb04..66e3a277 100644 --- a/pkg/detectors/macaddress/macaddress.go +++ b/pkg/detectors/macaddress/macaddress.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://api.macaddress.io/v1?apiKey=%s&output=json&search=44:38:39:ff:ef:51", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://api.macaddress.io/v1?apiKey=%s&output=json&search=44:38:39:ff:ef:51", resMatch), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/magnetic/magnetic.go b/pkg/detectors/magnetic/magnetic.go index f67215cf..4a8f1199 100644 --- a/pkg/detectors/magnetic/magnetic.go +++ b/pkg/detectors/magnetic/magnetic.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://app.magnetichq.com/Magnetic/rest/accountsAPI/itemTypes?token="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://app.magnetichq.com/Magnetic/rest/accountsAPI/itemTypes?token="+resMatch, nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/mailboxlayer/mailboxlayer.go b/pkg/detectors/mailboxlayer/mailboxlayer.go index 48f1c274..916f759c 100644 --- a/pkg/detectors/mailboxlayer/mailboxlayer.go +++ b/pkg/detectors/mailboxlayer/mailboxlayer.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "http://apilayer.net/api/check?access_key="+resMatch+"&email=support@email.com", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "http://apilayer.net/api/check?access_key="+resMatch+"&email=support@email.com", nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/mailchimp/mailchimp.go b/pkg/detectors/mailchimp/mailchimp.go index 9eca6f3d..a2a73be7 100644 --- a/pkg/detectors/mailchimp/mailchimp.go +++ b/pkg/detectors/mailchimp/mailchimp.go @@ -48,7 +48,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result client := common.SaneHttpClient() // https://mailchimp.com/developer/guides/marketing-api-conventions/ - req, _ := http.NewRequest("GET", fmt.Sprintf("https://%s.api.mailchimp.com/3.0/", datacenter), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://%s.api.mailchimp.com/3.0/", datacenter), nil) req.SetBasicAuth("anystring", match) res, err := client.Do(req) if err != nil { diff --git a/pkg/detectors/mailerlite/mailerlite.go b/pkg/detectors/mailerlite/mailerlite.go index f2caba64..ead6591d 100644 --- a/pkg/detectors/mailerlite/mailerlite.go +++ b/pkg/detectors/mailerlite/mailerlite.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.mailerlite.com/api/v2/campaigns", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.mailerlite.com/api/v2/campaigns", nil) req.Header.Add("X-MailerLite-ApiKey", resMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/mailgun/mailgun.go b/pkg/detectors/mailgun/mailgun.go index aac93b21..f9d1d18b 100644 --- a/pkg/detectors/mailgun/mailgun.go +++ b/pkg/detectors/mailgun/mailgun.go @@ -49,7 +49,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.mailgun.net/v3/domains", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.mailgun.net/v3/domains", nil) req.Header.Add("Authorization", fmt.Sprintf("Basic %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/mailjetbasicauth/mailjetbasicauth.go b/pkg/detectors/mailjetbasicauth/mailjetbasicauth.go index 83318c1f..0fe0ca8c 100644 --- a/pkg/detectors/mailjetbasicauth/mailjetbasicauth.go +++ b/pkg/detectors/mailjetbasicauth/mailjetbasicauth.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.mailjet.com/v3/REST/message", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.mailjet.com/v3/REST/message", nil) req.Header.Add("Authorization", fmt.Sprintf("Basic %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/mailjetsms/mailjetsms.go b/pkg/detectors/mailjetsms/mailjetsms.go index f5c5b726..a018e1a7 100644 --- a/pkg/detectors/mailjetsms/mailjetsms.go +++ b/pkg/detectors/mailjetsms/mailjetsms.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.mailjet.com/v4/sms", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.mailjet.com/v4/sms", nil) req.Header.Add("Accept", "application/vnd.mailjetsms+json; version=3") req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/mailmodo/mailmodo.go b/pkg/detectors/mailmodo/mailmodo.go index c3b21338..1107226d 100644 --- a/pkg/detectors/mailmodo/mailmodo.go +++ b/pkg/detectors/mailmodo/mailmodo.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.mailmodo.com/api/v1/campaigns?type=CONTACT_LIST", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.mailmodo.com/api/v1/campaigns?type=CONTACT_LIST", nil) req.Header.Add("Content-Type", "application/json") req.Header.Add("mmApiKey", resMatch) res, err := client.Do(req) diff --git a/pkg/detectors/mailsac/mailsac.go b/pkg/detectors/mailsac/mailsac.go index d3b8e7db..501626bb 100644 --- a/pkg/detectors/mailsac/mailsac.go +++ b/pkg/detectors/mailsac/mailsac.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://mailsac.com/api/addresses", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://mailsac.com/api/addresses", nil) req.Header.Add("Content-Type", "application/json") req.Header.Add("Mailsac-Key", resMatch) res, err := client.Do(req) diff --git a/pkg/detectors/mandrill/mandrill.go b/pkg/detectors/mandrill/mandrill.go index 1835d03e..b0d50066 100644 --- a/pkg/detectors/mandrill/mandrill.go +++ b/pkg/detectors/mandrill/mandrill.go @@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { payload := strings.NewReader(fmt.Sprintf(`{"key": "%s"}`, resMatch)) - req, _ := http.NewRequest("POST", "https://mandrillapp.com/api/1.0/users/info", payload) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://mandrillapp.com/api/1.0/users/info", payload) req.Header.Add("Content-Type", "application/json") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/manifest/manifest.go b/pkg/detectors/manifest/manifest.go index d77c981b..efe18e47 100644 --- a/pkg/detectors/manifest/manifest.go +++ b/pkg/detectors/manifest/manifest.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.manifest.ly/api/v1/checklists/?api_key="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.manifest.ly/api/v1/checklists/?api_key="+resMatch, nil) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/mapbox/mapbox.go b/pkg/detectors/mapbox/mapbox.go index bbf3cd83..51b65168 100644 --- a/pkg/detectors/mapbox/mapbox.go +++ b/pkg/detectors/mapbox/mapbox.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.mapbox.com/tokens/v2/"+resId+"?access_token="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.mapbox.com/tokens/v2/"+resId+"?access_token="+resMatch, nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/mapquest/mapquest.go b/pkg/detectors/mapquest/mapquest.go index 66c3f758..c534f160 100644 --- a/pkg/detectors/mapquest/mapquest.go +++ b/pkg/detectors/mapquest/mapquest.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "http://www.mapquestapi.com/datamanager/v2/get-column-types?key="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "http://www.mapquestapi.com/datamanager/v2/get-column-types?key="+resMatch, nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/marketstack/marketstack.go b/pkg/detectors/marketstack/marketstack.go index 17b29fb8..5dc7cee7 100644 --- a/pkg/detectors/marketstack/marketstack.go +++ b/pkg/detectors/marketstack/marketstack.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("http://api.marketstack.com/v1/eod?access_key=%s&symbols=AAPL", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("http://api.marketstack.com/v1/eod?access_key=%s&symbols=AAPL", resMatch), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/mattermostpersonaltoken/mattermostpersonaltoken.go b/pkg/detectors/mattermostpersonaltoken/mattermostpersonaltoken.go index cebf522d..b8421ea9 100644 --- a/pkg/detectors/mattermostpersonaltoken/mattermostpersonaltoken.go +++ b/pkg/detectors/mattermostpersonaltoken/mattermostpersonaltoken.go @@ -59,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://"+serverRes+"/api/v4/users/stats", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://"+serverRes+"/api/v4/users/stats", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/mavenlink/mavenlink.go b/pkg/detectors/mavenlink/mavenlink.go index fee59d2f..b9c55639 100644 --- a/pkg/detectors/mavenlink/mavenlink.go +++ b/pkg/detectors/mavenlink/mavenlink.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.mavenlink.com/api/v1/workspaces.json", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.mavenlink.com/api/v1/workspaces.json", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/maxmindlicense/maxmindlicense.go b/pkg/detectors/maxmindlicense/maxmindlicense.go index bca9b1dc..78749479 100644 --- a/pkg/detectors/maxmindlicense/maxmindlicense.go +++ b/pkg/detectors/maxmindlicense/maxmindlicense.go @@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://geoip.maxmind.com/geoip/v2.1/country/8.8.8.8", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://geoip.maxmind.com/geoip/v2.1/country/8.8.8.8", nil) req.SetBasicAuth(idRes, keyRes) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/meaningcloud/meaningcloud.go b/pkg/detectors/meaningcloud/meaningcloud.go index a6d2317c..b1d0e6de 100644 --- a/pkg/detectors/meaningcloud/meaningcloud.go +++ b/pkg/detectors/meaningcloud/meaningcloud.go @@ -72,7 +72,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result continue } writer.Close() - req, _ := http.NewRequest("POST", "https://api.meaningcloud.com/lang-4.0/identification", bytes.NewReader(body.Bytes())) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://api.meaningcloud.com/lang-4.0/identification", bytes.NewReader(body.Bytes())) req.Header.Add("Content-Type", writer.FormDataContentType()) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/mediastack/mediastack.go b/pkg/detectors/mediastack/mediastack.go index db91ea5c..d0f897e5 100644 --- a/pkg/detectors/mediastack/mediastack.go +++ b/pkg/detectors/mediastack/mediastack.go @@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { timeout := 10 * time.Second client.Timeout = timeout - req, _ := http.NewRequest("GET", fmt.Sprintf("http://api.mediastack.com/v1/news?access_key=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("http://api.mediastack.com/v1/news?access_key=%s", resMatch), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/meistertask/meistertask.go b/pkg/detectors/meistertask/meistertask.go index 095a3976..5c90d68d 100644 --- a/pkg/detectors/meistertask/meistertask.go +++ b/pkg/detectors/meistertask/meistertask.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://www.meistertask.com/api/projects", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://www.meistertask.com/api/projects", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/mesibo/mesibo.go b/pkg/detectors/mesibo/mesibo.go index 3fd3dc94..9107adfb 100644 --- a/pkg/detectors/mesibo/mesibo.go +++ b/pkg/detectors/mesibo/mesibo.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.mesibo.com/api.php?op=useradd&token="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.mesibo.com/api.php?op=useradd&token="+resMatch, nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/messagebird/messagebird.go b/pkg/detectors/messagebird/messagebird.go index 17833d85..4ecad45d 100644 --- a/pkg/detectors/messagebird/messagebird.go +++ b/pkg/detectors/messagebird/messagebird.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://rest.messagebird.com/messages", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://rest.messagebird.com/messages", nil) req.Header.Add("Authorization", fmt.Sprintf("AccessKey %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/metrilo/metrilo.go b/pkg/detectors/metrilo/metrilo.go index 5929763c..210c1dce 100644 --- a/pkg/detectors/metrilo/metrilo.go +++ b/pkg/detectors/metrilo/metrilo.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { payload := strings.NewReader(`{"time":1518004715732,"token": "` + resMatch + `" ,"platform":"Wordpress 4.2.7 / Woocommerce 3.5","pluginVersion":"1.1.0","params":{"id":"12","name":"Clothing","url":"https://dummysite.com"}}`) - req, _ := http.NewRequest("POST", "https://trk.mtrl.me/category", payload) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://trk.mtrl.me/category", payload) req.Header.Add("Content-Type", "application/json") req.Header.Add("Content-Length", `0`) res, err := client.Do(req) diff --git a/pkg/detectors/microsoftteamswebhook/microsoftteamswebhook.go b/pkg/detectors/microsoftteamswebhook/microsoftteamswebhook.go index 165403b1..2d189f19 100644 --- a/pkg/detectors/microsoftteamswebhook/microsoftteamswebhook.go +++ b/pkg/detectors/microsoftteamswebhook/microsoftteamswebhook.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { payload := strings.NewReader(`{'text':'This is a verification message from TruffleHog. It means that there has been a live webhook credential found.'}`) - req, _ := http.NewRequest("POST", resMatch, payload) + req, _ := http.NewRequestWithContext(ctx, "POST", resMatch, payload) req.Header.Add("Content-Type", "application/json") res, err := client.Do(req) if err != nil { diff --git a/pkg/detectors/mindmeister/mindmeister.go b/pkg/detectors/mindmeister/mindmeister.go index d3853c39..ba99a102 100644 --- a/pkg/detectors/mindmeister/mindmeister.go +++ b/pkg/detectors/mindmeister/mindmeister.go @@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://www.mindmeister.com/services/rest/oauth2?method=mm.maps.getList", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://www.mindmeister.com/services/rest/oauth2?method=mm.maps.getList", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/mite/mite.go b/pkg/detectors/mite/mite.go index 4f4f8000..d3dda8c8 100644 --- a/pkg/detectors/mite/mite.go +++ b/pkg/detectors/mite/mite.go @@ -58,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://%s/account.json", resURL), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://%s/account.json", resURL), nil) req.Header.Add("Content-Type", "application/json") req.Header.Add("X-MiteApiKey", resMatch) res, err := client.Do(req) diff --git a/pkg/detectors/mixmax/mixmax.go b/pkg/detectors/mixmax/mixmax.go index 187650c2..574856a9 100644 --- a/pkg/detectors/mixmax/mixmax.go +++ b/pkg/detectors/mixmax/mixmax.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.mixmax.com/v1/users/me", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.mixmax.com/v1/users/me", nil) req.Header.Add("X-API-Token", resMatch) res, err := client.Do(req) diff --git a/pkg/detectors/mixpanel/mixpanel.go b/pkg/detectors/mixpanel/mixpanel.go index ee1423ad..a6f7f196 100644 --- a/pkg/detectors/mixpanel/mixpanel.go +++ b/pkg/detectors/mixpanel/mixpanel.go @@ -59,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://mixpanel.com/api/app/me", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://mixpanel.com/api/app/me", nil) req.SetBasicAuth(userPatMatch, tokenPatMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/monday/monday.go b/pkg/detectors/monday/monday.go index d8ec0f28..2381f2fd 100644 --- a/pkg/detectors/monday/monday.go +++ b/pkg/detectors/monday/monday.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { payload := strings.NewReader(`{"query":"{boards(limit:1){id name}}"}`) - req, _ := http.NewRequest("POST", "https://api.monday.com/v2", payload) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://api.monday.com/v2", payload) req.Header.Add("Content-Type", "application/json") req.Header.Add("Authorization", resMatch) res, err := client.Do(req) diff --git a/pkg/detectors/moonclerk/moonclerk.go b/pkg/detectors/moonclerk/moonclerk.go index 07876807..a14aab2f 100644 --- a/pkg/detectors/moonclerk/moonclerk.go +++ b/pkg/detectors/moonclerk/moonclerk.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.moonclerk.com/forms", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.moonclerk.com/forms", nil) req.Header.Add("Accept", "application/vnd.moonclerk+json;version=1") req.Header.Add("Authorization", "Token token="+resMatch) res, err := client.Do(req) diff --git a/pkg/detectors/moosend/moosend.go b/pkg/detectors/moosend/moosend.go index 2956944c..a39f605e 100644 --- a/pkg/detectors/moosend/moosend.go +++ b/pkg/detectors/moosend/moosend.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.moosend.com/v3/lists.json?apikey="+resMatch+"&format=json", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.moosend.com/v3/lists.json?apikey="+resMatch+"&format=json", nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/mrticktock/mrticktock.go b/pkg/detectors/mrticktock/mrticktock.go index 372832a5..b97452ae 100644 --- a/pkg/detectors/mrticktock/mrticktock.go +++ b/pkg/detectors/mrticktock/mrticktock.go @@ -61,7 +61,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { payload := strings.NewReader(fmt.Sprintf(`email=%s&password=%s`, resMatch, resPassword)) - req, _ := http.NewRequest("POST", "https://mrticktock.com/app/api/is_timer_active", payload) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://mrticktock.com/app/api/is_timer_active", payload) req.Header.Add("Content-Type", "application/x-www-form-urlencoded") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/myfreshworks/myfreshworks.go b/pkg/detectors/myfreshworks/myfreshworks.go index 4fe2f895..3fa4a2fb 100644 --- a/pkg/detectors/myfreshworks/myfreshworks.go +++ b/pkg/detectors/myfreshworks/myfreshworks.go @@ -58,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://"+resIdMatch+".myfreshworks.com/crm/sales/api/sales_accounts/filters", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://"+resIdMatch+".myfreshworks.com/crm/sales/api/sales_accounts/filters", nil) req.Header.Add("Authorization", fmt.Sprintf("Token token=%s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/myintervals/myintervals.go b/pkg/detectors/myintervals/myintervals.go index e8467393..644f0395 100644 --- a/pkg/detectors/myintervals/myintervals.go +++ b/pkg/detectors/myintervals/myintervals.go @@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { data := fmt.Sprintf("%s:X", resMatch) sEnc := b64.StdEncoding.EncodeToString([]byte(data)) - req, _ := http.NewRequest("GET", "https://api.myintervals.com/client/", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.myintervals.com/client/", nil) req.Header.Add("Content-Type", "application/json") req.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc)) res, err := client.Do(req) diff --git a/pkg/detectors/nasdaqdatalink/nasdaqdatalink.go b/pkg/detectors/nasdaqdatalink/nasdaqdatalink.go index 672da8ac..a5ee2e96 100644 --- a/pkg/detectors/nasdaqdatalink/nasdaqdatalink.go +++ b/pkg/detectors/nasdaqdatalink/nasdaqdatalink.go @@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { timeout := 10 * time.Second client.Timeout = timeout - req, _ := http.NewRequest("GET", fmt.Sprintf("https://data.nasdaq.com/api/v3/datasets/FRED/GDP.csv?api_key=%s&collapse=annual&rows=6&order=asc&column_index=1", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://data.nasdaq.com/api/v3/datasets/FRED/GDP.csv?api_key=%s&collapse=annual&rows=6&order=asc&column_index=1", resMatch), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/nethunt/nethunt.go b/pkg/detectors/nethunt/nethunt.go index 4f396dd9..12799bc9 100644 --- a/pkg/detectors/nethunt/nethunt.go +++ b/pkg/detectors/nethunt/nethunt.go @@ -59,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://nethunt.com/api/v1/zapier/triggers/readable-folder", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://nethunt.com/api/v1/zapier/triggers/readable-folder", nil) req.SetBasicAuth(userPatMatch, tokenPatMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/netlify/netlify.go b/pkg/detectors/netlify/netlify.go index ae1ef670..f65af7b7 100644 --- a/pkg/detectors/netlify/netlify.go +++ b/pkg/detectors/netlify/netlify.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.netlify.com/api/v1/sites", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.netlify.com/api/v1/sites", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/neutrinoapi/neutrinoapi.go b/pkg/detectors/neutrinoapi/neutrinoapi.go index f3704fc2..12168d40 100644 --- a/pkg/detectors/neutrinoapi/neutrinoapi.go +++ b/pkg/detectors/neutrinoapi/neutrinoapi.go @@ -74,7 +74,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result continue } writer.Close() - req, _ := http.NewRequest("POST", fmt.Sprintf("https://neutrinoapi.net/url-info?user-id=%s&api-key=%s", resIdMatch, resMatch), bytes.NewReader(body.Bytes())) + req, _ := http.NewRequestWithContext(ctx, "POST", fmt.Sprintf("https://neutrinoapi.net/url-info?user-id=%s&api-key=%s", resIdMatch, resMatch), bytes.NewReader(body.Bytes())) req.Header.Add("Content-Type", writer.FormDataContentType()) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/newrelicpersonalapikey/newrelicpersonalapikey.go b/pkg/detectors/newrelicpersonalapikey/newrelicpersonalapikey.go index 77247fd8..45890642 100644 --- a/pkg/detectors/newrelicpersonalapikey/newrelicpersonalapikey.go +++ b/pkg/detectors/newrelicpersonalapikey/newrelicpersonalapikey.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.newrelic.com/v2/users.json", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.newrelic.com/v2/users.json", nil) req.Header.Add("X-Api-Key", fmt.Sprintf("%s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/newsapi/newsapi.go b/pkg/detectors/newsapi/newsapi.go index b1bc11c5..9d14f878 100644 --- a/pkg/detectors/newsapi/newsapi.go +++ b/pkg/detectors/newsapi/newsapi.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://newsapi.org/v2/everything?q=Apple&from=2021-09-29&sortBy=popularity&apiKey="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://newsapi.org/v2/everything?q=Apple&from=2021-09-29&sortBy=popularity&apiKey="+resMatch, nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/newscatcher/newscatcher.go b/pkg/detectors/newscatcher/newscatcher.go index aa6e3387..394ec5d5 100644 --- a/pkg/detectors/newscatcher/newscatcher.go +++ b/pkg/detectors/newscatcher/newscatcher.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.newscatcherapi.com/v2/search?q=Tesla", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.newscatcherapi.com/v2/search?q=Tesla", nil) req.Header.Add("x-api-key", fmt.Sprintf("%s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/nexmoapikey/nexmoapikey.go b/pkg/detectors/nexmoapikey/nexmoapikey.go index 1435ca4b..ea9cb07c 100644 --- a/pkg/detectors/nexmoapikey/nexmoapikey.go +++ b/pkg/detectors/nexmoapikey/nexmoapikey.go @@ -58,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://rest.nexmo.com/account/get-balance?api_key="+resMatch+"&api_secret="+resSecret+"", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://rest.nexmo.com/account/get-balance?api_key="+resMatch+"&api_secret="+resSecret+"", nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/nftport/nftport.go b/pkg/detectors/nftport/nftport.go index fec06d19..950c6e27 100644 --- a/pkg/detectors/nftport/nftport.go +++ b/pkg/detectors/nftport/nftport.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.nftport.xyz/me/contracts", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.nftport.xyz/me/contracts", nil) req.Header.Add("Content-Type", "application/json") req.Header.Add("Authorization", fmt.Sprintf("%s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/nicereply/nicereply.go b/pkg/detectors/nicereply/nicereply.go index a63446bb..f8a9fae5 100644 --- a/pkg/detectors/nicereply/nicereply.go +++ b/pkg/detectors/nicereply/nicereply.go @@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { data := fmt.Sprintf(":%s", resMatch) sEnc := b64.StdEncoding.EncodeToString([]byte(data)) - req, _ := http.NewRequest("GET", "https://api.nicereply.com/v1/users/stats", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.nicereply.com/v1/users/stats", nil) req.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/nimble/nimble.go b/pkg/detectors/nimble/nimble.go index 9694413c..d28fecdd 100644 --- a/pkg/detectors/nimble/nimble.go +++ b/pkg/detectors/nimble/nimble.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://app.nimble.com/api/v1/myself", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://app.nimble.com/api/v1/myself", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/nitro/nitro.go b/pkg/detectors/nitro/nitro.go index 0ef3a374..968e53a8 100644 --- a/pkg/detectors/nitro/nitro.go +++ b/pkg/detectors/nitro/nitro.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://nitro.alconost.com/api/v1/account", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://nitro.alconost.com/api/v1/account", nil) req.Header.Add("Content-Type", "application/json") req.SetBasicAuth(resMatch, "") res, err := client.Do(req) diff --git a/pkg/detectors/noticeable/noticeable.go b/pkg/detectors/noticeable/noticeable.go index 5b9c4d8b..b4f8d554 100644 --- a/pkg/detectors/noticeable/noticeable.go +++ b/pkg/detectors/noticeable/noticeable.go @@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { payload := strings.NewReader(`{"query": "YOUR_GRAPHQL_PAYLOAD"}`) - req, _ := http.NewRequest("POST", "https://api.noticeable.io/graphql", payload) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://api.noticeable.io/graphql", payload) req.Header.Add("Content-Type", "application/json") req.Header.Add("Authorization", fmt.Sprintf("Apikey %s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/notion/notion.go b/pkg/detectors/notion/notion.go index c3405129..2451f94b 100644 --- a/pkg/detectors/notion/notion.go +++ b/pkg/detectors/notion/notion.go @@ -49,7 +49,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.notion.com/v1/users", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.notion.com/v1/users", nil) req.Header.Add("Notion-Version", "2021-05-11") req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/numverify/numverify.go b/pkg/detectors/numverify/numverify.go index c54de59a..099a344b 100644 --- a/pkg/detectors/numverify/numverify.go +++ b/pkg/detectors/numverify/numverify.go @@ -47,7 +47,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result Raw: []byte(resMatch), } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("http://apilayer.net/api/validate?access_key=%s&number=14158586273", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("http://apilayer.net/api/validate?access_key=%s&number=14158586273", resMatch), nil) res, err := client.Do(req) if err == nil { bodyBytes, err := ioutil.ReadAll(res.Body) diff --git a/pkg/detectors/nutritionix/nutritionix.go b/pkg/detectors/nutritionix/nutritionix.go index 3af40170..73d4e371 100644 --- a/pkg/detectors/nutritionix/nutritionix.go +++ b/pkg/detectors/nutritionix/nutritionix.go @@ -60,7 +60,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { payload := strings.NewReader(`{"query":"for breakfast i ate 2 eggs, bacon, and french toast","timezone":"US/Eastern"}`) - req, _ := http.NewRequest("POST", "https://trackapi.nutritionix.com/v2/natural/nutrients", payload) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://trackapi.nutritionix.com/v2/natural/nutrients", payload) req.Header.Add("Content-Type", "application/json") req.Header.Add("x-app-id", resIdMatch) req.Header.Add("x-app-key", resMatch) diff --git a/pkg/detectors/nylas/nylas.go b/pkg/detectors/nylas/nylas.go index 965ac65b..8dcf5312 100644 --- a/pkg/detectors/nylas/nylas.go +++ b/pkg/detectors/nylas/nylas.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.nylas.com/account", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.nylas.com/account", nil) req.Header.Add("Accept", "application/vnd.nylas+json; version=3") req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/nytimes/nytimes.go b/pkg/detectors/nytimes/nytimes.go index 0b70f4ee..7883c005 100644 --- a/pkg/detectors/nytimes/nytimes.go +++ b/pkg/detectors/nytimes/nytimes.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.nytimes.com/svc/archive/v1/2019/1.json?api-key="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.nytimes.com/svc/archive/v1/2019/1.json?api-key="+resMatch, nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/oanda/oanda.go b/pkg/detectors/oanda/oanda.go index 9fcf3001..551b5c37 100644 --- a/pkg/detectors/oanda/oanda.go +++ b/pkg/detectors/oanda/oanda.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://web-services.oanda.com/rates/api/v2/currencies.json", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://web-services.oanda.com/rates/api/v2/currencies.json", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/okta/okta.go b/pkg/detectors/okta/okta.go index f0270fbf..41eebc97 100644 --- a/pkg/detectors/okta/okta.go +++ b/pkg/detectors/okta/okta.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result // url := fmt.Sprintf("https://%s/api/v1/groups?limit=1", domain) - req, err := http.NewRequest("GET", url, nil) + req, err := http.NewRequestWithContext(ctx, "GET", url, nil) if err != nil { return results, err } diff --git a/pkg/detectors/omnisend/omnisend.go b/pkg/detectors/omnisend/omnisend.go index 5d3c2db8..70e8195d 100644 --- a/pkg/detectors/omnisend/omnisend.go +++ b/pkg/detectors/omnisend/omnisend.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.omnisend.com/v3/contacts?limit=100&offset=0", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.omnisend.com/v3/contacts?limit=100&offset=0", nil) req.Header.Add("X-API-KEY", fmt.Sprintf("%s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/onedesk/onedesk.go b/pkg/detectors/onedesk/onedesk.go index e24fbfa9..3263998f 100644 --- a/pkg/detectors/onedesk/onedesk.go +++ b/pkg/detectors/onedesk/onedesk.go @@ -60,7 +60,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { payload := strings.NewReader(fmt.Sprintf(`{"email": "%s", "password": "%s"}`, resMatch, resPword)) - req, _ := http.NewRequest("POST", "https://app.onedesk.com/rest/2.0/login/loginUser", payload) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://app.onedesk.com/rest/2.0/login/loginUser", payload) req.Header.Add("Content-Type", "application/json") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/onepagecrm/onepagecrm.go b/pkg/detectors/onepagecrm/onepagecrm.go index e8595fc4..264e702f 100644 --- a/pkg/detectors/onepagecrm/onepagecrm.go +++ b/pkg/detectors/onepagecrm/onepagecrm.go @@ -58,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result Raw: []byte(tokenPatMatch), } if verify { - req, _ := http.NewRequest("GET", "https://app.onepagecrm.com/api/v3/contacts.json?per_page=20&page=1", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://app.onepagecrm.com/api/v3/contacts.json?per_page=20&page=1", nil) req.SetBasicAuth(userPatMatch, tokenPatMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/onwaterio/onwaterio.go b/pkg/detectors/onwaterio/onwaterio.go index b036d992..108d5a8c 100644 --- a/pkg/detectors/onwaterio/onwaterio.go +++ b/pkg/detectors/onwaterio/onwaterio.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://api.onwater.io/api/v1/results/23.92323,-66.3?access_token=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://api.onwater.io/api/v1/results/23.92323,-66.3?access_token=%s", resMatch), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/oopspam/oopspam.go b/pkg/detectors/oopspam/oopspam.go index ee9d0b70..3d43dcb2 100644 --- a/pkg/detectors/oopspam/oopspam.go +++ b/pkg/detectors/oopspam/oopspam.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { payload := strings.NewReader(`{"checkForLength":true,"content":"Dear Agent, We are a manufacturing company which specializes in supplying Aluminum Rod with Zinc Alloy Rod to customers worldwide, based in Japan, Asia. We have been unable to follow up payments effectively for transactions with debtor customers in your country due to our distant locations, thus our reason for requesting for your services representation.","senderIP":"185.234.219.246","allowedCountries":["it","us"],"allowedLanguages":["en"]}`) - req, _ := http.NewRequest("POST", "https://api.oopspam.com/v1/spamdetection", payload) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://api.oopspam.com/v1/spamdetection", payload) req.Header.Add("Content-Type", "application/json") req.Header.Add("X-Api-Key", resMatch) res, err := client.Do(req) diff --git a/pkg/detectors/opencagedata/opencagedata.go b/pkg/detectors/opencagedata/opencagedata.go index 70e71b55..cddcc4f5 100644 --- a/pkg/detectors/opencagedata/opencagedata.go +++ b/pkg/detectors/opencagedata/opencagedata.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://api.opencagedata.com/geocode/v1/json?q=12.8797,121.7740&key=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://api.opencagedata.com/geocode/v1/json?q=12.8797,121.7740&key=%s", resMatch), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/opengraphr/opengraphr.go b/pkg/detectors/opengraphr/opengraphr.go index 8a88031d..72f93694 100644 --- a/pkg/detectors/opengraphr/opengraphr.go +++ b/pkg/detectors/opengraphr/opengraphr.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.opengraphr.com/v1/og?api_token="+resMatch+"&url=http://www.marlonpamisa.com/", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.opengraphr.com/v1/og?api_token="+resMatch+"&url=http://www.marlonpamisa.com/", nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/openuv/openuv.go b/pkg/detectors/openuv/openuv.go index 9ba3d732..d671f5a7 100644 --- a/pkg/detectors/openuv/openuv.go +++ b/pkg/detectors/openuv/openuv.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.openuv.io/api/v1/uv?lat=-33.34&lng=115.342", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.openuv.io/api/v1/uv?lat=-33.34&lng=115.342", nil) req.Header.Add("x-access-token", fmt.Sprintf("%s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/openweather/openweather.go b/pkg/detectors/openweather/openweather.go index ea79b897..24ea9678 100644 --- a/pkg/detectors/openweather/openweather.go +++ b/pkg/detectors/openweather/openweather.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "http://api.openweathermap.org/data/2.5/weather?id=524901&lang=fr&appid="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "http://api.openweathermap.org/data/2.5/weather?id=524901&lang=fr&appid="+resMatch, nil) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/optimizely/optimizely.go b/pkg/detectors/optimizely/optimizely.go index 47f06ba8..06c7c643 100644 --- a/pkg/detectors/optimizely/optimizely.go +++ b/pkg/detectors/optimizely/optimizely.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.optimizely.com/v2/projects", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.optimizely.com/v2/projects", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/owlbot/owlbot.go b/pkg/detectors/owlbot/owlbot.go index 5b901b79..598695d2 100644 --- a/pkg/detectors/owlbot/owlbot.go +++ b/pkg/detectors/owlbot/owlbot.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://owlbot.info/api/v4/dictionary/security", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://owlbot.info/api/v4/dictionary/security", nil) req.Header.Add("Authorization", fmt.Sprintf("Token %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/pagerdutyapikey/pagerdutyapikey.go b/pkg/detectors/pagerdutyapikey/pagerdutyapikey.go index 4bd67a67..ee83d99b 100644 --- a/pkg/detectors/pagerdutyapikey/pagerdutyapikey.go +++ b/pkg/detectors/pagerdutyapikey/pagerdutyapikey.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.pagerduty.com/users", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.pagerduty.com/users", nil) req.Header.Add("Accept", "application/vnd.pagerduty+json;version=2") req.Header.Add("Content-Type", "application/json") req.Header.Add("Authorization", fmt.Sprintf("Token %s", resMatch)) diff --git a/pkg/detectors/pandadoc/pandadoc.go b/pkg/detectors/pandadoc/pandadoc.go index 1a57fa14..e58e80c3 100644 --- a/pkg/detectors/pandadoc/pandadoc.go +++ b/pkg/detectors/pandadoc/pandadoc.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.pandadoc.com/public/v1/documents", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.pandadoc.com/public/v1/documents", nil) req.Header.Add("Authorization", fmt.Sprintf("API-Key %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/paralleldots/paralleldots.go b/pkg/detectors/paralleldots/paralleldots.go index d687b302..83cc5c99 100644 --- a/pkg/detectors/paralleldots/paralleldots.go +++ b/pkg/detectors/paralleldots/paralleldots.go @@ -73,7 +73,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result continue } writer.Close() - req, _ := http.NewRequest("POST", "https://apis.paralleldots.com/v4/intent", bytes.NewReader(payload.Bytes())) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://apis.paralleldots.com/v4/intent", bytes.NewReader(payload.Bytes())) req.Header.Add("Content-Type", writer.FormDataContentType()) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/partnerstack/partnerstack.go b/pkg/detectors/partnerstack/partnerstack.go index b9ef9cfd..8ad5e012 100644 --- a/pkg/detectors/partnerstack/partnerstack.go +++ b/pkg/detectors/partnerstack/partnerstack.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.partnerstack.com/api/v2/partnerships", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.partnerstack.com/api/v2/partnerships", nil) req.Header.Add("Accept", "application/json") req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/passbase/passbase.go b/pkg/detectors/passbase/passbase.go index c9584a03..71419b1a 100644 --- a/pkg/detectors/passbase/passbase.go +++ b/pkg/detectors/passbase/passbase.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.passbase.com/verification/v1/settings", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.passbase.com/verification/v1/settings", nil) req.Header.Add("X-API-KEY", resMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/pastebin/pastebin.go b/pkg/detectors/pastebin/pastebin.go index dfc9c5d3..b811c112 100644 --- a/pkg/detectors/pastebin/pastebin.go +++ b/pkg/detectors/pastebin/pastebin.go @@ -80,7 +80,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result continue } writer.Close() - req, _ := http.NewRequest("POST", "https://pastebin.com/api/api_post.php", bytes.NewReader(body.Bytes())) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://pastebin.com/api/api_post.php", bytes.NewReader(body.Bytes())) req.Header.Add("Content-Type", writer.FormDataContentType()) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/paymoapp/paymoapp.go b/pkg/detectors/paymoapp/paymoapp.go index 79f67a7e..904f7115 100644 --- a/pkg/detectors/paymoapp/paymoapp.go +++ b/pkg/detectors/paymoapp/paymoapp.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://app.paymoapp.com/api/me", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://app.paymoapp.com/api/me", nil) req.Header.Add("Accept", "application/json") req.Header.Add("Authorization", fmt.Sprintf("Basic %s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/paymongo/paymongo.go b/pkg/detectors/paymongo/paymongo.go index c6cc92ed..14996df5 100644 --- a/pkg/detectors/paymongo/paymongo.go +++ b/pkg/detectors/paymongo/paymongo.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { payload := strings.NewReader(`{"data":{"attributes":{"type":"paymaya"}}}`) - req, _ := http.NewRequest("POST", "https://api.paymongo.com/v1/payment_methods", payload) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://api.paymongo.com/v1/payment_methods", payload) req.Header.Add("Content-Type", "application/json") req.SetBasicAuth(resMatch, "") res, err := client.Do(req) diff --git a/pkg/detectors/paypaloauth/paypaloauth.go b/pkg/detectors/paypaloauth/paypaloauth.go index 798721dd..2da65ec5 100644 --- a/pkg/detectors/paypaloauth/paypaloauth.go +++ b/pkg/detectors/paypaloauth/paypaloauth.go @@ -61,7 +61,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result data := fmt.Sprintf("%s:%s", residMatch, resMatch) encoded := b64.StdEncoding.EncodeToString([]byte(data)) payload := strings.NewReader("grant_type=client_credentials") - req, _ := http.NewRequest("POST", "https://api-m.sandbox.paypal.com/v1/oauth2/token", payload) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://api-m.sandbox.paypal.com/v1/oauth2/token", payload) req.Header.Add("Accept", "application/json") req.Header.Add("Accept-Language", "en_US") req.Header.Add("Content-Type", "application/x-www-form-urlencoded") diff --git a/pkg/detectors/paystack/paystack.go b/pkg/detectors/paystack/paystack.go index d5bee223..2c237fdd 100644 --- a/pkg/detectors/paystack/paystack.go +++ b/pkg/detectors/paystack/paystack.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.paystack.co/customer", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.paystack.co/customer", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/pdflayer/pdflayer.go b/pkg/detectors/pdflayer/pdflayer.go index 497bc399..d38d8a30 100644 --- a/pkg/detectors/pdflayer/pdflayer.go +++ b/pkg/detectors/pdflayer/pdflayer.go @@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("http://api.pdflayer.com/api/convert?access_key=%s&document_url=https://pdflayer.com/downloads/invoice.html", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("http://api.pdflayer.com/api/convert?access_key=%s&document_url=https://pdflayer.com/downloads/invoice.html", resMatch), nil) res, err := client.Do(req) if err == nil { bodyBytes, err := ioutil.ReadAll(res.Body) diff --git a/pkg/detectors/pdfshift/pdfshift.go b/pkg/detectors/pdfshift/pdfshift.go index 30635590..328d1401 100644 --- a/pkg/detectors/pdfshift/pdfshift.go +++ b/pkg/detectors/pdfshift/pdfshift.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.pdfshift.io/v3/credits/usage", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.pdfshift.io/v3/credits/usage", nil) req.Header.Add("Content-Type", "application/json") req.SetBasicAuth("api", resMatch) res, err := client.Do(req) diff --git a/pkg/detectors/peopledatalabs/peopledatalabs.go b/pkg/detectors/peopledatalabs/peopledatalabs.go index b9a8f88e..9c088fc4 100644 --- a/pkg/detectors/peopledatalabs/peopledatalabs.go +++ b/pkg/detectors/peopledatalabs/peopledatalabs.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.peopledatalabs.com/v5/person/enrich?min_likelihood=6&profile=http://linkedin.com/in/williamhgates", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.peopledatalabs.com/v5/person/enrich?min_likelihood=6&profile=http://linkedin.com/in/williamhgates", nil) req.Header.Add("X-Api-Key", resMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/pepipost/pepipost.go b/pkg/detectors/pepipost/pepipost.go index 9d044ecd..a7d34147 100644 --- a/pkg/detectors/pepipost/pepipost.go +++ b/pkg/detectors/pepipost/pepipost.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.pepipost.com/v5.1/domain/getDomains?domain=pepisandbox.com", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.pepipost.com/v5.1/domain/getDomains?domain=pepisandbox.com", nil) req.Header.Add("api_key", fmt.Sprintf("%s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/pipedrive/pipedrive.go b/pkg/detectors/pipedrive/pipedrive.go index 33407d35..6d481b12 100644 --- a/pkg/detectors/pipedrive/pipedrive.go +++ b/pkg/detectors/pipedrive/pipedrive.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://hooman.pipedrive.com/api/v1/users?api_token="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://hooman.pipedrive.com/api/v1/users?api_token="+resMatch, nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/pixabay/pixabay.go b/pkg/detectors/pixabay/pixabay.go index c09fd48d..5d0ee4bd 100644 --- a/pkg/detectors/pixabay/pixabay.go +++ b/pkg/detectors/pixabay/pixabay.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://pixabay.com/api/?key=%s&q=yellow+flowers&image_type=photo", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://pixabay.com/api/?key=%s&q=yellow+flowers&image_type=photo", resMatch), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/plaidkey/plaidkey.go b/pkg/detectors/plaidkey/plaidkey.go index 6c6720ac..60a39dcc 100644 --- a/pkg/detectors/plaidkey/plaidkey.go +++ b/pkg/detectors/plaidkey/plaidkey.go @@ -59,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { payload := strings.NewReader(`{"client_id":"` + idresMatch + `","secret":"` + resMatch + `","user":{"client_user_id":"60e3ee4019a2660010f8bc54","phone_number_verified_time":"0001-01-01T00:00:00Z","email_address_verified_time":"0001-01-01T00:00:00Z"},"client_name":"Plaid Test App","products":["auth","transactions"],"country_codes":["US"],"webhook":"https://webhook-uri.com","account_filters":{"depository":{"account_subtypes":["checking","savings"]}},"language":"en","link_customization_name":"default"}`) - req, _ := http.NewRequest("POST", "https://development.plaid.com/link/token/create", payload) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://development.plaid.com/link/token/create", payload) req.Header.Add("Content-Type", "application/json") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/planyo/planyo.go b/pkg/detectors/planyo/planyo.go index 5c1745c0..e2d9fc08 100644 --- a/pkg/detectors/planyo/planyo.go +++ b/pkg/detectors/planyo/planyo.go @@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://www.planyo.com/rest/?method=get_site_info&api_key=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://www.planyo.com/rest/?method=get_site_info&api_key=%s", resMatch), nil) req.Header.Add("Accept", "application/vnd.planyo+json; version=3") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/plivo/plivo.go b/pkg/detectors/plivo/plivo.go index 1aab436e..1b6fd4d6 100644 --- a/pkg/detectors/plivo/plivo.go +++ b/pkg/detectors/plivo/plivo.go @@ -58,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result stringResMatch := fmt.Sprintf("%s:%s", id, resMatch) decodeSecret := b64.StdEncoding.EncodeToString([]byte(stringResMatch)) if verify { - req, _ := http.NewRequest("GET", "https://api.plivo.com/v1/Account/"+id+"/Number/", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.plivo.com/v1/Account/"+id+"/Number/", nil) req.Header.Add("Accept", "application/json") req.Header.Add("Authorization", fmt.Sprintf("Basic %s", decodeSecret)) res, err := client.Do(req) diff --git a/pkg/detectors/poloniex/poloniex.go b/pkg/detectors/poloniex/poloniex.go index 845755e1..f82f7451 100644 --- a/pkg/detectors/poloniex/poloniex.go +++ b/pkg/detectors/poloniex/poloniex.go @@ -73,7 +73,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result signature := getPoloniexSignature(resSecretMatch, payload.Encode()) - req, _ := http.NewRequest("POST", "https://poloniex.com/tradingApi", strings.NewReader(payload.Encode())) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://poloniex.com/tradingApi", strings.NewReader(payload.Encode())) req.Header.Add("Content-Type", "application/x-www-form-urlencoded") req.Header.Add("Key", resMatch) req.Header.Add("Sign", signature) diff --git a/pkg/detectors/polygon/polygon.go b/pkg/detectors/polygon/polygon.go index 63c25180..98941eff 100644 --- a/pkg/detectors/polygon/polygon.go +++ b/pkg/detectors/polygon/polygon.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.polygon.io/v2/reference/locales?apiKey="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.polygon.io/v2/reference/locales?apiKey="+resMatch, nil) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/positionstack/positionstack.go b/pkg/detectors/positionstack/positionstack.go index 3e9b8f61..cdf746bf 100644 --- a/pkg/detectors/positionstack/positionstack.go +++ b/pkg/detectors/positionstack/positionstack.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("http://api.positionstack.com/v1/forward?access_key=%s&query=Philippines", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("http://api.positionstack.com/v1/forward?access_key=%s&query=Philippines", resMatch), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/postageapp/postageapp.go b/pkg/detectors/postageapp/postageapp.go index f55abce1..0c119fad 100644 --- a/pkg/detectors/postageapp/postageapp.go +++ b/pkg/detectors/postageapp/postageapp.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("POST", "https://api.postageapp.com/v.1.0/get_account_info.json?api_key="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://api.postageapp.com/v.1.0/get_account_info.json?api_key="+resMatch, nil) req.Header.Add("Content-Transfer-Encoding", "application/json") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/posthog/posthog.go b/pkg/detectors/posthog/posthog.go index ca00e348..9d195672 100644 --- a/pkg/detectors/posthog/posthog.go +++ b/pkg/detectors/posthog/posthog.go @@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result "api_key": "` + resMatch + `", "distinct_id": "1234" }`) - req, _ := http.NewRequest("POST", "https://app.posthog.com/decide/", payload) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://app.posthog.com/decide/", payload) req.Header.Add("Content-Type", "application/json") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/postman/postman.go b/pkg/detectors/postman/postman.go index d322065e..c16be610 100644 --- a/pkg/detectors/postman/postman.go +++ b/pkg/detectors/postman/postman.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.getpostman.com/collections", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.getpostman.com/collections", nil) req.Header.Add("x-api-key", fmt.Sprintf("%s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/postmark/postmark.go b/pkg/detectors/postmark/postmark.go index 63f66c86..2baf8f66 100644 --- a/pkg/detectors/postmark/postmark.go +++ b/pkg/detectors/postmark/postmark.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.postmarkapp.com/deliverystats", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.postmarkapp.com/deliverystats", nil) req.Header.Add("Accept", "application/json") req.Header.Add("Content-Type", "application/json") req.Header.Add("X-Postmark-Server-Token", fmt.Sprintf("%s", resMatch)) diff --git a/pkg/detectors/powrbot/powrbot.go b/pkg/detectors/powrbot/powrbot.go index dd8f47f8..d87f7925 100644 --- a/pkg/detectors/powrbot/powrbot.go +++ b/pkg/detectors/powrbot/powrbot.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://powrbot.com/api/v1/search/single/?company=Apple", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://powrbot.com/api/v1/search/single/?company=Apple", nil) req.Header.Add("Authorization", fmt.Sprintf("secret-key %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/prospectcrm/prospectcrm.go b/pkg/detectors/prospectcrm/prospectcrm.go index f7e5cf2c..ba3d42b2 100644 --- a/pkg/detectors/prospectcrm/prospectcrm.go +++ b/pkg/detectors/prospectcrm/prospectcrm.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api-batch-v1.prospect365.com/Contacts", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api-batch-v1.prospect365.com/Contacts", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/prospectio/prospectio.go b/pkg/detectors/prospectio/prospectio.go index 2eecdaad..1b4cb7a1 100644 --- a/pkg/detectors/prospectio/prospectio.go +++ b/pkg/detectors/prospectio/prospectio.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.prospect.io/public/v1/prospects", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.prospect.io/public/v1/prospects", nil) req.Header.Add("Authorization", fmt.Sprintf("%s", resMatch)) req.Header.Add("Content-Type", "application/vnd.api+json; charset=utf-8") res, err := client.Do(req) diff --git a/pkg/detectors/protocolsio/protocolsio.go b/pkg/detectors/protocolsio/protocolsio.go index e5315f7b..622385d0 100644 --- a/pkg/detectors/protocolsio/protocolsio.go +++ b/pkg/detectors/protocolsio/protocolsio.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://www.protocols.io/api/v3/session/profile", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://www.protocols.io/api/v3/session/profile", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/proxycrawl/proxycrawl.go b/pkg/detectors/proxycrawl/proxycrawl.go index 8a17ba20..e208e3aa 100644 --- a/pkg/detectors/proxycrawl/proxycrawl.go +++ b/pkg/detectors/proxycrawl/proxycrawl.go @@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { timeout := 10 * time.Second client.Timeout = timeout - req, _ := http.NewRequest("GET", fmt.Sprintf("https://api.proxycrawl.com/leads?token=%s&domain=slack.com", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://api.proxycrawl.com/leads?token=%s&domain=slack.com", resMatch), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/pubnubpublishkey/pubnubpublishkey.go b/pkg/detectors/pubnubpublishkey/pubnubpublishkey.go index 0b708fec..9814ba8a 100644 --- a/pkg/detectors/pubnubpublishkey/pubnubpublishkey.go +++ b/pkg/detectors/pubnubpublishkey/pubnubpublishkey.go @@ -59,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { - req, _ := http.NewRequest("GET", "https://ps.pndsn.com/signal/"+resMatch+"/"+ressubMatch+"/0/ch1/0/%22typing_on%22?uuid=user-123", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://ps.pndsn.com/signal/"+resMatch+"/"+ressubMatch+"/0/ch1/0/%22typing_on%22?uuid=user-123", nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/pubnubsubscriptionkey/pubnubsubscriptionkey.go b/pkg/detectors/pubnubsubscriptionkey/pubnubsubscriptionkey.go index 3b07482d..b4945d76 100644 --- a/pkg/detectors/pubnubsubscriptionkey/pubnubsubscriptionkey.go +++ b/pkg/detectors/pubnubsubscriptionkey/pubnubsubscriptionkey.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://ps.pndsn.com/v2/objects/"+resMatch+"/uuids", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://ps.pndsn.com/v2/objects/"+resMatch+"/uuids", nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/purestake/purestake.go b/pkg/detectors/purestake/purestake.go index ea9e21ca..d9a63dae 100644 --- a/pkg/detectors/purestake/purestake.go +++ b/pkg/detectors/purestake/purestake.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://testnet-algorand.api.purestake.io/idx2/health", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://testnet-algorand.api.purestake.io/idx2/health", nil) req.Header.Add("x-api-key", resMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/pushbulletapikey/pushbulletapikey.go b/pkg/detectors/pushbulletapikey/pushbulletapikey.go index 382a656a..da6c8435 100644 --- a/pkg/detectors/pushbulletapikey/pushbulletapikey.go +++ b/pkg/detectors/pushbulletapikey/pushbulletapikey.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.pushbullet.com/v2/users/me", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.pushbullet.com/v2/users/me", nil) req.Header.Add("Access-Token", fmt.Sprintf("%s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/pusherchannelkey/pusherchannelkey.go b/pkg/detectors/pusherchannelkey/pusherchannelkey.go index 6ca1110d..47db7da6 100644 --- a/pkg/detectors/pusherchannelkey/pusherchannelkey.go +++ b/pkg/detectors/pusherchannelkey/pusherchannelkey.go @@ -103,7 +103,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result url := "http://api-ap1.pusher.com/apps/" + resappMatch + "/events?auth_key=" + reskeyMatch + "&auth_signature=" + signature + "&auth_timestamp=" + timestamp + "&auth_version=1.0&body_md5=" + md5 - req, _ := http.NewRequest(method, url, payload) + req, _ := http.NewRequestWithContext(ctx, method, url, payload) req.Header.Add("Content-Type", "application/json") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/qualaroo/qualaroo.go b/pkg/detectors/qualaroo/qualaroo.go index 0909bd87..acb37f1c 100644 --- a/pkg/detectors/qualaroo/qualaroo.go +++ b/pkg/detectors/qualaroo/qualaroo.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.qualaroo.com/api/v1/nudges", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.qualaroo.com/api/v1/nudges", nil) req.Header.Add("Authorization", fmt.Sprintf("Basic %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/qubole/qubole.go b/pkg/detectors/qubole/qubole.go index 4533eba0..66cd1aa7 100644 --- a/pkg/detectors/qubole/qubole.go +++ b/pkg/detectors/qubole/qubole.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://us.qubole.com/api/v1.2/account", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://us.qubole.com/api/v1.2/account", nil) req.Header.Add("Content-Type", "application/json") req.Header.Add("Accept", "application/json") req.Header.Add("X-AUTH-TOKEN", fmt.Sprintf("%s", resMatch)) diff --git a/pkg/detectors/quickmetrics/quickmetrics.go b/pkg/detectors/quickmetrics/quickmetrics.go index d777c7fa..668e6c58 100644 --- a/pkg/detectors/quickmetrics/quickmetrics.go +++ b/pkg/detectors/quickmetrics/quickmetrics.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { payload := strings.NewReader(`[{"name":"api.response.time","dimension":null,"values":[[1568319841,12.4],[1568319856,9.3],[1568319860,234],[1568319863,3.2]]},{"name":"click.color","dimension":"green","values":[[1568319841,1],[1568319856,1],[1568319860,1],[1568319863,1]]}]`) - req, _ := http.NewRequest("POST", "https://qckm.io/list", payload) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://qckm.io/list", payload) req.Header.Add("Content-Type", "application/json") req.Header.Add("x-qm-key", resMatch) res, err := client.Do(req) diff --git a/pkg/detectors/rapidapi/rapidapi.go b/pkg/detectors/rapidapi/rapidapi.go index 9c18349e..9c44c32a 100644 --- a/pkg/detectors/rapidapi/rapidapi.go +++ b/pkg/detectors/rapidapi/rapidapi.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://covid-19-tracking.p.rapidapi.com/v1", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://covid-19-tracking.p.rapidapi.com/v1", nil) req.Header.Add("x-rapidapi-key", fmt.Sprintf("%s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/raven/raven.go b/pkg/detectors/raven/raven.go index 64e8bed0..e24ecc2e 100644 --- a/pkg/detectors/raven/raven.go +++ b/pkg/detectors/raven/raven.go @@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://api.raventools.com/api?key=%s&method=profile_info&format=json", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://api.raventools.com/api?key=%s&method=profile_info&format=json", resMatch), nil) res, err := client.Do(req) if err == nil { bodyBytes, err := ioutil.ReadAll(res.Body) diff --git a/pkg/detectors/rawg/rawg.go b/pkg/detectors/rawg/rawg.go index 2bf806d9..b1f0b694 100644 --- a/pkg/detectors/rawg/rawg.go +++ b/pkg/detectors/rawg/rawg.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.rawg.io/api/platforms?key="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.rawg.io/api/platforms?key="+resMatch, nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/readme/readme.go b/pkg/detectors/readme/readme.go index ee76d486..e2b78394 100644 --- a/pkg/detectors/readme/readme.go +++ b/pkg/detectors/readme/readme.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://dash.readme.com/api/v1", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://dash.readme.com/api/v1", nil) req.SetBasicAuth(resMatch, "") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/reallysimplesystems/reallysimplesystems.go b/pkg/detectors/reallysimplesystems/reallysimplesystems.go index ad177432..d36bab26 100644 --- a/pkg/detectors/reallysimplesystems/reallysimplesystems.go +++ b/pkg/detectors/reallysimplesystems/reallysimplesystems.go @@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://apiv4.reallysimplesystems.com/accounts", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://apiv4.reallysimplesystems.com/accounts", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/rebrandly/rebrandly.go b/pkg/detectors/rebrandly/rebrandly.go index 35bf3d16..eee9581b 100644 --- a/pkg/detectors/rebrandly/rebrandly.go +++ b/pkg/detectors/rebrandly/rebrandly.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.rebrandly.com/v1/account", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.rebrandly.com/v1/account", nil) req.Header.Add("apikey", resMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/refiner/refiner.go b/pkg/detectors/refiner/refiner.go index a91fd0f0..f2a2cabc 100644 --- a/pkg/detectors/refiner/refiner.go +++ b/pkg/detectors/refiner/refiner.go @@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { payload := strings.NewReader("id=Your-User-Id&event=Your%20event%20name") - req, _ := http.NewRequest("POST", "https://api.refiner.io/v1/identify-user", payload) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://api.refiner.io/v1/identify-user", payload) req.Header.Add("Content-Type", "application/x-www-form-urlencoded") req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/restpack/restpack.go b/pkg/detectors/restpack/restpack.go index d93db2c6..c9b4a27f 100644 --- a/pkg/detectors/restpack/restpack.go +++ b/pkg/detectors/restpack/restpack.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://restpack.io/api/screenshot/usage?access_token=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://restpack.io/api/screenshot/usage?access_token=%s", resMatch), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/restpackhtmltopdfapi/restpackhtmltopdfapi.go b/pkg/detectors/restpackhtmltopdfapi/restpackhtmltopdfapi.go index b531acfd..db46432d 100644 --- a/pkg/detectors/restpackhtmltopdfapi/restpackhtmltopdfapi.go +++ b/pkg/detectors/restpackhtmltopdfapi/restpackhtmltopdfapi.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://restpack.io/api/html2pdf/usage", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://restpack.io/api/html2pdf/usage", nil) req.Header.Add("Content-Type", "application/json") req.Header.Add("X-Access-Token", resMatch) res, err := client.Do(req) diff --git a/pkg/detectors/restpackscreenshotapi/restpackscreenshotapi.go b/pkg/detectors/restpackscreenshotapi/restpackscreenshotapi.go index 429f2e72..e5baf87d 100644 --- a/pkg/detectors/restpackscreenshotapi/restpackscreenshotapi.go +++ b/pkg/detectors/restpackscreenshotapi/restpackscreenshotapi.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://restpack.io/api/screenshot/usage", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://restpack.io/api/screenshot/usage", nil) req.Header.Add("Content-Type", "application/json") req.Header.Add("X-Access-Token", resMatch) res, err := client.Do(req) diff --git a/pkg/detectors/rev/rev.go b/pkg/detectors/rev/rev.go index b76b1f33..6b7c15c5 100644 --- a/pkg/detectors/rev/rev.go +++ b/pkg/detectors/rev/rev.go @@ -59,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://www.rev.com/api/v1/orders", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://www.rev.com/api/v1/orders", nil) req.Header.Add("Authorization", fmt.Sprintf("Rev %s:%s", resClientMatch, resUserMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/revampcrm/revampcrm.go b/pkg/detectors/revampcrm/revampcrm.go index 1c3398d2..1f397c87 100644 --- a/pkg/detectors/revampcrm/revampcrm.go +++ b/pkg/detectors/revampcrm/revampcrm.go @@ -58,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result Raw: []byte(tokenPatMatch), } if verify { - req, _ := http.NewRequest("GET", "https://app.revampcrm.com/api/1.0/User/WhoAmI", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://app.revampcrm.com/api/1.0/User/WhoAmI", nil) req.SetBasicAuth(userPatMatch, tokenPatMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/ringcentral/ringcentral.go b/pkg/detectors/ringcentral/ringcentral.go index 9174cb6b..af3061aa 100644 --- a/pkg/detectors/ringcentral/ringcentral.go +++ b/pkg/detectors/ringcentral/ringcentral.go @@ -58,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://platform.devtest.ringcentral.com/restapi/oauth/authorize?response_type=code&redirect_uri=%s&client_id=%s", resURI, resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://platform.devtest.ringcentral.com/restapi/oauth/authorize?response_type=code&redirect_uri=%s&client_id=%s", resURI, resMatch), nil) req.Header.Add("Content-Type", "application/json") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/ritekit/ritekit.go b/pkg/detectors/ritekit/ritekit.go index 9141bc6e..0e268a62 100644 --- a/pkg/detectors/ritekit/ritekit.go +++ b/pkg/detectors/ritekit/ritekit.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://api.ritekit.com/v1/stats/multiple-hashtags?tags=hello&client_id=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://api.ritekit.com/v1/stats/multiple-hashtags?tags=hello&client_id=%s", resMatch), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/roaring/roaring.go b/pkg/detectors/roaring/roaring.go index 0767d0ee..674b8196 100644 --- a/pkg/detectors/roaring/roaring.go +++ b/pkg/detectors/roaring/roaring.go @@ -63,7 +63,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result data := fmt.Sprintf("%s:%s", resClient, resSecret) sEnc := b64.StdEncoding.EncodeToString([]byte(data)) payload := strings.NewReader("grant_type=client_credentials") - req, _ := http.NewRequest("POST", "https://api.roaring.io/token", payload) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://api.roaring.io/token", payload) req.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/rocketreach/rocketreach.go b/pkg/detectors/rocketreach/rocketreach.go index fe3e0dd1..b2dd8099 100644 --- a/pkg/detectors/rocketreach/rocketreach.go +++ b/pkg/detectors/rocketreach/rocketreach.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.rocketreach.co/v2/api/account", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.rocketreach.co/v2/api/account", nil) req.Header.Add("Api-Key", resMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/roninapp/roninapp.go b/pkg/detectors/roninapp/roninapp.go index 268f77e2..092ae8e0 100644 --- a/pkg/detectors/roninapp/roninapp.go +++ b/pkg/detectors/roninapp/roninapp.go @@ -61,7 +61,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { data := fmt.Sprintf("%s:", resMatch) sEnc := b64.StdEncoding.EncodeToString([]byte(data)) - req, _ := http.NewRequest("GET", "https://"+resIdMatch+".roninapp.com/api/v2/invoices", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://"+resIdMatch+".roninapp.com/api/v2/invoices", nil) req.Header.Add("Accept", "application/json") req.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc)) res, err := client.Do(req) diff --git a/pkg/detectors/route4me/route4me.go b/pkg/detectors/route4me/route4me.go index 5952f7a2..a7609f2a 100644 --- a/pkg/detectors/route4me/route4me.go +++ b/pkg/detectors/route4me/route4me.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.route4me.com/api.v4/address_book.php?api_key="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.route4me.com/api.v4/address_book.php?api_key="+resMatch, nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/rubygems/rubygems.go b/pkg/detectors/rubygems/rubygems.go index 7e33d9e1..162aba22 100644 --- a/pkg/detectors/rubygems/rubygems.go +++ b/pkg/detectors/rubygems/rubygems.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://rubygems.org/api/v1/gems", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://rubygems.org/api/v1/gems", nil) req.Header.Add("Accept", "*/*") req.Header.Add("Authorization", resMatch) res, err := client.Do(req) diff --git a/pkg/detectors/runrunit/runrunit.go b/pkg/detectors/runrunit/runrunit.go index d624b417..5d336432 100644 --- a/pkg/detectors/runrunit/runrunit.go +++ b/pkg/detectors/runrunit/runrunit.go @@ -58,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://runrun.it/api/v1.0/users", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://runrun.it/api/v1.0/users", nil) req.Header.Add("App-Key", resMatch) req.Header.Add("User-Token", resUserTokenMatch) res, err := client.Do(req) diff --git a/pkg/detectors/salesblink/salesblink.go b/pkg/detectors/salesblink/salesblink.go index b8cb65d8..53dec2e2 100644 --- a/pkg/detectors/salesblink/salesblink.go +++ b/pkg/detectors/salesblink/salesblink.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://run.salesblink.io/api/campaigns", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://run.salesblink.io/api/campaigns", nil) req.Header.Add("Authorization", resMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/salescookie/salescookie.go b/pkg/detectors/salescookie/salescookie.go index 1ab75e27..a6faba42 100644 --- a/pkg/detectors/salescookie/salescookie.go +++ b/pkg/detectors/salescookie/salescookie.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { payload := strings.NewReader(`{"date":"2021-07-04T02:47:42.1442597Z","uniqueId":"id-123","revenue":1.3,"profit":-2.5,"currency":"USD","transactionStatus":"closed won","customer":"Candy By Mail","product":"Lemon Cake","owner1":"John Doe","owner2":"Jane Doe","owner3":"Bob Smith","team1":"USA","team2":"Washington","team3":"98004","quantity":3,"costPerUnit":3.14,"taxes":6.54,"otherText1":"additional data","otherText2":"more data","otherText3":"even more data","otherNumeric1":123.45,"otherNumeric2":54.321,"otherNumeric3":-98.76,"otherDate1":"2019-01-03T06:03:01Z","otherDate2":"2019-05-10T08:05:09Z","otherDate3":"2019-09-04T12:17:33Z"}`) - req, _ := http.NewRequest("POST", "https://salescookie.com/app/Api/CreateTransaction", payload) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://salescookie.com/app/Api/CreateTransaction", payload) req.Header.Add("X-ApiKey", resMatch) req.Header.Add("Content-Type", "application/json") res, err := client.Do(req) diff --git a/pkg/detectors/salesflare/salesflare.go b/pkg/detectors/salesflare/salesflare.go index c152d51c..71dcf58d 100644 --- a/pkg/detectors/salesflare/salesflare.go +++ b/pkg/detectors/salesflare/salesflare.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.salesflare.com/me/contacts", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.salesflare.com/me/contacts", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/satismeterprojectkey/satismeterprojectkey.go b/pkg/detectors/satismeterprojectkey/satismeterprojectkey.go index 7b36a83a..afde83b4 100644 --- a/pkg/detectors/satismeterprojectkey/satismeterprojectkey.go +++ b/pkg/detectors/satismeterprojectkey/satismeterprojectkey.go @@ -72,7 +72,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result data := fmt.Sprintf("%s:%s", resEmailMatch, resPassMatch) sEnc := b64.StdEncoding.EncodeToString([]byte(data)) - req, _ := http.NewRequest("GET", "https://app.satismeter.com/api/users?project="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://app.satismeter.com/api/users?project="+resMatch, nil) req.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/satismeterwritekey/satismeterwritekey.go b/pkg/detectors/satismeterwritekey/satismeterwritekey.go index e4448acf..1b75ccb7 100644 --- a/pkg/detectors/satismeterwritekey/satismeterwritekey.go +++ b/pkg/detectors/satismeterwritekey/satismeterwritekey.go @@ -56,7 +56,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result "event": "This is the event name", "writeKey": "` + resMatch + `" }`) - req, _ := http.NewRequest("POST", "https://app.satismeter.com/api/users?type=track", payload) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://app.satismeter.com/api/users?type=track", payload) req.Header.Add("Content-Type", "application/json") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/saucelabs/saucelabs.go b/pkg/detectors/saucelabs/saucelabs.go index 367facf3..ca4cfd9f 100644 --- a/pkg/detectors/saucelabs/saucelabs.go +++ b/pkg/detectors/saucelabs/saucelabs.go @@ -64,7 +64,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { data := fmt.Sprintf("%s:%s", idMatch, keyMatch) encoded := b64.StdEncoding.EncodeToString([]byte(data)) - req, _ := http.NewRequest("GET", "https://api.eu-central-1.saucelabs.com/team-management/v1/teams", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.eu-central-1.saucelabs.com/team-management/v1/teams", nil) req.Header.Add("Authorization", fmt.Sprintf("Basic %s", encoded)) //req.SetBasicAuth(idMatch, keyMatch) res, err := client.Do(req) diff --git a/pkg/detectors/scalewaykey/scalewaykey.go b/pkg/detectors/scalewaykey/scalewaykey.go index d0093850..b6b28d65 100644 --- a/pkg/detectors/scalewaykey/scalewaykey.go +++ b/pkg/detectors/scalewaykey/scalewaykey.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.scaleway.com/instance/v1/zones/fr-par-1/servers", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.scaleway.com/instance/v1/zones/fr-par-1/servers", nil) req.Header.Add("X-Auth-Token", fmt.Sprintf("%s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/scrapeowl/scrapeowl.go b/pkg/detectors/scrapeowl/scrapeowl.go index 71c86726..173805a5 100644 --- a/pkg/detectors/scrapeowl/scrapeowl.go +++ b/pkg/detectors/scrapeowl/scrapeowl.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.scrapeowl.com/v1/scrape?api_key="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.scrapeowl.com/v1/scrape?api_key="+resMatch, nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/scraperapi/scraperapi.go b/pkg/detectors/scraperapi/scraperapi.go index a0dcebd8..5bf39c2c 100644 --- a/pkg/detectors/scraperapi/scraperapi.go +++ b/pkg/detectors/scraperapi/scraperapi.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, _ := http.NewRequest("GET", fmt.Sprintf("http://api.scraperapi.com?api_key=%s&url=google.com", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("http://api.scraperapi.com?api_key=%s&url=google.com", resMatch), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/scraperbox/scraperbox.go b/pkg/detectors/scraperbox/scraperbox.go index 26db0b48..4bce063c 100644 --- a/pkg/detectors/scraperbox/scraperbox.go +++ b/pkg/detectors/scraperbox/scraperbox.go @@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { timeout := 10 * time.Second client.Timeout = timeout - req, _ := http.NewRequest("GET", fmt.Sprintf("https://api.scraperbox.com/scrape?token=%s&url=https://google.com", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://api.scraperbox.com/scrape?token=%s&url=https://google.com", resMatch), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/scrapersite/scrapersite.go b/pkg/detectors/scrapersite/scrapersite.go index 190dc4ad..bd9d22c5 100644 --- a/pkg/detectors/scrapersite/scrapersite.go +++ b/pkg/detectors/scrapersite/scrapersite.go @@ -55,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { timeout := 10 * time.Second client.Timeout = timeout - req, _ := http.NewRequest("GET", fmt.Sprintf("https://scrapersite.com/api-v1?api_key=%s&url=https://google.com", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://scrapersite.com/api-v1?api_key=%s&url=https://google.com", resMatch), nil) res, err := client.Do(req) if err == nil { bodyBytes, err := ioutil.ReadAll(res.Body) diff --git a/pkg/detectors/scrapestack/scrapestack.go b/pkg/detectors/scrapestack/scrapestack.go index aca95456..df69f461 100644 --- a/pkg/detectors/scrapestack/scrapestack.go +++ b/pkg/detectors/scrapestack/scrapestack.go @@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("http://api.scrapestack.com/scrape?access_key=%s&url=https://apple.com", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("http://api.scrapestack.com/scrape?access_key=%s&url=https://apple.com", resMatch), nil) res, err := client.Do(req) if err == nil { bodyBytes, err := ioutil.ReadAll(res.Body) diff --git a/pkg/detectors/scrapfly/scrapfly.go b/pkg/detectors/scrapfly/scrapfly.go index fd5e9ee4..fdc22378 100644 --- a/pkg/detectors/scrapfly/scrapfly.go +++ b/pkg/detectors/scrapfly/scrapfly.go @@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { timeout := 10 * time.Second client.Timeout = timeout - req, _ := http.NewRequest("GET", fmt.Sprintf("https://api.scrapfly.io/scrape?key=%s&url=https://google.com", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://api.scrapfly.io/scrape?key=%s&url=https://google.com", resMatch), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/scrapingant/scrapingant.go b/pkg/detectors/scrapingant/scrapingant.go index 89f47d94..ac01a77b 100644 --- a/pkg/detectors/scrapingant/scrapingant.go +++ b/pkg/detectors/scrapingant/scrapingant.go @@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { timeout := 10 * time.Second client.Timeout = timeout - req, _ := http.NewRequest("GET", "https://api.scrapingant.com/v1/general?url=google.com", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.scrapingant.com/v1/general?url=google.com", nil) req.Header.Add("x-api-key", resMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/scrapingbee/scrapingbee.go b/pkg/detectors/scrapingbee/scrapingbee.go index 3325e065..50ea6e3a 100644 --- a/pkg/detectors/scrapingbee/scrapingbee.go +++ b/pkg/detectors/scrapingbee/scrapingbee.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://app.scrapingbee.com/api/v1/?api_key="+resMatch+"&url=http://httpbin.org/anything?json&render_js=false", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://app.scrapingbee.com/api/v1/?api_key="+resMatch+"&url=http://httpbin.org/anything?json&render_js=false", nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/screenshotapi/screenshotapi.go b/pkg/detectors/screenshotapi/screenshotapi.go index 33853864..f5227c81 100644 --- a/pkg/detectors/screenshotapi/screenshotapi.go +++ b/pkg/detectors/screenshotapi/screenshotapi.go @@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { timeout := 10 * time.Second client.Timeout = timeout - req, _ := http.NewRequest("GET", "https://shot.screenshotapi.net/screenshot?token="+resMatch+"&url=https://google.com&width=1920&height=1080&output=image", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://shot.screenshotapi.net/screenshot?token="+resMatch+"&url=https://google.com&width=1920&height=1080&output=image", nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/screenshotlayer/screenshotlayer.go b/pkg/detectors/screenshotlayer/screenshotlayer.go index 06270905..014c369a 100644 --- a/pkg/detectors/screenshotlayer/screenshotlayer.go +++ b/pkg/detectors/screenshotlayer/screenshotlayer.go @@ -55,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { timeout := 10 * time.Second client.Timeout = timeout - req, _ := http.NewRequest("GET", fmt.Sprintf("http://api.screenshotlayer.com/api/capture?access_key=%s&url=https://google.com", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("http://api.screenshotlayer.com/api/capture?access_key=%s&url=https://google.com", resMatch), nil) res, err := client.Do(req) if err == nil { bodyBytes, err := ioutil.ReadAll(res.Body) diff --git a/pkg/detectors/securitytrails/securitytrails.go b/pkg/detectors/securitytrails/securitytrails.go index a55c54e2..e0bfbf83 100644 --- a/pkg/detectors/securitytrails/securitytrails.go +++ b/pkg/detectors/securitytrails/securitytrails.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.securitytrails.com/v1/ping", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.securitytrails.com/v1/ping", nil) req.Header.Add("APIKEY", resMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/segmentapikey/segmentapikey.go b/pkg/detectors/segmentapikey/segmentapikey.go index 14179d77..466ea091 100644 --- a/pkg/detectors/segmentapikey/segmentapikey.go +++ b/pkg/detectors/segmentapikey/segmentapikey.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://platform.segmentapis.com/v1beta/workspaces", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://platform.segmentapis.com/v1beta/workspaces", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/selectpdf/selectpdf.go b/pkg/detectors/selectpdf/selectpdf.go index 5ed9a3cf..c2360ecf 100644 --- a/pkg/detectors/selectpdf/selectpdf.go +++ b/pkg/detectors/selectpdf/selectpdf.go @@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { timeout := 10 * time.Second client.Timeout = timeout - req, _ := http.NewRequest("GET", fmt.Sprintf("https://selectpdf.com/api2/convert/?key=%s&url=google.com", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://selectpdf.com/api2/convert/?key=%s&url=google.com", resMatch), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/semaphore/semaphore.go b/pkg/detectors/semaphore/semaphore.go index ee676f9e..b4cb826a 100644 --- a/pkg/detectors/semaphore/semaphore.go +++ b/pkg/detectors/semaphore/semaphore.go @@ -56,7 +56,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://api.semaphore.co/api/v4/account?apikey=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://api.semaphore.co/api/v4/account?apikey=%s", resMatch), nil) req.Header.Add("Accept", "application/vnd.semaphore+json; version=3") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/sendgrid/sendgrid.go b/pkg/detectors/sendgrid/sendgrid.go index 486afa88..82f8f3a3 100644 --- a/pkg/detectors/sendgrid/sendgrid.go +++ b/pkg/detectors/sendgrid/sendgrid.go @@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result baseURL := "https://api.sendgrid.com/v3/templates" // test `read_user` scope - req, _ := http.NewRequest("GET", baseURL, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", baseURL, nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", res)) req.Header.Add("Content-Type", "application/json") res, err := client.Do(req) diff --git a/pkg/detectors/sendinbluev2/sendinbluev2.go b/pkg/detectors/sendinbluev2/sendinbluev2.go index 5582d874..0bfc6e9a 100644 --- a/pkg/detectors/sendinbluev2/sendinbluev2.go +++ b/pkg/detectors/sendinbluev2/sendinbluev2.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.sendinblue.com/v3/account", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.sendinblue.com/v3/account", nil) req.Header.Add("api-key", fmt.Sprintf("%s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/sentiment/sentiment.go b/pkg/detectors/sentiment/sentiment.go index db7e50f6..c8e93b93 100644 --- a/pkg/detectors/sentiment/sentiment.go +++ b/pkg/detectors/sentiment/sentiment.go @@ -60,7 +60,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.sentimentinvestor.com/v4/parsed?symbol=AAPL&token="+tokenMatch+"&key="+keyMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.sentimentinvestor.com/v4/parsed?symbol=AAPL&token="+tokenMatch+"&key="+keyMatch, nil) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/sentrytoken/sentrytoken.go b/pkg/detectors/sentrytoken/sentrytoken.go index af7cf6e6..f8fcabab 100644 --- a/pkg/detectors/sentrytoken/sentrytoken.go +++ b/pkg/detectors/sentrytoken/sentrytoken.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://sentry.io/api/0/projects/", nil) + req, err := http.NewRequestWithContext(ctx, "GET", "https://sentry.io/api/0/projects/", nil) if err != nil { continue } diff --git a/pkg/detectors/serphouse/serphouse.go b/pkg/detectors/serphouse/serphouse.go index 9e18e595..70c0599d 100644 --- a/pkg/detectors/serphouse/serphouse.go +++ b/pkg/detectors/serphouse/serphouse.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.serphouse.com/account/info", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.serphouse.com/account/info", nil) req.Header.Add("Accept", "application/vnd.serphouse+json; version=3") req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/serpstack/serpstack.go b/pkg/detectors/serpstack/serpstack.go index e9cc5970..7eab726f 100644 --- a/pkg/detectors/serpstack/serpstack.go +++ b/pkg/detectors/serpstack/serpstack.go @@ -55,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { timeout := 10 * time.Second client.Timeout = timeout - req, _ := http.NewRequest("GET", fmt.Sprintf("http://api.serpstack.com/search?access_key=%s&query=Mcdonalds", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("http://api.serpstack.com/search?access_key=%s&query=Mcdonalds", resMatch), nil) res, err := client.Do(req) if err == nil { bodyBytes, err := ioutil.ReadAll(res.Body) diff --git a/pkg/detectors/sheety/sheety.go b/pkg/detectors/sheety/sheety.go index aa0001c5..94818822 100644 --- a/pkg/detectors/sheety/sheety.go +++ b/pkg/detectors/sheety/sheety.go @@ -58,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.sheety.co/"+resIdMatch+"/restaurantMenu/menuItems", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.sheety.co/"+resIdMatch+"/restaurantMenu/menuItems", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/sherpadesk/sherpadesk.go b/pkg/detectors/sherpadesk/sherpadesk.go index c6e0c2ba..7ad2b864 100644 --- a/pkg/detectors/sherpadesk/sherpadesk.go +++ b/pkg/detectors/sherpadesk/sherpadesk.go @@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { data := fmt.Sprintf("x:%s", resMatch) sEnc := b64.StdEncoding.EncodeToString([]byte(data)) - req, _ := http.NewRequest("GET", "https://api.sherpadesk.com/organizations/", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.sherpadesk.com/organizations/", nil) req.Header.Add("Content-Type", "application/json") req.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc)) res, err := client.Do(req) diff --git a/pkg/detectors/shipday/shipday.go b/pkg/detectors/shipday/shipday.go index b49f0309..fabbcfd0 100644 --- a/pkg/detectors/shipday/shipday.go +++ b/pkg/detectors/shipday/shipday.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.shipday.com/carriers", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.shipday.com/carriers", nil) req.Header.Add("Authorization", fmt.Sprintf("Basic %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/shodankey/shodankey.go b/pkg/detectors/shodankey/shodankey.go index 5baf1e55..43b97e85 100644 --- a/pkg/detectors/shodankey/shodankey.go +++ b/pkg/detectors/shodankey/shodankey.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.shodan.io/shodan/host/count?key="+resMatch+"&query=port:22&facets=org,os", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.shodan.io/shodan/host/count?key="+resMatch+"&query=port:22&facets=org,os", nil) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/shortcut/shortcut.go b/pkg/detectors/shortcut/shortcut.go index 33bb8213..7613c0d2 100644 --- a/pkg/detectors/shortcut/shortcut.go +++ b/pkg/detectors/shortcut/shortcut.go @@ -51,13 +51,19 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.app.shortcut.com/api/v3/categories", nil) + req, err := http.NewRequestWithContext(ctx, "GET", "https://api.app.shortcut.com/api/v3/categories", nil) + if err != nil { + continue + } req.Header.Add("Content-Type", "application/json") req.Header.Add("Shortcut-Token", resMatch) res, err := client.Do(req) if err == nil { defer res.Body.Close() - bodyBytes, _ := ioutil.ReadAll(res.Body) + bodyBytes, err := ioutil.ReadAll(res.Body) + if err != nil { + continue + } body := string(bodyBytes) if !strings.Contains(body, "Unauthorized") { diff --git a/pkg/detectors/shotstack/shotstack.go b/pkg/detectors/shotstack/shotstack.go index 39a29080..76d4255c 100644 --- a/pkg/detectors/shotstack/shotstack.go +++ b/pkg/detectors/shotstack/shotstack.go @@ -80,7 +80,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result "output":{"format":"mp4", "resolution":"sd" } }`) - req, _ := http.NewRequest("POST", "https://api.shotstack.io/stage/render", payload) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://api.shotstack.io/stage/render", payload) req.Header.Add("Content-Type", "application/json") req.Header.Add("Accept", "application/json") req.Header.Add("x-api-key", resMatch) diff --git a/pkg/detectors/shutterstock/shutterstock.go b/pkg/detectors/shutterstock/shutterstock.go index 3fdc1e91..e3f017b2 100644 --- a/pkg/detectors/shutterstock/shutterstock.go +++ b/pkg/detectors/shutterstock/shutterstock.go @@ -58,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.shutterstock.com/v2/images/search", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.shutterstock.com/v2/images/search", nil) req.Header.Add("Accept", "application/json") req.SetBasicAuth(resMatch, resSecretMatch) res, err := client.Do(req) diff --git a/pkg/detectors/shutterstockoauth/shutterstockoauth.go b/pkg/detectors/shutterstockoauth/shutterstockoauth.go index b3baf2e5..0b1a3ef9 100644 --- a/pkg/detectors/shutterstockoauth/shutterstockoauth.go +++ b/pkg/detectors/shutterstockoauth/shutterstockoauth.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.shutterstock.com/v2/user", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.shutterstock.com/v2/user", nil) req.Header.Add("Accept", "application/json") req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/signalwire/signalwire.go b/pkg/detectors/signalwire/signalwire.go index 1d1662ae..33024627 100644 --- a/pkg/detectors/signalwire/signalwire.go +++ b/pkg/detectors/signalwire/signalwire.go @@ -70,7 +70,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { data := fmt.Sprintf("%s:%s", resID, resMatch) sEnc := b64.StdEncoding.EncodeToString([]byte(data)) - req, _ := http.NewRequest("GET", fmt.Sprintf("https://%s/api/laml/2010-04-01/Accounts", resURL), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://%s/api/laml/2010-04-01/Accounts", resURL), nil) req.Header.Add("Content-Type", "application/json") req.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc)) res, err := client.Do(req) diff --git a/pkg/detectors/signaturit/signaturit.go b/pkg/detectors/signaturit/signaturit.go index 1fe3531e..c5cd0bf9 100644 --- a/pkg/detectors/signaturit/signaturit.go +++ b/pkg/detectors/signaturit/signaturit.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.sandbox.signaturit.com/v3/signatures.json", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.sandbox.signaturit.com/v3/signatures.json", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/signupgenius/signupgenius.go b/pkg/detectors/signupgenius/signupgenius.go index 7b1f44f9..075056c4 100644 --- a/pkg/detectors/signupgenius/signupgenius.go +++ b/pkg/detectors/signupgenius/signupgenius.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.signupgenius.com/v2/k/user/profile/?user_key="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.signupgenius.com/v2/k/user/profile/?user_key="+resMatch, nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/sigopt/sigopt.go b/pkg/detectors/sigopt/sigopt.go index 76315fc8..63b5dadb 100644 --- a/pkg/detectors/sigopt/sigopt.go +++ b/pkg/detectors/sigopt/sigopt.go @@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { data := fmt.Sprintf("%s:", resMatch) sEnc := b64.StdEncoding.EncodeToString([]byte(data)) - req, _ := http.NewRequest("GET", "https://api.sigopt.com/v1/experiments", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.sigopt.com/v1/experiments", nil) req.Header.Add("Content-Type", "application/json") req.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc)) res, err := client.Do(req) diff --git a/pkg/detectors/simplesat/simplesat.go b/pkg/detectors/simplesat/simplesat.go index 911926e0..ed58478b 100644 --- a/pkg/detectors/simplesat/simplesat.go +++ b/pkg/detectors/simplesat/simplesat.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.simplesat.io/api/answers/", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.simplesat.io/api/answers/", nil) req.Header.Add("X-Simplesat-Token", resMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/simplynoted/simplynoted.go b/pkg/detectors/simplynoted/simplynoted.go index bd5c5b18..e819b1c1 100644 --- a/pkg/detectors/simplynoted/simplynoted.go +++ b/pkg/detectors/simplynoted/simplynoted.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.simplynoted.com/api/products", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.simplynoted.com/api/products", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/simvoly/simvoly.go b/pkg/detectors/simvoly/simvoly.go index 23ffbf4f..1e0bb432 100644 --- a/pkg/detectors/simvoly/simvoly.go +++ b/pkg/detectors/simvoly/simvoly.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://rendyplayground.simvoly.com/api/site/members?group_id=12&limit=25&skip=25", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://rendyplayground.simvoly.com/api/site/members?group_id=12&limit=25&skip=25", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/sinchmessage/sinchmessage.go b/pkg/detectors/sinchmessage/sinchmessage.go index df170736..7bfd0d44 100644 --- a/pkg/detectors/sinchmessage/sinchmessage.go +++ b/pkg/detectors/sinchmessage/sinchmessage.go @@ -64,7 +64,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result "to": [ "639668957581" ], "body": "This is a test message from your Sinch account" }`) - req, _ := http.NewRequest("POST", "https://sms.api.sinch.com/xms/v1/"+resIdMatch+"/batches", payload) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://sms.api.sinch.com/xms/v1/"+resIdMatch+"/batches", payload) req.Header.Add("Content-Type", "application/json") req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/siteleaf/siteleaf.go b/pkg/detectors/siteleaf/siteleaf.go index 63494be0..646228ac 100644 --- a/pkg/detectors/siteleaf/siteleaf.go +++ b/pkg/detectors/siteleaf/siteleaf.go @@ -63,7 +63,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result data := fmt.Sprintf("%s:%s", resIdMatch, resMatch) sEnc := b64.StdEncoding.EncodeToString([]byte(data)) - req, _ := http.NewRequest("GET", "https://api.siteleaf.com/v2/sites", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.siteleaf.com/v2/sites", nil) req.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc)) res, err := client.Do(req) diff --git a/pkg/detectors/skrappio/skrappio.go b/pkg/detectors/skrappio/skrappio.go index 1f252f96..7ea0adc6 100644 --- a/pkg/detectors/skrappio/skrappio.go +++ b/pkg/detectors/skrappio/skrappio.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.skrapp.io/api/v2/account", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.skrapp.io/api/v2/account", nil) req.Header.Add("Content-Type", "application/json") req.Header.Add("X-Access-Key", fmt.Sprintf("%s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/skybiometry/skybiometry.go b/pkg/detectors/skybiometry/skybiometry.go index 5e99e218..46927044 100644 --- a/pkg/detectors/skybiometry/skybiometry.go +++ b/pkg/detectors/skybiometry/skybiometry.go @@ -64,7 +64,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result payload.Add("api_key", resMatch) payload.Add("api_secret", resSecretMatch) - req, _ := http.NewRequest("GET", "http://api.skybiometry.com/fc/account/authenticate?"+payload.Encode(), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "http://api.skybiometry.com/fc/account/authenticate?"+payload.Encode(), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/slack/slack.go b/pkg/detectors/slack/slack.go index 3565adb2..d48147aa 100644 --- a/pkg/detectors/slack/slack.go +++ b/pkg/detectors/slack/slack.go @@ -59,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { client := common.SaneHttpClient() - req, _ := http.NewRequest("POST", verifyURL, nil) + req, _ := http.NewRequestWithContext(ctx, "POST", verifyURL, nil) req.Header.Add("Content-Type", "application/json; charset=utf-8") req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", token)) res, err := client.Do(req) diff --git a/pkg/detectors/slackwebhook/slackwebhook.go b/pkg/detectors/slackwebhook/slackwebhook.go index eb9bd0cf..3c5ffcb2 100644 --- a/pkg/detectors/slackwebhook/slackwebhook.go +++ b/pkg/detectors/slackwebhook/slackwebhook.go @@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { payload := strings.NewReader(`{"text": ""}`) - req, _ := http.NewRequest("POST", resMatch, payload) + req, _ := http.NewRequestWithContext(ctx, "POST", resMatch, payload) req.Header.Add("Content-Type", "application/json") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/smartsheets/smartsheets.go b/pkg/detectors/smartsheets/smartsheets.go index f3b2d258..f1906552 100644 --- a/pkg/detectors/smartsheets/smartsheets.go +++ b/pkg/detectors/smartsheets/smartsheets.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.smartsheet.com/2.0/sheets", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.smartsheet.com/2.0/sheets", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/smartystreets/smartystreets.go b/pkg/detectors/smartystreets/smartystreets.go index 3cc46487..1806e5fe 100644 --- a/pkg/detectors/smartystreets/smartystreets.go +++ b/pkg/detectors/smartystreets/smartystreets.go @@ -59,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://us-zipcode.api.smartystreets.com/lookup?auth-id=%s&auth-token=%s&state=CA&zipcode=94035", resIdMatch, resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://us-zipcode.api.smartystreets.com/lookup?auth-id=%s&auth-token=%s&state=CA&zipcode=94035", resIdMatch, resMatch), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/smooch/smooch.go b/pkg/detectors/smooch/smooch.go index 50281123..55ed804f 100644 --- a/pkg/detectors/smooch/smooch.go +++ b/pkg/detectors/smooch/smooch.go @@ -62,7 +62,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { data := fmt.Sprintf("%s:%s", resMatch, resSecret) sEnc := b64.StdEncoding.EncodeToString([]byte(data)) - req, _ := http.NewRequest("GET", "https://api.smooch.io/v2/apps", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.smooch.io/v2/apps", nil) req.Header.Add("Accept", "application/vnd.smooch+json; version=3") req.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc)) res, err := client.Do(req) diff --git a/pkg/detectors/snipcart/snipcart.go b/pkg/detectors/snipcart/snipcart.go index 599e081b..8a11d807 100644 --- a/pkg/detectors/snipcart/snipcart.go +++ b/pkg/detectors/snipcart/snipcart.go @@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { data := fmt.Sprintf("%s:", resMatch) sEnc := b64.StdEncoding.EncodeToString([]byte(data)) - req, _ := http.NewRequest("GET", "https://app.snipcart.com/api/orders", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://app.snipcart.com/api/orders", nil) req.Header.Add("Accept", "application/json") req.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc)) res, err := client.Do(req) diff --git a/pkg/detectors/snykkey/snykkey.go b/pkg/detectors/snykkey/snykkey.go index ae1a64d0..5c4ac98c 100644 --- a/pkg/detectors/snykkey/snykkey.go +++ b/pkg/detectors/snykkey/snykkey.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://snyk.io/api/v1/user/me", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://snyk.io/api/v1/user/me", nil) req.Header.Add("Authorization", fmt.Sprintf("token %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/sparkpost/sparkpost.go b/pkg/detectors/sparkpost/sparkpost.go index 0f9849c9..ed127c40 100644 --- a/pkg/detectors/sparkpost/sparkpost.go +++ b/pkg/detectors/sparkpost/sparkpost.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.sparkpost.com/api/v1/account", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.sparkpost.com/api/v1/account", nil) req.Header.Add("Authorization", resMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/splunkobservabilitytoken/splunkobservabilitytoken.go b/pkg/detectors/splunkobservabilitytoken/splunkobservabilitytoken.go index 0b68551a..a03f0dac 100644 --- a/pkg/detectors/splunkobservabilitytoken/splunkobservabilitytoken.go +++ b/pkg/detectors/splunkobservabilitytoken/splunkobservabilitytoken.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.us1.signalfx.com/v2/dashboard", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.us1.signalfx.com/v2/dashboard", nil) req.Header.Set("Content-Type", "application/json") req.Header.Set("X-Sf-Token", resMatch) res, err := client.Do(req) diff --git a/pkg/detectors/spoonacular/spoonacular.go b/pkg/detectors/spoonacular/spoonacular.go index 6ff32a61..97ee75b4 100644 --- a/pkg/detectors/spoonacular/spoonacular.go +++ b/pkg/detectors/spoonacular/spoonacular.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://api.spoonacular.com/recipes/random?apiKey=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://api.spoonacular.com/recipes/random?apiKey=%s", resMatch), nil) req.Header.Add("Content-Type", "application/json") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/sportsmonk/sportsmonk.go b/pkg/detectors/sportsmonk/sportsmonk.go index 87120f78..01b55c8c 100644 --- a/pkg/detectors/sportsmonk/sportsmonk.go +++ b/pkg/detectors/sportsmonk/sportsmonk.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://soccer.sportmonks.com/api/v2.0/leagues?api_token="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://soccer.sportmonks.com/api/v2.0/leagues?api_token="+resMatch, nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/squarespace/squarespace.go b/pkg/detectors/squarespace/squarespace.go index 51e4f52f..4bf37174 100644 --- a/pkg/detectors/squarespace/squarespace.go +++ b/pkg/detectors/squarespace/squarespace.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.squarespace.com/1.0/profiles?sortField=email&sortDirection=asc&filter=isCustomer,true;hasAccount,true", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.squarespace.com/1.0/profiles?sortField=email&sortDirection=asc&filter=isCustomer,true;hasAccount,true", nil) req.Header.Add("User-Agent", "YOUR_CUSTOM_APP_DESCRIPTION") req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/squareup/squareup.go b/pkg/detectors/squareup/squareup.go index 72731dca..0cf7fd17 100644 --- a/pkg/detectors/squareup/squareup.go +++ b/pkg/detectors/squareup/squareup.go @@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://connect.squareup.com/oauth2/authorize?client_id=%s&scope=CUSTOMERS_WRITE+CUSTOMERS_READ&session=False&state=82201dd8d83d23cc8a48caf52b", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://connect.squareup.com/oauth2/authorize?client_id=%s&scope=CUSTOMERS_WRITE+CUSTOMERS_READ&session=False&state=82201dd8d83d23cc8a48caf52b", resMatch), nil) req.Header.Add("Content-Type", "application/json") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/sslmate/sslmate.go b/pkg/detectors/sslmate/sslmate.go index 90879d03..3fe6610e 100644 --- a/pkg/detectors/sslmate/sslmate.go +++ b/pkg/detectors/sslmate/sslmate.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://sslmate.com/api/v2/certs/example.com?expand=current.crt", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://sslmate.com/api/v2/certs/example.com?expand=current.crt", nil) req.Header.Add("Authorization", fmt.Sprintf("Basic %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/stitchdata/stitchdata.go b/pkg/detectors/stitchdata/stitchdata.go index e4352db4..e980025c 100644 --- a/pkg/detectors/stitchdata/stitchdata.go +++ b/pkg/detectors/stitchdata/stitchdata.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.stitchdata.com/v4/sources", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.stitchdata.com/v4/sources", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) req.Header.Add("Content-Type", "application/json") res, err := client.Do(req) diff --git a/pkg/detectors/stockdata/stockdata.go b/pkg/detectors/stockdata/stockdata.go index 7c79101e..0d5ea225 100644 --- a/pkg/detectors/stockdata/stockdata.go +++ b/pkg/detectors/stockdata/stockdata.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.stockdata.org/v1/data/quote?symbols=AAPL,TSLA,MSFT&api_token="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.stockdata.org/v1/data/quote?symbols=AAPL,TSLA,MSFT&api_token="+resMatch, nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/storecove/storecove.go b/pkg/detectors/storecove/storecove.go index 4c9a2b83..f45e17b1 100644 --- a/pkg/detectors/storecove/storecove.go +++ b/pkg/detectors/storecove/storecove.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.storecove.com/api/v2/discovery/identifiers", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.storecove.com/api/v2/discovery/identifiers", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/stormglass/stormglass.go b/pkg/detectors/stormglass/stormglass.go index acb734de..5da4ed9c 100644 --- a/pkg/detectors/stormglass/stormglass.go +++ b/pkg/detectors/stormglass/stormglass.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.stormglass.io/v2/weather/point?lat=58.7984&lng=17.8081¶ms=windSpeed", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.stormglass.io/v2/weather/point?lat=58.7984&lng=17.8081¶ms=windSpeed", nil) req.Header.Add("Authorization", fmt.Sprintf("%s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/storyblok/storyblok.go b/pkg/detectors/storyblok/storyblok.go index 1cdf69a0..29c4a997 100644 --- a/pkg/detectors/storyblok/storyblok.go +++ b/pkg/detectors/storyblok/storyblok.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.storyblok.com/v1/cdn/spaces/me/?token="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.storyblok.com/v1/cdn/spaces/me/?token="+resMatch, nil) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/storychief/storychief.go b/pkg/detectors/storychief/storychief.go index da62e2e4..f57e33cf 100644 --- a/pkg/detectors/storychief/storychief.go +++ b/pkg/detectors/storychief/storychief.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.storychief.io/1.0/users?page=1&count=10", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.storychief.io/1.0/users?page=1&count=10", nil) req.Header.Add("Accept", "application/json") req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/strava/strava.go b/pkg/detectors/strava/strava.go index b8286e58..126f0410 100644 --- a/pkg/detectors/strava/strava.go +++ b/pkg/detectors/strava/strava.go @@ -68,7 +68,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { payload := strings.NewReader("grant_type=refresh_token&client_id=" + resId + "&client_secret=" + resSecret + "&refresh_token=" + resKey) - req, _ := http.NewRequest("POST", "https://www.strava.com/oauth/token", payload) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://www.strava.com/oauth/token", payload) req.Header.Add("Content-Type", "application/x-www-form-urlencoded") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/streak/streak.go b/pkg/detectors/streak/streak.go index 910a8160..2045bd64 100644 --- a/pkg/detectors/streak/streak.go +++ b/pkg/detectors/streak/streak.go @@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { data := fmt.Sprintf("%s:", resMatch) sEnc := b64.StdEncoding.EncodeToString([]byte(data)) - req, _ := http.NewRequest("GET", "https://www.streak.com/api/v1/pipelines", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://www.streak.com/api/v1/pipelines", nil) req.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/stytch/stytch.go b/pkg/detectors/stytch/stytch.go index 287785de..f6fd5e8c 100644 --- a/pkg/detectors/stytch/stytch.go +++ b/pkg/detectors/stytch/stytch.go @@ -60,7 +60,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { fmt.Println(userPatMatch) fmt.Println(tokenPatMatch) - req, _ := http.NewRequest("GET", "https://api.stytch.com/v1/users/pending", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.stytch.com/v1/users/pending", nil) req.SetBasicAuth(userPatMatch, tokenPatMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/sumologickey/sumologickey.go b/pkg/detectors/sumologickey/sumologickey.go index a787531d..0483e750 100644 --- a/pkg/detectors/sumologickey/sumologickey.go +++ b/pkg/detectors/sumologickey/sumologickey.go @@ -59,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { data := fmt.Sprintf("%s:%s", resIdMatch, resMatch) encoded := b64.StdEncoding.EncodeToString([]byte(data)) - req, _ := http.NewRequest("GET", "https://api.us2.sumologic.com/api/v1/users", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.us2.sumologic.com/api/v1/users", nil) req.Header.Add("Authorization", fmt.Sprintf("Basic %s", encoded)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/surveyanyplace/surveyanyplace.go b/pkg/detectors/surveyanyplace/surveyanyplace.go index 1f8f758d..8806eeb6 100644 --- a/pkg/detectors/surveyanyplace/surveyanyplace.go +++ b/pkg/detectors/surveyanyplace/surveyanyplace.go @@ -65,7 +65,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result "code2" ] }`) - req, _ := http.NewRequest("POST", "https://api.surveyanyplace.com/v1/surveys/"+resIdMatch+"/accesscodes", payload) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://api.surveyanyplace.com/v1/surveys/"+resIdMatch+"/accesscodes", payload) req.Header.Add("Authorization", fmt.Sprintf("API %s", resMatch)) req.Header.Add("Content-Type", "application/json") res, err := client.Do(req) diff --git a/pkg/detectors/surveybot/surveybot.go b/pkg/detectors/surveybot/surveybot.go index e5a91b9d..2ded29fb 100644 --- a/pkg/detectors/surveybot/surveybot.go +++ b/pkg/detectors/surveybot/surveybot.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://app.surveybot.io/api/v1/surveys?page=1&per_page=20&offset=0", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://app.surveybot.io/api/v1/surveys?page=1&per_page=20&offset=0", nil) req.Header.Add("Accept", "application/json") req.Header.Add("X-Api-Key", resMatch) res, err := client.Do(req) diff --git a/pkg/detectors/surveysparrow/surveysparrow.go b/pkg/detectors/surveysparrow/surveysparrow.go index 77da0b4c..199da744 100644 --- a/pkg/detectors/surveysparrow/surveysparrow.go +++ b/pkg/detectors/surveysparrow/surveysparrow.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.surveysparrow.com/v1/contacts", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.surveysparrow.com/v1/contacts", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/survicate/survicate.go b/pkg/detectors/survicate/survicate.go index 36776630..e186ed8b 100644 --- a/pkg/detectors/survicate/survicate.go +++ b/pkg/detectors/survicate/survicate.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://data-api.survicate.com/v1/surveys", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://data-api.survicate.com/v1/surveys", nil) req.Header.Add("Authorization", fmt.Sprintf("Basic %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/swell/swell.go b/pkg/detectors/swell/swell.go index ce2f8b3c..4c9cba2f 100644 --- a/pkg/detectors/swell/swell.go +++ b/pkg/detectors/swell/swell.go @@ -58,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result Raw: []byte(tokenPatMatch), } if verify { - req, _ := http.NewRequest("GET", "https://api.swell.store/products?limit=100", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.swell.store/products?limit=100", nil) req.SetBasicAuth(userPatMatch, tokenPatMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/swiftype/swiftype.go b/pkg/detectors/swiftype/swiftype.go index 2a7fc5ce..789d6008 100644 --- a/pkg/detectors/swiftype/swiftype.go +++ b/pkg/detectors/swiftype/swiftype.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { payload := strings.NewReader(`{"auth_token":"` + resMatch + `","q": "gatsby"}`) - req, _ := http.NewRequest("GET", "https://search-api.swiftype.com/api/v1/engines/bookstore/document_types/books/search.json", payload) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://search-api.swiftype.com/api/v1/engines/bookstore/document_types/books/search.json", payload) req.Header.Add("Content-Type", "application/json") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/tatumio/tatumio.go b/pkg/detectors/tatumio/tatumio.go index 38fad0c4..48262443 100644 --- a/pkg/detectors/tatumio/tatumio.go +++ b/pkg/detectors/tatumio/tatumio.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api-eu1.tatum.io/v3/ledger/account?pageSize=10&offset=0&accountCode=AC_1011_B", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api-eu1.tatum.io/v3/ledger/account?pageSize=10&offset=0&accountCode=AC_1011_B", nil) req.Header.Add("Accept", "application/vnd.tatumio+json; version=3") req.Header.Add("x-api-key", fmt.Sprintf("%s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/taxjar/taxjar.go b/pkg/detectors/taxjar/taxjar.go index e5311bb6..abc5d85d 100644 --- a/pkg/detectors/taxjar/taxjar.go +++ b/pkg/detectors/taxjar/taxjar.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.taxjar.com/v2/categories", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.taxjar.com/v2/categories", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/teamgate/teamgate.go b/pkg/detectors/teamgate/teamgate.go index 6c0eeca8..bf31e969 100644 --- a/pkg/detectors/teamgate/teamgate.go +++ b/pkg/detectors/teamgate/teamgate.go @@ -57,7 +57,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result Raw: []byte(resMatch), } if verify { - req, _ := http.NewRequest("GET", "https://api.teamgate.com/v4/users", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.teamgate.com/v4/users", nil) req.Header.Add("X-Auth-Token", resMatch) req.Header.Add("X-App-Key", resKeyMatch) diff --git a/pkg/detectors/technicalanalysisapi/technicalanalysisapi.go b/pkg/detectors/technicalanalysisapi/technicalanalysisapi.go index 87f003c1..3c47cc47 100644 --- a/pkg/detectors/technicalanalysisapi/technicalanalysisapi.go +++ b/pkg/detectors/technicalanalysisapi/technicalanalysisapi.go @@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { timeout := 10 * time.Second client.Timeout = timeout - req, _ := http.NewRequest("GET", fmt.Sprintf("https://technical-analysis-api.com/api/v1/analysis/BTC?apiKey=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://technical-analysis-api.com/api/v1/analysis/BTC?apiKey=%s", resMatch), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/telegrambottoken/telegrambottoken.go b/pkg/detectors/telegrambottoken/telegrambottoken.go index 0ac2f0e2..a98d7325 100644 --- a/pkg/detectors/telegrambottoken/telegrambottoken.go +++ b/pkg/detectors/telegrambottoken/telegrambottoken.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { // https://core.telegram.org/bots/api#getme - req, _ := http.NewRequest("GET", "https://api.telegram.org/bot"+key+"/getMe", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.telegram.org/bot"+key+"/getMe", nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/telnyx/telnyx.go b/pkg/detectors/telnyx/telnyx.go index acdc0350..0df411c5 100644 --- a/pkg/detectors/telnyx/telnyx.go +++ b/pkg/detectors/telnyx/telnyx.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.telnyx.com/v2/messaging_profiles", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.telnyx.com/v2/messaging_profiles", nil) req.Header.Add("Accept", "application/vnd.telnyx+json; version=3") req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/terraformcloudpersonaltoken/terraformcloudpersonaltoken.go b/pkg/detectors/terraformcloudpersonaltoken/terraformcloudpersonaltoken.go index d403b8b9..682a5bbc 100644 --- a/pkg/detectors/terraformcloudpersonaltoken/terraformcloudpersonaltoken.go +++ b/pkg/detectors/terraformcloudpersonaltoken/terraformcloudpersonaltoken.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://app.terraform.io/api/v2/account/details", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://app.terraform.io/api/v2/account/details", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/text2data/text2data.go b/pkg/detectors/text2data/text2data.go index 5115559b..267dd893 100644 --- a/pkg/detectors/text2data/text2data.go +++ b/pkg/detectors/text2data/text2data.go @@ -58,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result data.Add("DocumentText", "Excellent location, opposite a very large mall with wide variety of shops, restaurants and more.") data.Add("PrivateKey", resMatch) - req, _ := http.NewRequest("POST", "http://api.text2data.com/v3/analyze", strings.NewReader(data.Encode())) + req, _ := http.NewRequestWithContext(ctx, "POST", "http://api.text2data.com/v3/analyze", strings.NewReader(data.Encode())) req.Header.Add("Accept", "application/json") req.Header.Add("Content-Type", "application/x-www-form-urlencoded") res, err := client.Do(req) diff --git a/pkg/detectors/textmagic/textmagic.go b/pkg/detectors/textmagic/textmagic.go index 84c114fb..5c6f6d18 100644 --- a/pkg/detectors/textmagic/textmagic.go +++ b/pkg/detectors/textmagic/textmagic.go @@ -62,7 +62,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { data := fmt.Sprintf("%s:%s", resUser, resMatch) sEnc := b64.StdEncoding.EncodeToString([]byte(data)) - req, _ := http.NewRequest("GET", "https://rest.textmagic.com/api/v2/user", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://rest.textmagic.com/api/v2/user", nil) req.Header.Add("Content-Type", "application/json") req.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc)) res, err := client.Do(req) diff --git a/pkg/detectors/thinkific/thinkific.go b/pkg/detectors/thinkific/thinkific.go index a4be2f3f..0066401e 100644 --- a/pkg/detectors/thinkific/thinkific.go +++ b/pkg/detectors/thinkific/thinkific.go @@ -60,7 +60,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { domainRes := fmt.Sprintf("%s-s-school", resDomainMatch) - req, _ := http.NewRequest("GET", "https://api.thinkific.com/api/public/v1/users", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.thinkific.com/api/public/v1/users", nil) req.Header.Add("X-Auth-API-Key", resMatch) req.Header.Add("X-Auth-Subdomain", domainRes) req.Header.Add("Content-Type", "application/json") diff --git a/pkg/detectors/thousandeyes/thousandeyes.go b/pkg/detectors/thousandeyes/thousandeyes.go index d33886ce..69ef9bc5 100644 --- a/pkg/detectors/thousandeyes/thousandeyes.go +++ b/pkg/detectors/thousandeyes/thousandeyes.go @@ -59,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.thousandeyes.com/v6/endpoint-data/user-sessions/web.json", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.thousandeyes.com/v6/endpoint-data/user-sessions/web.json", nil) req.SetBasicAuth(userPatMatch, tokenPatMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/ticketmaster/ticketmaster.go b/pkg/detectors/ticketmaster/ticketmaster.go index b5dda001..f8f12231 100644 --- a/pkg/detectors/ticketmaster/ticketmaster.go +++ b/pkg/detectors/ticketmaster/ticketmaster.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://app.ticketmaster.com/discovery/v2/events.json?apikey=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://app.ticketmaster.com/discovery/v2/events.json?apikey=%s", resMatch), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/tiingo/tiingo.go b/pkg/detectors/tiingo/tiingo.go index 20e8af23..64cd43ce 100644 --- a/pkg/detectors/tiingo/tiingo.go +++ b/pkg/detectors/tiingo/tiingo.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.tiingo.com/tiingo/fundamentals/definitions", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.tiingo.com/tiingo/fundamentals/definitions", nil) req.Header.Add("Content-Type", "application/json") req.Header.Add("Authorization", fmt.Sprintf("Token %s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/timezoneapi/timezoneapi.go b/pkg/detectors/timezoneapi/timezoneapi.go index 8d8e765c..97a6c51d 100644 --- a/pkg/detectors/timezoneapi/timezoneapi.go +++ b/pkg/detectors/timezoneapi/timezoneapi.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://timezoneapi.io/api/ip/?token="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://timezoneapi.io/api/ip/?token="+resMatch, nil) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/tly/tly.go b/pkg/detectors/tly/tly.go index 2c86f909..b4e4bc5e 100644 --- a/pkg/detectors/tly/tly.go +++ b/pkg/detectors/tly/tly.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://t.ly/api/v1/link/stats?api_token="+resMatch+"&short_url=https://t.ly/h9YS", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://t.ly/api/v1/link/stats?api_token="+resMatch+"&short_url=https://t.ly/h9YS", nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/tmetric/tmetric.go b/pkg/detectors/tmetric/tmetric.go index ebedf997..d0b5b204 100644 --- a/pkg/detectors/tmetric/tmetric.go +++ b/pkg/detectors/tmetric/tmetric.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://app.tmetric.com/api/v3/user", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://app.tmetric.com/api/v3/user", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/todoist/todoist.go b/pkg/detectors/todoist/todoist.go index 2ae2b086..5150e1e0 100644 --- a/pkg/detectors/todoist/todoist.go +++ b/pkg/detectors/todoist/todoist.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.todoist.com/rest/v1/projects", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.todoist.com/rest/v1/projects", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/toggltrack/toggltrack.go b/pkg/detectors/toggltrack/toggltrack.go index 82609c14..157615dd 100644 --- a/pkg/detectors/toggltrack/toggltrack.go +++ b/pkg/detectors/toggltrack/toggltrack.go @@ -55,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result data := fmt.Sprintf("%s:api_token", resMatch) sEnc := b64.StdEncoding.EncodeToString([]byte(data)) - req, _ := http.NewRequest("GET", "https://api.track.toggl.com/api/v8/me", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.track.toggl.com/api/v8/me", nil) req.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/tomorrowio/tomorrowio.go b/pkg/detectors/tomorrowio/tomorrowio.go index 31a279a8..61a727a5 100644 --- a/pkg/detectors/tomorrowio/tomorrowio.go +++ b/pkg/detectors/tomorrowio/tomorrowio.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://api.tomorrow.io/v4/alerts?apikey=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://api.tomorrow.io/v4/alerts?apikey=%s", resMatch), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/tomtom/tomtom.go b/pkg/detectors/tomtom/tomtom.go index aa5c9c38..ca9d2c3d 100644 --- a/pkg/detectors/tomtom/tomtom.go +++ b/pkg/detectors/tomtom/tomtom.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.tomtom.com/map/1/tile/basic/main/0/0/0.png?view=Unified&key="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.tomtom.com/map/1/tile/basic/main/0/0/0.png?view=Unified&key="+resMatch, nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/tradier/tradier.go b/pkg/detectors/tradier/tradier.go index 081ddc64..18aa09f0 100644 --- a/pkg/detectors/tradier/tradier.go +++ b/pkg/detectors/tradier/tradier.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.tradier.com/v1/watchlists", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.tradier.com/v1/watchlists", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/travelpayouts/travelpayouts.go b/pkg/detectors/travelpayouts/travelpayouts.go index ebb35b58..1e32357e 100644 --- a/pkg/detectors/travelpayouts/travelpayouts.go +++ b/pkg/detectors/travelpayouts/travelpayouts.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("http://api.travelpayouts.com/v2/prices/latest?currency=usd&limit=5&token=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("http://api.travelpayouts.com/v2/prices/latest?currency=usd&limit=5&token=%s", resMatch), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/travisci/travisci.go b/pkg/detectors/travisci/travisci.go index afea9bbf..271c9779 100644 --- a/pkg/detectors/travisci/travisci.go +++ b/pkg/detectors/travisci/travisci.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.travis-ci.com/user", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.travis-ci.com/user", nil) req.Header.Add("Authorization", fmt.Sprintf("token %s", resMatch)) req.Header.Add("User-Agent", "API Explorer") req.Header.Add("Travis-API-Version", "3") diff --git a/pkg/detectors/trelloapikey/trelloapikey.go b/pkg/detectors/trelloapikey/trelloapikey.go index b3966361..0c728f63 100644 --- a/pkg/detectors/trelloapikey/trelloapikey.go +++ b/pkg/detectors/trelloapikey/trelloapikey.go @@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.trello.com/1/members/me?key="+resMatch+"&token="+token, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.trello.com/1/members/me?key="+resMatch+"&token="+token, nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/tru/tru.go b/pkg/detectors/tru/tru.go index f6195e10..0fba63de 100644 --- a/pkg/detectors/tru/tru.go +++ b/pkg/detectors/tru/tru.go @@ -62,7 +62,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result data := fmt.Sprintf("%s:%s", resMatch, resSecret) baseToken := b64.StdEncoding.EncodeToString([]byte(data)) payload := strings.NewReader("grant_type=client_credentials") - req, _ := http.NewRequest("POST", "https://eu.api.tru.id/oauth2/v1/token", payload) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://eu.api.tru.id/oauth2/v1/token", payload) req.Header.Add("Content-Type", "application/x-www-form-urlencoded") req.Header.Add("Authorization", fmt.Sprintf("Basic %s", baseToken)) res, err := client.Do(req) diff --git a/pkg/detectors/twelvedata/twelvedata.go b/pkg/detectors/twelvedata/twelvedata.go index c268d46e..882174ab 100644 --- a/pkg/detectors/twelvedata/twelvedata.go +++ b/pkg/detectors/twelvedata/twelvedata.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.twelvedata.com/earliest_timestamp?symbol=AAPL&interval=1day&apikey="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.twelvedata.com/earliest_timestamp?symbol=AAPL&interval=1day&apikey="+resMatch, nil) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/tyntec/tyntec.go b/pkg/detectors/tyntec/tyntec.go index c8418287..acf81486 100644 --- a/pkg/detectors/tyntec/tyntec.go +++ b/pkg/detectors/tyntec/tyntec.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.tyntec.com/2fa/v1/application", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.tyntec.com/2fa/v1/application", nil) req.Header.Add("apiKey", resMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/typeform/typeform.go b/pkg/detectors/typeform/typeform.go index f36e9984..47c912e2 100644 --- a/pkg/detectors/typeform/typeform.go +++ b/pkg/detectors/typeform/typeform.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.typeform.com/me", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.typeform.com/me", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/ubidots/ubidots.go b/pkg/detectors/ubidots/ubidots.go index 963f9aa1..a2b9405b 100644 --- a/pkg/detectors/ubidots/ubidots.go +++ b/pkg/detectors/ubidots/ubidots.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://industrial.api.ubidots.com/api/v1.6/variables/", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://industrial.api.ubidots.com/api/v1.6/variables/", nil) req.Header.Add("Content-Type", "application/json") req.Header.Add("X-Auth-Token", resMatch) res, err := client.Do(req) diff --git a/pkg/detectors/unifyid/unifyid.go b/pkg/detectors/unifyid/unifyid.go index b6c713ac..f9130b30 100644 --- a/pkg/detectors/unifyid/unifyid.go +++ b/pkg/detectors/unifyid/unifyid.go @@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { payload := strings.NewReader(`{"token": "sample"}`) - req, _ := http.NewRequest("POST", "https://api.unify.id/v1/humandetect/verify", payload) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://api.unify.id/v1/humandetect/verify", payload) req.Header.Add("Content-Type", "application/json") req.Header.Add("X-API-Key", resMatch) res, err := client.Do(req) diff --git a/pkg/detectors/unplugg/unplugg.go b/pkg/detectors/unplugg/unplugg.go index e3b41041..d8bbc4ce 100644 --- a/pkg/detectors/unplugg/unplugg.go +++ b/pkg/detectors/unplugg/unplugg.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { payload := strings.NewReader(`{"data":[{"timestamp":1466640000,"value":0.27589941523037853},{"timestamp":1466640900,"value":0.4059699097648263}],"forecast_to":1458136800,"callback":"http://yourdomain.com/samplecallback"}`) - req, _ := http.NewRequest("POST", "https://api.unplu.gg/forecast", payload) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://api.unplu.gg/forecast", payload) req.Header.Add("Content-Type", "application/json") req.Header.Add("x-access-token", resMatch) res, err := client.Do(req) diff --git a/pkg/detectors/unsplash/unsplash.go b/pkg/detectors/unsplash/unsplash.go index 34eb67bc..26a51bc6 100644 --- a/pkg/detectors/unsplash/unsplash.go +++ b/pkg/detectors/unsplash/unsplash.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.unsplash.com/photos/?client_id="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.unsplash.com/photos/?client_id="+resMatch, nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/upcdatabase/upcdatabase.go b/pkg/detectors/upcdatabase/upcdatabase.go index 73042e33..3325bad6 100644 --- a/pkg/detectors/upcdatabase/upcdatabase.go +++ b/pkg/detectors/upcdatabase/upcdatabase.go @@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://api.upcdatabase.org/product/0111222333446?apikey=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://api.upcdatabase.org/product/0111222333446?apikey=%s", resMatch), nil) res, err := client.Do(req) if err == nil { bodyBytes, err := ioutil.ReadAll(res.Body) diff --git a/pkg/detectors/uplead/uplead.go b/pkg/detectors/uplead/uplead.go index 5fe4b5ea..913a8865 100644 --- a/pkg/detectors/uplead/uplead.go +++ b/pkg/detectors/uplead/uplead.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.uplead.com/v2/credits", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.uplead.com/v2/credits", nil) req.Header.Add("Authorization", resMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/upwave/upwave.go b/pkg/detectors/upwave/upwave.go index 431ca075..33aec425 100644 --- a/pkg/detectors/upwave/upwave.go +++ b/pkg/detectors/upwave/upwave.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.upwave.io/workspaces/", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.upwave.io/workspaces/", nil) req.Header.Add("Content-Type", "application/json") req.Header.Add("Authorization", fmt.Sprintf("Token %s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/urlscan/urlscan.go b/pkg/detectors/urlscan/urlscan.go index 2b7e4026..b75edc8c 100644 --- a/pkg/detectors/urlscan/urlscan.go +++ b/pkg/detectors/urlscan/urlscan.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://urlscan.io/user/quotas", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://urlscan.io/user/quotas", nil) req.Header.Add("API-Key", resMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/user/user.go b/pkg/detectors/user/user.go index 2a199b74..eaf2fa50 100644 --- a/pkg/detectors/user/user.go +++ b/pkg/detectors/user/user.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://secretscanner.user.com/api/public/users/", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://secretscanner.user.com/api/public/users/", nil) req.Header.Add("Authorization", fmt.Sprintf("Token %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/userstack/userstack.go b/pkg/detectors/userstack/userstack.go index fe555e6b..81209cee 100644 --- a/pkg/detectors/userstack/userstack.go +++ b/pkg/detectors/userstack/userstack.go @@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("http://api.userstack.com/detect?access_key=%s&ua=Mozilla/5.0", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("http://api.userstack.com/detect?access_key=%s&ua=Mozilla/5.0", resMatch), nil) res, err := client.Do(req) if err == nil { bodyBytes, err := ioutil.ReadAll(res.Body) diff --git a/pkg/detectors/vatlayer/vatlayer.go b/pkg/detectors/vatlayer/vatlayer.go index cd3e1f31..eb81d08a 100644 --- a/pkg/detectors/vatlayer/vatlayer.go +++ b/pkg/detectors/vatlayer/vatlayer.go @@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("http://www.apilayer.net/api/validate?access_key=%s&vat_number=LU26375245&format=1", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("http://www.apilayer.net/api/validate?access_key=%s&vat_number=LU26375245&format=1", resMatch), nil) res, err := client.Do(req) if err == nil { bodyBytes, err := ioutil.ReadAll(res.Body) diff --git a/pkg/detectors/vercel/vercel.go b/pkg/detectors/vercel/vercel.go index 0182412f..792d5e38 100644 --- a/pkg/detectors/vercel/vercel.go +++ b/pkg/detectors/vercel/vercel.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.vercel.com/www/user", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.vercel.com/www/user", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/verifier/verifier.go b/pkg/detectors/verifier/verifier.go index f0ef5412..8cc1f550 100644 --- a/pkg/detectors/verifier/verifier.go +++ b/pkg/detectors/verifier/verifier.go @@ -59,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result Raw: []byte(resMatch), } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://verifier.meetchopra.com/verify/%s?token=%s", userPatMatch, resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://verifier.meetchopra.com/verify/%s?token=%s", userPatMatch, resMatch), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/verimail/verimail.go b/pkg/detectors/verimail/verimail.go index 31ccad04..1e1061f8 100644 --- a/pkg/detectors/verimail/verimail.go +++ b/pkg/detectors/verimail/verimail.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.verimail.io/v3/verify?key="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.verimail.io/v3/verify?key="+resMatch, nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/veriphone/veriphone.go b/pkg/detectors/veriphone/veriphone.go index 47b46af6..23ae6b24 100644 --- a/pkg/detectors/veriphone/veriphone.go +++ b/pkg/detectors/veriphone/veriphone.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.veriphone.io/v2/verify?phone=%252B49-15123577723&key="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.veriphone.io/v2/verify?phone=%252B49-15123577723&key="+resMatch, nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/versioneye/versioneye.go b/pkg/detectors/versioneye/versioneye.go index eeae54bb..ae9a5dc0 100644 --- a/pkg/detectors/versioneye/versioneye.go +++ b/pkg/detectors/versioneye/versioneye.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://www.versioneye.com/api/v1/scans", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://www.versioneye.com/api/v1/scans", nil) req.Header.Add("apiKey", resMatch) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/viewneo/viewneo.go b/pkg/detectors/viewneo/viewneo.go index 55e5f08a..c7a8a9d3 100644 --- a/pkg/detectors/viewneo/viewneo.go +++ b/pkg/detectors/viewneo/viewneo.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://cloud.viewneo.com/api/v1.0/playlist", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://cloud.viewneo.com/api/v1.0/playlist", nil) req.Header.Add("Accept", "application/json") req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/virustotal/virustotal.go b/pkg/detectors/virustotal/virustotal.go index 4bf987dd..92bda269 100644 --- a/pkg/detectors/virustotal/virustotal.go +++ b/pkg/detectors/virustotal/virustotal.go @@ -64,7 +64,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result continue } writer.Close() - req, _ := http.NewRequest("POST", "https://www.virustotal.com/api/v3/urls", bytes.NewReader(body.Bytes())) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://www.virustotal.com/api/v3/urls", bytes.NewReader(body.Bytes())) req.Header.Add("Content-Type", writer.FormDataContentType()) req.Header.Add("x-apikey", resMatch) res, err := client.Do(req) diff --git a/pkg/detectors/visualcrossing/visualcrossing.go b/pkg/detectors/visualcrossing/visualcrossing.go index d2608515..31d0ebf2 100644 --- a/pkg/detectors/visualcrossing/visualcrossing.go +++ b/pkg/detectors/visualcrossing/visualcrossing.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/timeline/LA?key=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/timeline/LA?key=%s", resMatch), nil) req.Header.Add("Content-Type", "application/json") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/voicegain/voicegain.go b/pkg/detectors/voicegain/voicegain.go index 6a8154a7..81b49177 100644 --- a/pkg/detectors/voicegain/voicegain.go +++ b/pkg/detectors/voicegain/voicegain.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.voicegain.ai/v1/sa/config", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.voicegain.ai/v1/sa/config", nil) req.Header.Add("Content-Type", "application/json") req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/vouchery/vouchery.go b/pkg/detectors/vouchery/vouchery.go index 8dab083d..65fa318d 100644 --- a/pkg/detectors/vouchery/vouchery.go +++ b/pkg/detectors/vouchery/vouchery.go @@ -60,7 +60,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://%s.vouchery.io/api/v2.0/users", subMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://%s.vouchery.io/api/v2.0/users", subMatch), nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/vpnapi/vpnapi.go b/pkg/detectors/vpnapi/vpnapi.go index 9c8a8499..b07e5790 100644 --- a/pkg/detectors/vpnapi/vpnapi.go +++ b/pkg/detectors/vpnapi/vpnapi.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://vpnapi.io/api/8.8.8.8?key="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://vpnapi.io/api/8.8.8.8?key="+resMatch, nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/vultrapikey/vultrapikey.go b/pkg/detectors/vultrapikey/vultrapikey.go index f0c96643..9822eaf5 100644 --- a/pkg/detectors/vultrapikey/vultrapikey.go +++ b/pkg/detectors/vultrapikey/vultrapikey.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.vultr.com/v2/account", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.vultr.com/v2/account", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/vyte/vyte.go b/pkg/detectors/vyte/vyte.go index a7e112dc..895593ae 100644 --- a/pkg/detectors/vyte/vyte.go +++ b/pkg/detectors/vyte/vyte.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.vyte.in/v2/events", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.vyte.in/v2/events", nil) req.Header.Add("Accept", "application/vnd.vyte+json; version=3") req.Header.Add("Authorization", resMatch) res, err := client.Do(req) diff --git a/pkg/detectors/walkscore/walkscore.go b/pkg/detectors/walkscore/walkscore.go index ac67ae6e..19c4418e 100644 --- a/pkg/detectors/walkscore/walkscore.go +++ b/pkg/detectors/walkscore/walkscore.go @@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://transit.walkscore.com/transit/search/stops/?lat=47.6101359&lon=-122.3420567&wsapikey=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://transit.walkscore.com/transit/search/stops/?lat=47.6101359&lon=-122.3420567&wsapikey=%s", resMatch), nil) req.Header.Add("Content-Type", "application/json") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/weatherbit/weatherbit.go b/pkg/detectors/weatherbit/weatherbit.go index 04ea94f5..12839217 100644 --- a/pkg/detectors/weatherbit/weatherbit.go +++ b/pkg/detectors/weatherbit/weatherbit.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://api.weatherbit.io/v2.0/history/airquality?lat=38.0&lon=-78.0&key=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://api.weatherbit.io/v2.0/history/airquality?lat=38.0&lon=-78.0&key=%s", resMatch), nil) req.Header.Add("Content-Type", "application/json") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/weatherstack/weatherstack.go b/pkg/detectors/weatherstack/weatherstack.go index 8b78b567..96a40a6c 100644 --- a/pkg/detectors/weatherstack/weatherstack.go +++ b/pkg/detectors/weatherstack/weatherstack.go @@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("http://api.weatherstack.com/current?access_key=%s&query=LA", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("http://api.weatherstack.com/current?access_key=%s&query=LA", resMatch), nil) req.Header.Add("Content-Type", "application/json") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/webex/webex.go b/pkg/detectors/webex/webex.go index a9f90e3d..21b49c8f 100644 --- a/pkg/detectors/webex/webex.go +++ b/pkg/detectors/webex/webex.go @@ -60,7 +60,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { payload := strings.NewReader("grant_type=authorization_code&code=362ad374-735c-4f69-aa8e-bf384f8602de&client_id=" + id + "&client_secret=" + resMatch + "&redirect_uri=http%3A%2F%2Flocalhost.com%2Fb") - req, _ := http.NewRequest("POST", "https://webexapis.com/v1/access_token", payload) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://webexapis.com/v1/access_token", payload) req.Header.Add("Content-Type", "application/x-www-form-urlencoded") res, err := client.Do(req) if err != nil { diff --git a/pkg/detectors/webflow/webflow.go b/pkg/detectors/webflow/webflow.go index 5c8d7c10..0ee216ed 100644 --- a/pkg/detectors/webflow/webflow.go +++ b/pkg/detectors/webflow/webflow.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.webflow.com/info", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.webflow.com/info", nil) req.Header.Add("accept-version", "1.0.0") req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/webscraper/webscraper.go b/pkg/detectors/webscraper/webscraper.go index ee285da5..480b3b12 100644 --- a/pkg/detectors/webscraper/webscraper.go +++ b/pkg/detectors/webscraper/webscraper.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://api.webscraper.io/api/v1/sitemaps?api_token=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://api.webscraper.io/api/v1/sitemaps?api_token=%s", resMatch), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/webscraping/webscraping.go b/pkg/detectors/webscraping/webscraping.go index ea30626c..baae364d 100644 --- a/pkg/detectors/webscraping/webscraping.go +++ b/pkg/detectors/webscraping/webscraping.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.webscrapingapi.com/v1?api_key="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.webscrapingapi.com/v1?api_key="+resMatch, nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/wepay/wepay.go b/pkg/detectors/wepay/wepay.go index 12e8de8e..e281aed2 100644 --- a/pkg/detectors/wepay/wepay.go +++ b/pkg/detectors/wepay/wepay.go @@ -61,7 +61,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://stage-api.wepay.com/payments?type=credit_card&credit_card=4003830171874018", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://stage-api.wepay.com/payments?type=credit_card&credit_card=4003830171874018", nil) req.Header.Add("App-Token", resMatch) req.Header.Add("App-Id", resAppIDMatch) req.Header.Add("Api-Version", "3.0") diff --git a/pkg/detectors/whoxy/whoxy.go b/pkg/detectors/whoxy/whoxy.go index c184baea..935d2b00 100644 --- a/pkg/detectors/whoxy/whoxy.go +++ b/pkg/detectors/whoxy/whoxy.go @@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("http://api.whoxy.com/?key=%s&account=balance", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("http://api.whoxy.com/?key=%s&account=balance", resMatch), nil) req.Header.Add("Content-Type", "application/json") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/worksnaps/worksnaps.go b/pkg/detectors/worksnaps/worksnaps.go index 356051fd..5c8317f9 100644 --- a/pkg/detectors/worksnaps/worksnaps.go +++ b/pkg/detectors/worksnaps/worksnaps.go @@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { data := fmt.Sprintf("%s:ignored", resMatch) sEnc := b64.StdEncoding.EncodeToString([]byte(data)) - req, _ := http.NewRequest("GET", "https://api.worksnaps.com/api/projects.xml", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.worksnaps.com/api/projects.xml", nil) req.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/workstack/workstack.go b/pkg/detectors/workstack/workstack.go index 4717c909..bdfaf74a 100644 --- a/pkg/detectors/workstack/workstack.go +++ b/pkg/detectors/workstack/workstack.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://app.workstack.io/api/team?api_token="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://app.workstack.io/api/team?api_token="+resMatch, nil) req.Header.Add("Accept", "application/json") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/worldcoinindex/worldcoinindex.go b/pkg/detectors/worldcoinindex/worldcoinindex.go index 711896ca..559789b6 100644 --- a/pkg/detectors/worldcoinindex/worldcoinindex.go +++ b/pkg/detectors/worldcoinindex/worldcoinindex.go @@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://www.worldcoinindex.com/apiservice/ticker?key=%s&label=ethbtc-ltcbtc&fiat=btc", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://www.worldcoinindex.com/apiservice/ticker?key=%s&label=ethbtc-ltcbtc&fiat=btc", resMatch), nil) res, err := client.Do(req) if err == nil { bodyBytes, err := ioutil.ReadAll(res.Body) diff --git a/pkg/detectors/worldweather/worldweather.go b/pkg/detectors/worldweather/worldweather.go index 80598fe0..ee619b25 100644 --- a/pkg/detectors/worldweather/worldweather.go +++ b/pkg/detectors/worldweather/worldweather.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("http://api.worldweatheronline.com/premium/v1/search.ashx?query=LA&key=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("http://api.worldweatheronline.com/premium/v1/search.ashx?query=LA&key=%s", resMatch), nil) req.Header.Add("Content-Type", "application/json") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/wrike/wrike.go b/pkg/detectors/wrike/wrike.go index 75b85901..629192e6 100644 --- a/pkg/detectors/wrike/wrike.go +++ b/pkg/detectors/wrike/wrike.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://app-us2.wrike.com/api/v4/contacts?me=true", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://app-us2.wrike.com/api/v4/contacts?me=true", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/yandex/yandex.go b/pkg/detectors/yandex/yandex.go index ef7a4e6b..d150fd00 100644 --- a/pkg/detectors/yandex/yandex.go +++ b/pkg/detectors/yandex/yandex.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://dictionary.yandex.net/api/v1/dicservice.json/getLangs?key="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://dictionary.yandex.net/api/v1/dicservice.json/getLangs?key="+resMatch, nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/youneedabudget/youneedabudget.go b/pkg/detectors/youneedabudget/youneedabudget.go index f5688b2c..187e1ce0 100644 --- a/pkg/detectors/youneedabudget/youneedabudget.go +++ b/pkg/detectors/youneedabudget/youneedabudget.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.youneedabudget.com/v1/user", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.youneedabudget.com/v1/user", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/yousign/yousign.go b/pkg/detectors/yousign/yousign.go index 7b79737d..b95ea352 100644 --- a/pkg/detectors/yousign/yousign.go +++ b/pkg/detectors/yousign/yousign.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://staging-api.yousign.com/users", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://staging-api.yousign.com/users", nil) req.Header.Add("Content-Type", "application/json") req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) diff --git a/pkg/detectors/youtubeapikey/youtubeapikey.go b/pkg/detectors/youtubeapikey/youtubeapikey.go index 3f679dfa..b6ec3cbe 100644 --- a/pkg/detectors/youtubeapikey/youtubeapikey.go +++ b/pkg/detectors/youtubeapikey/youtubeapikey.go @@ -59,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://www.googleapis.com/youtube/v3/channelSections?key="+resMatch+"&channelId="+resIdmatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://www.googleapis.com/youtube/v3/channelSections?key="+resMatch+"&channelId="+resIdmatch, nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/zapierwebhook/zapierwebhook.go b/pkg/detectors/zapierwebhook/zapierwebhook.go index f38bb122..5a468d19 100644 --- a/pkg/detectors/zapierwebhook/zapierwebhook.go +++ b/pkg/detectors/zapierwebhook/zapierwebhook.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("POST", "https://hooks.zapier.com/hooks/catch/"+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://hooks.zapier.com/hooks/catch/"+resMatch, nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/zendeskapi/zendeskapi.go b/pkg/detectors/zendeskapi/zendeskapi.go index 47ea3c3a..31d7f8b9 100644 --- a/pkg/detectors/zendeskapi/zendeskapi.go +++ b/pkg/detectors/zendeskapi/zendeskapi.go @@ -74,7 +74,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { data := fmt.Sprintf("%s/token:%s", resEmail, resMatch) sEnc := b64.StdEncoding.EncodeToString([]byte(data)) - req, _ := http.NewRequest("GET", "https://"+resDomain+"/api/v2/users.json", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://"+resDomain+"/api/v2/users.json", nil) req.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/zenscrape/zenscrape.go b/pkg/detectors/zenscrape/zenscrape.go index 41517d2b..34fdf42e 100644 --- a/pkg/detectors/zenscrape/zenscrape.go +++ b/pkg/detectors/zenscrape/zenscrape.go @@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://app.zenscrape.com/api/v1/get", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://app.zenscrape.com/api/v1/get", nil) req.Header.Add("apikey", fmt.Sprintf("%s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/zenserp/zenserp.go b/pkg/detectors/zenserp/zenserp.go index be96df12..2f1102d5 100644 --- a/pkg/detectors/zenserp/zenserp.go +++ b/pkg/detectors/zenserp/zenserp.go @@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://app.zenserp.com/api/v2/search?apikey="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://app.zenserp.com/api/v2/search?apikey="+resMatch, nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/zeplin/zeplin.go b/pkg/detectors/zeplin/zeplin.go index fbd28af0..87487629 100644 --- a/pkg/detectors/zeplin/zeplin.go +++ b/pkg/detectors/zeplin/zeplin.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.zeplin.dev/v1/users/me", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.zeplin.dev/v1/users/me", nil) req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/zerobounce/zerobounce.go b/pkg/detectors/zerobounce/zerobounce.go index 63d6813e..2f262b5f 100644 --- a/pkg/detectors/zerobounce/zerobounce.go +++ b/pkg/detectors/zerobounce/zerobounce.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://api.zerobounce.net/v2/getcredits?api_key="+resMatch, nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://api.zerobounce.net/v2/getcredits?api_key="+resMatch, nil) res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/zipapi/zipapi.go b/pkg/detectors/zipapi/zipapi.go index cbe7bd20..99c31b59 100644 --- a/pkg/detectors/zipapi/zipapi.go +++ b/pkg/detectors/zipapi/zipapi.go @@ -68,7 +68,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { data := fmt.Sprintf("%s:%s", resEmail, resPword) sEnc := b64.StdEncoding.EncodeToString([]byte(data)) - req, _ := http.NewRequest("GET", fmt.Sprintf("https://service.zipapi.us/zipcode/90210/?X-API-KEY=%s", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://service.zipapi.us/zipcode/90210/?X-API-KEY=%s", resMatch), nil) req.Header.Add("Content-Type", "application/json") req.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc)) res, err := client.Do(req) diff --git a/pkg/detectors/zipbooks/zipbooks.go b/pkg/detectors/zipbooks/zipbooks.go index 0cc71eb8..22c5be64 100644 --- a/pkg/detectors/zipbooks/zipbooks.go +++ b/pkg/detectors/zipbooks/zipbooks.go @@ -59,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if verify { payload := strings.NewReader(fmt.Sprintf(`{"email": "%s", "password": "%s"}`, resMatch, resPword)) - req, _ := http.NewRequest("POST", "https://api.zipbooks.com/v2/auth/login", payload) + req, _ := http.NewRequestWithContext(ctx, "POST", "https://api.zipbooks.com/v2/auth/login", payload) req.Header.Add("Content-Type", "application/json") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/zipcodeapi/zipcodeapi.go b/pkg/detectors/zipcodeapi/zipcodeapi.go index b64a2056..8d233b88 100644 --- a/pkg/detectors/zipcodeapi/zipcodeapi.go +++ b/pkg/detectors/zipcodeapi/zipcodeapi.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", fmt.Sprintf("https://www.zipcodeapi.com/rest/%s/distance.json/71601/72959/mile", resMatch), nil) + req, _ := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("https://www.zipcodeapi.com/rest/%s/distance.json/71601/72959/mile", resMatch), nil) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/zonkafeedback/zonkafeedback.go b/pkg/detectors/zonkafeedback/zonkafeedback.go index 5f58c92a..27ea0cd2 100644 --- a/pkg/detectors/zonkafeedback/zonkafeedback.go +++ b/pkg/detectors/zonkafeedback/zonkafeedback.go @@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } if verify { - req, _ := http.NewRequest("GET", "https://app-us1.zonkafeedback.com/responses?page=1&limit=25&startDate=2020-05-02&endDate=2020-05-09", nil) + req, _ := http.NewRequestWithContext(ctx, "GET", "https://app-us1.zonkafeedback.com/responses?page=1&limit=25&startDate=2020-05-02&endDate=2020-05-09", nil) req.Header.Add("Z-API-TOKEN", fmt.Sprintf("%s", resMatch)) res, err := client.Do(req) if err == nil { diff --git a/pkg/engine/engine.go b/pkg/engine/engine.go index 161f3b36..42f04b37 100644 --- a/pkg/engine/engine.go +++ b/pkg/engine/engine.go @@ -147,6 +147,8 @@ func (e *Engine) detectorWorker(ctx context.Context) { if !foundKeyword { continue } + ctx, cancel := context.WithTimeout(ctx, time.Second*10) + defer cancel() results, err := detector.FromData(ctx, verify, decoded.Data) if err != nil { logrus.WithError(err).Error("could not scan chunk")