From 6209a80ce160ac20d1ff744b75f158fe8591d4f3 Mon Sep 17 00:00:00 2001 From: Miccah Date: Tue, 28 Feb 2023 10:00:41 -0600 Subject: [PATCH] [chore] Address more linter errors (#1134) * Address lint errors in detectors * Update deprecated ioutil call --- pkg/detectors/abbysale/abbysale.go | 3 +-- pkg/detectors/bitfinex/bitfinex.go | 2 +- pkg/detectors/brandfetch/brandfetch.go | 3 +-- pkg/detectors/clockify/clockify.go | 3 +-- pkg/detectors/cloudflarecakey/cloudflarecakey.go | 1 - pkg/detectors/everhour/everhour.go | 3 +-- pkg/detectors/fastlypersonaltoken/fastlypersonaltoken.go | 2 +- .../figmapersonalaccesstoken/figmapersonalaccesstoken.go | 3 +-- pkg/detectors/fulcrum/fulcrum.go | 3 +-- pkg/detectors/generic/generic.go | 3 +-- pkg/detectors/impala/impala.go | 3 +-- pkg/detectors/interseller/interseller.go | 5 ----- pkg/detectors/keenio/keenio.go | 3 +-- .../newrelicpersonalapikey/newrelicpersonalapikey.go | 3 +-- pkg/detectors/newscatcher/newscatcher.go | 3 +-- pkg/detectors/nftport/nftport.go | 3 +-- pkg/detectors/omnisend/omnisend.go | 3 +-- pkg/detectors/openuv/openuv.go | 3 +-- pkg/detectors/pepipost/pepipost.go | 3 +-- pkg/detectors/postman/postman.go | 3 +-- pkg/detectors/postmark/postmark.go | 3 +-- pkg/detectors/prospectio/prospectio.go | 3 +-- pkg/detectors/pushbulletapikey/pushbulletapikey.go | 3 +-- pkg/detectors/qubole/qubole.go | 3 +-- pkg/detectors/rapidapi/rapidapi.go | 3 +-- pkg/detectors/rechargepayments/rechargepayments.go | 1 - pkg/detectors/scalewaykey/scalewaykey.go | 3 +-- pkg/detectors/sendinbluev2/sendinbluev2.go | 3 +-- pkg/detectors/shortcut/shortcut.go | 8 -------- pkg/detectors/skrappio/skrappio.go | 3 +-- pkg/detectors/stormglass/stormglass.go | 3 +-- pkg/detectors/tatumio/tatumio.go | 3 +-- pkg/detectors/zonkafeedback/zonkafeedback.go | 3 +-- pkg/sources/git/git.go | 3 +-- 34 files changed, 30 insertions(+), 73 deletions(-) diff --git a/pkg/detectors/abbysale/abbysale.go b/pkg/detectors/abbysale/abbysale.go index a3f0d38e8bc1..f71dfd76bb37 100644 --- a/pkg/detectors/abbysale/abbysale.go +++ b/pkg/detectors/abbysale/abbysale.go @@ -2,7 +2,6 @@ package abbysale import ( "context" - "fmt" "net/http" "regexp" "strings" @@ -52,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if err != nil { continue } - req.Header.Add("x-api-key", fmt.Sprintf("%s", resMatch)) + req.Header.Add("x-api-key", resMatch) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/bitfinex/bitfinex.go b/pkg/detectors/bitfinex/bitfinex.go index ecf6cd3a6008..c53c9f07ee08 100644 --- a/pkg/detectors/bitfinex/bitfinex.go +++ b/pkg/detectors/bitfinex/bitfinex.go @@ -86,7 +86,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result s1.Verified = isValid // If there is a valid one, we need to stop iterating now and return the valid result - if isValid == true { + if isValid { break } } diff --git a/pkg/detectors/brandfetch/brandfetch.go b/pkg/detectors/brandfetch/brandfetch.go index c2e8f219efa4..606e7153c396 100644 --- a/pkg/detectors/brandfetch/brandfetch.go +++ b/pkg/detectors/brandfetch/brandfetch.go @@ -2,7 +2,6 @@ package brandfetch import ( "context" - "fmt" "net/http" "regexp" "strings" @@ -56,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result continue } req.Header.Add("Content-Type", "application/json") - req.Header.Add("x-api-key", fmt.Sprintf("%s", resMatch)) + req.Header.Add("x-api-key", resMatch) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/clockify/clockify.go b/pkg/detectors/clockify/clockify.go index 850cffbb62b9..bb7d21584ce6 100644 --- a/pkg/detectors/clockify/clockify.go +++ b/pkg/detectors/clockify/clockify.go @@ -2,7 +2,6 @@ package clockify import ( "context" - "fmt" "net/http" "regexp" "strings" @@ -53,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result continue } req.Header.Add("content-type", "application/json") - req.Header.Add("X-Api-Key", fmt.Sprintf("%s", resMatch)) + req.Header.Add("X-Api-Key", resMatch) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/cloudflarecakey/cloudflarecakey.go b/pkg/detectors/cloudflarecakey/cloudflarecakey.go index 62963024e565..f2d7783fd289 100644 --- a/pkg/detectors/cloudflarecakey/cloudflarecakey.go +++ b/pkg/detectors/cloudflarecakey/cloudflarecakey.go @@ -66,7 +66,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if res.StatusCode >= 200 && res.StatusCode < 300 { s1.Verified = true } - } else { } } diff --git a/pkg/detectors/everhour/everhour.go b/pkg/detectors/everhour/everhour.go index 7431b520a5f0..8d7876bad77a 100644 --- a/pkg/detectors/everhour/everhour.go +++ b/pkg/detectors/everhour/everhour.go @@ -2,7 +2,6 @@ package everhour import ( "context" - "fmt" "net/http" "regexp" "strings" @@ -53,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result continue } req.Header.Add("Content-Type", "application/json") - req.Header.Add("X-Api-Key", fmt.Sprintf("%s", resMatch)) + req.Header.Add("X-Api-Key", resMatch) 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 68cfd10ac2c4..9a2416a06020 100644 --- a/pkg/detectors/fastlypersonaltoken/fastlypersonaltoken.go +++ b/pkg/detectors/fastlypersonaltoken/fastlypersonaltoken.go @@ -61,7 +61,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if err != nil { continue } - req.Header.Add("Fastly-Key", fmt.Sprintf("%s", resMatch)) + req.Header.Add("Fastly-Key", resMatch) res, err := client.Do(req) if err == nil { bodyBytes, err := io.ReadAll(res.Body) diff --git a/pkg/detectors/figmapersonalaccesstoken/figmapersonalaccesstoken.go b/pkg/detectors/figmapersonalaccesstoken/figmapersonalaccesstoken.go index 0600108f7d0f..ed9a605e0068 100644 --- a/pkg/detectors/figmapersonalaccesstoken/figmapersonalaccesstoken.go +++ b/pkg/detectors/figmapersonalaccesstoken/figmapersonalaccesstoken.go @@ -2,7 +2,6 @@ package figmapersonalaccesstoken import ( "context" - "fmt" "net/http" "regexp" "strings" @@ -51,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if err != nil { continue } - req.Header.Add("X-Figma-Token", fmt.Sprintf("%s", resMatch)) + req.Header.Add("X-Figma-Token", resMatch) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/fulcrum/fulcrum.go b/pkg/detectors/fulcrum/fulcrum.go index 725958a03ccf..eae2e4463052 100644 --- a/pkg/detectors/fulcrum/fulcrum.go +++ b/pkg/detectors/fulcrum/fulcrum.go @@ -2,7 +2,6 @@ package fulcrum import ( "context" - "fmt" "net/http" "regexp" "strings" @@ -53,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result continue } req.Header.Add("Accept", "application/json") - req.Header.Add("X-ApiToken", fmt.Sprintf("%s", resMatch)) + req.Header.Add("X-ApiToken", resMatch) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/generic/generic.go b/pkg/detectors/generic/generic.go index 3bae29549f50..0e32fe5d07ad 100644 --- a/pkg/detectors/generic/generic.go +++ b/pkg/detectors/generic/generic.go @@ -44,8 +44,7 @@ func New() Scanner { } type Scanner struct { - programmingBookWords []string - excludeMatchers []*regexp.Regexp + excludeMatchers []*regexp.Regexp } // Ensure the Scanner satisfies the interface at compile time. diff --git a/pkg/detectors/impala/impala.go b/pkg/detectors/impala/impala.go index aa1cd9ed34d3..e7dceeace9c3 100644 --- a/pkg/detectors/impala/impala.go +++ b/pkg/detectors/impala/impala.go @@ -2,7 +2,6 @@ package impala import ( "context" - "fmt" "net/http" "regexp" "strings" @@ -52,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if err != nil { continue } - req.Header.Add("x-api-key", fmt.Sprintf("%s", resMatch)) + req.Header.Add("x-api-key", resMatch) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/interseller/interseller.go b/pkg/detectors/interseller/interseller.go index 7f89cbab9e71..a9b44baa0666 100644 --- a/pkg/detectors/interseller/interseller.go +++ b/pkg/detectors/interseller/interseller.go @@ -56,11 +56,6 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result defer res.Body.Close() if res.StatusCode >= 200 && res.StatusCode < 300 { s1.Verified = true - } else { - // This function will check false positives for common test words, but also it will make sure the key appears 'random' enough to be a real key - // if detectors.IsKnownFalsePositive(resMatch, detectors.DefaultFalsePositives, true) { - // continue - // } } } } diff --git a/pkg/detectors/keenio/keenio.go b/pkg/detectors/keenio/keenio.go index 298c15b9ea59..0637cb6925cf 100644 --- a/pkg/detectors/keenio/keenio.go +++ b/pkg/detectors/keenio/keenio.go @@ -2,7 +2,6 @@ package keenio import ( "context" - "fmt" "net/http" "regexp" "strings" @@ -61,7 +60,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result continue } req.Header.Add("Content-Type", "application/json") - req.Header.Add("Authorization", fmt.Sprintf("%s", resMatch)) + req.Header.Add("Authorization", resMatch) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/newrelicpersonalapikey/newrelicpersonalapikey.go b/pkg/detectors/newrelicpersonalapikey/newrelicpersonalapikey.go index c48dc0641fcc..456afd7d834b 100644 --- a/pkg/detectors/newrelicpersonalapikey/newrelicpersonalapikey.go +++ b/pkg/detectors/newrelicpersonalapikey/newrelicpersonalapikey.go @@ -2,7 +2,6 @@ package newrelicpersonalapikey import ( "context" - "fmt" "net/http" "regexp" "strings" @@ -52,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if err != nil { continue } - req.Header.Add("X-Api-Key", fmt.Sprintf("%s", resMatch)) + req.Header.Add("X-Api-Key", resMatch) 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 83c5da456901..bfd1bca4fe83 100644 --- a/pkg/detectors/newscatcher/newscatcher.go +++ b/pkg/detectors/newscatcher/newscatcher.go @@ -2,7 +2,6 @@ package newscatcher import ( "context" - "fmt" "net/http" "regexp" "strings" @@ -52,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if err != nil { continue } - req.Header.Add("x-api-key", fmt.Sprintf("%s", resMatch)) + req.Header.Add("x-api-key", resMatch) 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 f7e169c5edc8..6bc019268132 100644 --- a/pkg/detectors/nftport/nftport.go +++ b/pkg/detectors/nftport/nftport.go @@ -2,7 +2,6 @@ package nftport import ( "context" - "fmt" "net/http" "regexp" "strings" @@ -53,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result continue } req.Header.Add("Content-Type", "application/json") - req.Header.Add("Authorization", fmt.Sprintf("%s", resMatch)) + req.Header.Add("Authorization", resMatch) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/omnisend/omnisend.go b/pkg/detectors/omnisend/omnisend.go index edce816025e6..7bd2dcf8000a 100644 --- a/pkg/detectors/omnisend/omnisend.go +++ b/pkg/detectors/omnisend/omnisend.go @@ -2,7 +2,6 @@ package omnisend import ( "context" - "fmt" "net/http" "regexp" "strings" @@ -52,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if err != nil { continue } - req.Header.Add("X-API-KEY", fmt.Sprintf("%s", resMatch)) + req.Header.Add("X-API-KEY", resMatch) 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 e0aa4a6eccf8..02981b0a35fd 100644 --- a/pkg/detectors/openuv/openuv.go +++ b/pkg/detectors/openuv/openuv.go @@ -2,7 +2,6 @@ package openuv import ( "context" - "fmt" "net/http" "regexp" "strings" @@ -52,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if err != nil { continue } - req.Header.Add("x-access-token", fmt.Sprintf("%s", resMatch)) + req.Header.Add("x-access-token", resMatch) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/pepipost/pepipost.go b/pkg/detectors/pepipost/pepipost.go index ff7ea50f299b..b7b7983fb4f1 100644 --- a/pkg/detectors/pepipost/pepipost.go +++ b/pkg/detectors/pepipost/pepipost.go @@ -2,7 +2,6 @@ package pepipost import ( "context" - "fmt" "net/http" "regexp" "strings" @@ -52,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if err != nil { continue } - req.Header.Add("api_key", fmt.Sprintf("%s", resMatch)) + req.Header.Add("api_key", resMatch) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/postman/postman.go b/pkg/detectors/postman/postman.go index 60424ed89778..e5cdfc6f557d 100644 --- a/pkg/detectors/postman/postman.go +++ b/pkg/detectors/postman/postman.go @@ -2,7 +2,6 @@ package postman import ( "context" - "fmt" "net/http" "regexp" "strings" @@ -52,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if err != nil { continue } - req.Header.Add("x-api-key", fmt.Sprintf("%s", resMatch)) + req.Header.Add("x-api-key", resMatch) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/postmark/postmark.go b/pkg/detectors/postmark/postmark.go index 0ea2b93c1f98..16b64224f39f 100644 --- a/pkg/detectors/postmark/postmark.go +++ b/pkg/detectors/postmark/postmark.go @@ -2,7 +2,6 @@ package postmark import ( "context" - "fmt" "net/http" "regexp" "strings" @@ -53,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } req.Header.Add("Accept", "application/json") req.Header.Add("Content-Type", "application/json") - req.Header.Add("X-Postmark-Server-Token", fmt.Sprintf("%s", resMatch)) + req.Header.Add("X-Postmark-Server-Token", resMatch) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/prospectio/prospectio.go b/pkg/detectors/prospectio/prospectio.go index cac7262f9455..384d531dbf86 100644 --- a/pkg/detectors/prospectio/prospectio.go +++ b/pkg/detectors/prospectio/prospectio.go @@ -2,7 +2,6 @@ package prospectio import ( "context" - "fmt" "net/http" "regexp" "strings" @@ -52,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if err != nil { continue } - req.Header.Add("Authorization", fmt.Sprintf("%s", resMatch)) + req.Header.Add("Authorization", resMatch) req.Header.Add("Content-Type", "application/vnd.api+json; charset=utf-8") res, err := client.Do(req) if err == nil { diff --git a/pkg/detectors/pushbulletapikey/pushbulletapikey.go b/pkg/detectors/pushbulletapikey/pushbulletapikey.go index 58b19883d769..e5e30f870ce9 100644 --- a/pkg/detectors/pushbulletapikey/pushbulletapikey.go +++ b/pkg/detectors/pushbulletapikey/pushbulletapikey.go @@ -2,7 +2,6 @@ package pushbulletapikey import ( "context" - "fmt" "net/http" "regexp" "strings" @@ -52,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if err != nil { continue } - req.Header.Add("Access-Token", fmt.Sprintf("%s", resMatch)) + req.Header.Add("Access-Token", resMatch) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/qubole/qubole.go b/pkg/detectors/qubole/qubole.go index b6a82a26149e..855f091ffcc0 100644 --- a/pkg/detectors/qubole/qubole.go +++ b/pkg/detectors/qubole/qubole.go @@ -2,7 +2,6 @@ package qubole import ( "context" - "fmt" "net/http" "regexp" "strings" @@ -54,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result } req.Header.Add("Content-Type", "application/json") req.Header.Add("Accept", "application/json") - req.Header.Add("X-AUTH-TOKEN", fmt.Sprintf("%s", resMatch)) + req.Header.Add("X-AUTH-TOKEN", resMatch) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/rapidapi/rapidapi.go b/pkg/detectors/rapidapi/rapidapi.go index a0d20426093a..ff3102f318fc 100644 --- a/pkg/detectors/rapidapi/rapidapi.go +++ b/pkg/detectors/rapidapi/rapidapi.go @@ -2,7 +2,6 @@ package rapidapi import ( "context" - "fmt" "net/http" "regexp" "strings" @@ -51,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if err != nil { continue } - req.Header.Add("x-rapidapi-key", fmt.Sprintf("%s", resMatch)) + req.Header.Add("x-rapidapi-key", resMatch) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/rechargepayments/rechargepayments.go b/pkg/detectors/rechargepayments/rechargepayments.go index 08ba08b20d03..773a84f9f133 100644 --- a/pkg/detectors/rechargepayments/rechargepayments.go +++ b/pkg/detectors/rechargepayments/rechargepayments.go @@ -16,7 +16,6 @@ type Scanner struct{} var _ detectors.Detector = (*Scanner)(nil) var ( - client = common.SaneHttpClient() verifyURL = "https://api.rechargeapps.com/token_information" // Make sure that your group is surrounded in boundary characters such as below to reduce false positives. diff --git a/pkg/detectors/scalewaykey/scalewaykey.go b/pkg/detectors/scalewaykey/scalewaykey.go index caebb591fd0b..c82b4a0d0ace 100644 --- a/pkg/detectors/scalewaykey/scalewaykey.go +++ b/pkg/detectors/scalewaykey/scalewaykey.go @@ -2,7 +2,6 @@ package scalewaykey import ( "context" - "fmt" "net/http" "regexp" "strings" @@ -51,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if err != nil { continue } - req.Header.Add("X-Auth-Token", fmt.Sprintf("%s", resMatch)) + req.Header.Add("X-Auth-Token", resMatch) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/sendinbluev2/sendinbluev2.go b/pkg/detectors/sendinbluev2/sendinbluev2.go index f105fa8ffaa7..69473743893f 100644 --- a/pkg/detectors/sendinbluev2/sendinbluev2.go +++ b/pkg/detectors/sendinbluev2/sendinbluev2.go @@ -2,7 +2,6 @@ package sendinbluev2 import ( "context" - "fmt" "net/http" "regexp" "strings" @@ -51,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if err != nil { continue } - req.Header.Add("api-key", fmt.Sprintf("%s", resMatch)) + req.Header.Add("api-key", resMatch) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/shortcut/shortcut.go b/pkg/detectors/shortcut/shortcut.go index b60dad85a865..e5dd33a3d4d6 100644 --- a/pkg/detectors/shortcut/shortcut.go +++ b/pkg/detectors/shortcut/shortcut.go @@ -65,19 +65,11 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if strings.Contains(body, "app_url") { s1.Verified = true - } else { - // if detectors.IsKnownFalsePositive(resMatch, detectors.DefaultFalsePositives, true) { - // continue - // } } - } - } - results = append(results, s1) } - return results, nil } diff --git a/pkg/detectors/skrappio/skrappio.go b/pkg/detectors/skrappio/skrappio.go index 3efe9f4d8cfc..0634170dde9f 100644 --- a/pkg/detectors/skrappio/skrappio.go +++ b/pkg/detectors/skrappio/skrappio.go @@ -2,7 +2,6 @@ package skrappio import ( "context" - "fmt" "net/http" "regexp" "strings" @@ -53,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result continue } req.Header.Add("Content-Type", "application/json") - req.Header.Add("X-Access-Key", fmt.Sprintf("%s", resMatch)) + req.Header.Add("X-Access-Key", resMatch) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/stormglass/stormglass.go b/pkg/detectors/stormglass/stormglass.go index 503f6e84dc7d..cc21564fbdbe 100644 --- a/pkg/detectors/stormglass/stormglass.go +++ b/pkg/detectors/stormglass/stormglass.go @@ -2,7 +2,6 @@ package stormglass import ( "context" - "fmt" "net/http" "regexp" "strings" @@ -52,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if err != nil { continue } - req.Header.Add("Authorization", fmt.Sprintf("%s", resMatch)) + req.Header.Add("Authorization", resMatch) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/detectors/tatumio/tatumio.go b/pkg/detectors/tatumio/tatumio.go index cd73263dafec..f98c4fb497c0 100644 --- a/pkg/detectors/tatumio/tatumio.go +++ b/pkg/detectors/tatumio/tatumio.go @@ -2,7 +2,6 @@ package tatumio import ( "context" - "fmt" "net/http" "regexp" "strings" @@ -53,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result continue } req.Header.Add("Accept", "application/vnd.tatumio+json; version=3") - req.Header.Add("x-api-key", fmt.Sprintf("%s", resMatch)) + req.Header.Add("x-api-key", resMatch) 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 d06a92a3834a..90160fc78e11 100644 --- a/pkg/detectors/zonkafeedback/zonkafeedback.go +++ b/pkg/detectors/zonkafeedback/zonkafeedback.go @@ -2,7 +2,6 @@ package zonkafeedback import ( "context" - "fmt" "net/http" "regexp" "strings" @@ -52,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result if err != nil { continue } - req.Header.Add("Z-API-TOKEN", fmt.Sprintf("%s", resMatch)) + req.Header.Add("Z-API-TOKEN", resMatch) res, err := client.Do(req) if err == nil { defer res.Body.Close() diff --git a/pkg/sources/git/git.go b/pkg/sources/git/git.go index 943a29b82703..db1cef9cbc73 100644 --- a/pkg/sources/git/git.go +++ b/pkg/sources/git/git.go @@ -5,7 +5,6 @@ import ( "bytes" "fmt" "io" - "io/ioutil" "net/url" "os" "os/exec" @@ -257,7 +256,7 @@ func CloneRepo(ctx context.Context, userInfo *url.Userinfo, gitUrl string, args if err := gitCmdCheck(); err != nil { return "", nil, err } - clonePath, err := ioutil.TempDir(os.TempDir(), "trufflehog") + clonePath, err := os.MkdirTemp(os.TempDir(), "trufflehog") if err != nil { return "", nil, err }