Skip to content

Find, verify, and analyze leaked credentials

Make AzureDevopsPersonalAccessToken verification more robust (#2359)

Dustin Deckerc2ae31d06077
diff --git a/hack/snifftest/snifftest.sh b/hack/snifftest/snifftest.sh
index 04e1bd6eb..f17b04dfb 100755
--- a/hack/snifftest/snifftest.sh
+++ b/hack/snifftest/snifftest.sh
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
REPO_ARRAY=(
- # "https://github.com/Netflix/Hystrix.git"
+ "https://github.com/Netflix/Hystrix.git"
# "https://github.com/facebook/flow.git"
# "https://github.com/Netflix/vizceral.git"
# "https://github.com/Netflix/metaflow.git"
diff --git a/pkg/detectors/azuredevopspersonalaccesstoken/azuredevopspersonalaccesstoken.go b/pkg/detectors/azuredevopspersonalaccesstoken/azuredevopspersonalaccesstoken.go
index c1a50ae76..d6a3bb537 100644
--- a/pkg/detectors/azuredevopspersonalaccesstoken/azuredevopspersonalaccesstoken.go
+++ b/pkg/detectors/azuredevopspersonalaccesstoken/azuredevopspersonalaccesstoken.go
@@ -69,7 +69,8 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
res, err := client.Do(req)
if err == nil {
defer res.Body.Close()
- if res.StatusCode >= 200 && res.StatusCode < 300 {
+ hasVerifiedRes, _ := common.ResponseContainsSubstring(res.Body, "lastUpdateTime")
+ if res.StatusCode >= 200 && res.StatusCode < 300 && hasVerifiedRes {
s1.Verified = true
} else if res.StatusCode == 401 {
// The secret is determinately not verified (nothing to do)