Find, verify, and analyze leaked credentials
Go credentialsdevsecopsdynamic-analysisprecommitscanningsecretsecret-managementsecretssecuritysecurity-toolstrufflehogverification
[INS-312] Duo API Secret Key Detector (#4771)
Muneeb Ullah Khana7bdcf95222c
diff --git a/main.go b/main.goindex cb60b2334..194a7a42b 100644--- a/main.go+++ b/main.go@@ -562,6 +562,7 @@ func run(state overseer.State, logSync func() error) {feature.HashiCorpVaultTokenDetectorEnabled.Store(true)feature.CloudflareApiTokenV2DetectorEnabled.Store(true)feature.CloudflareGlobalApiKeyV2DetectorEnabled.Store(true)+ feature.DuoDetectorEnabled.Store(true)conf := &config.Config{}if *configFilename != "" {diff --git a/pkg/detectors/duo/duo.go b/pkg/detectors/duo/duo.gonew file mode 100644index 000000000..664bb97f7--- /dev/null+++ b/pkg/detectors/duo/duo.go@@ -0,0 +1,221 @@+package duo++import (+ "context"+ "crypto/hmac"+ "crypto/sha1"+ "encoding/base64"+ "encoding/hex"+ "fmt"+ "io"+ "net/http"+ "strings"+ "time"++ regexp "github.com/wasilibs/go-re2"++ "github.com/trufflesecurity/trufflehog/v3/pkg/common"+ "github.com/trufflesecurity/trufflehog/v3/pkg/detectors"+ "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"+)++type Scanner struct {+ client *http.Client+ detectors.DefaultMultiPartCredentialProvider+}++// Ensure the Scanner satisfies the interface at compile time.+var _ detectors.Detector = (*Scanner)(nil)++var (+ defaultClient = common.SaneHttpClient()++ // Integration key is of 20 characters with only capital alphabets and digits.+ integrationKeyPat = regexp.MustCompile(detectors.PrefixRegex([]string{"duo"}) + `\b(DI[A-Z0-9]{18})\b`)++ // Secret key is of 40 characters with only alphabets and digits.+ secretKeyPat = regexp.MustCompile(detectors.PrefixRegex([]string{"duo"}) + `\b([A-Za-z0-9]{40})\b`)++ // Host is usually a subdomain of duosecurity.com e.g api-21321awda.duosecurity.com+ apiHost = regexp.MustCompile(`\b([a-z0-9-]{6,}\.duosecurity\.com)\b`)+)++// Keywords are used for efficiently pre-filtering chunks.+// Use identifiers in the secret preferably, or the provider name.+func (s Scanner) Keywords() []string {+ return []string{"duosecurity"}+}++func (s Scanner) getClient() *http.Client {+ if s.client != nil {+ return s.client+ }+ return defaultClient+}++// FromData will find and optionally verify DeepSeek secrets in a given set of bytes.+func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (results []detectors.Result, err error) {+ dataStr := string(data)++ uniqueHosts := make(map[string]struct{})+ uniqueIntKeys := make(map[string]struct{})+ uniqueSecretKeys := make(map[string]struct{})+ for _, match := range apiHost.FindAllStringSubmatch(dataStr, -1) {+ uniqueHosts[match[1]] = struct{}{}+ }+ for _, match := range integrationKeyPat.FindAllStringSubmatch(dataStr, -1) {+ uniqueIntKeys[match[1]] = struct{}{}+ }+ for _, match := range secretKeyPat.FindAllStringSubmatch(dataStr, -1) {+ uniqueSecretKeys[match[1]] = struct{}{}+ }+ for host := range uniqueHosts {+ for apiKey := range uniqueIntKeys {+ for apiSecret := range uniqueSecretKeys {+ s1 := detectors.Result{+ DetectorType: detector_typepb.DetectorType_Duo,+ Raw: []byte(apiKey),+ RawV2: []byte(fmt.Sprintf("%s:%s:%s", host, apiKey, apiSecret)),+ ExtraData: map[string]string{+ "application": "Admin API",+ },+ SecretParts: map[string]string{+ "host": host,+ "ikey": apiKey,+ "skey": apiSecret,+ "application": "Admin API",+ },+ }+ if verify {+ verified, verificationErr := VerifyAdminToken(ctx, s.getClient(), host, apiKey, apiSecret)+ // we will try auth api verification if admin api verification fails without error,+ // which is in the case of it returning 401 unauthorized due to invalid credentials.+ if !verified && verificationErr == nil {+ var authStatusCode int+ verified, authStatusCode, verificationErr = VerifyAuthToken(ctx, s.getClient(), host, apiKey, apiSecret)+ // The Auth API responds 403 (not 401) when ikey/skey are+ // structurally valid Admin API keys, active or not. That still+ // counts as verified, but the keys remain Admin API keys, so+ // only relabel to Auth API when the check actually succeeded (200).+ if authStatusCode != http.StatusForbidden {+ s1.ExtraData["application"] = "Auth API"+ s1.SecretParts["application"] = "Auth API"+ }+ }+ s1.SetVerificationError(verificationErr, host, apiKey, apiSecret)+ s1.Verified = verified+ }+ results = append(results, s1)+ }+ }+ }+ return results, nil+}++// returns verified=true if credentials are valid and belong to auth api, false if creds are invalid, and error if creds belong to auth api or for anything else (e.g., network error).+// The HTTP status code is also returned so callers can distinguish a genuine 200 from a+// 403, which the Auth API returns for structurally valid Admin API keys (active or not).+func VerifyAuthToken(+ ctx context.Context,+ client *http.Client,+ host, ikey, skey string,+) (bool, int, error) {+ // Docs: https://duo.com/docs/authapi#check+ return verifyDuoRequest(+ ctx,+ client,+ host,+ ikey,+ skey,+ "/auth/v2/check",+ )+}++// returns 401 unauthorized if credentials are invalid, 200 OK if valid, and error for anything else+func VerifyAdminToken(+ ctx context.Context,+ client *http.Client,+ host, ikey, skey string,+) (bool, error) {+ // Docs: https://duo.com/docs/adminapi#account-info+ verified, _, err := verifyDuoRequest(+ ctx,+ client,+ host,+ ikey,+ skey,+ "/admin/v1/info/summary",+ )+ return verified, err+}++func verifyDuoRequest(+ ctx context.Context,+ client *http.Client,+ host, ikey, skey string,+ path string,+) (bool, int, error) {++ timestamp := time.Now().UTC().Format(http.TimeFormat)++ // Canonical request string+ canonical := strings.Join([]string{+ timestamp,+ http.MethodGet,+ host,+ path,+ "",+ }, "\n")++ // HMAC signature+ mac := hmac.New(sha1.New, []byte(skey))+ _, _ = mac.Write([]byte(canonical))+ signature := hex.EncodeToString(mac.Sum(nil))++ // Authorization header+ auth := base64.StdEncoding.EncodeToString(+ []byte(ikey + ":" + signature),+ )++ // Build request+ req, err := http.NewRequestWithContext(+ ctx,+ http.MethodGet,+ "https://"+host+path,+ nil,+ )+ if err != nil {+ return false, 0, err+ }++ req.Header.Set("Authorization", "Basic "+auth)+ req.Header.Set("Date", timestamp)++ res, err := client.Do(req)+ if err != nil {+ return false, 0, err+ }+ defer func() {+ _, _ = io.Copy(io.Discard, res.Body)+ _ = res.Body.Close()+ }()++ switch res.StatusCode {+ case http.StatusOK:+ return true, res.StatusCode, nil+ case http.StatusUnauthorized:+ return false, res.StatusCode, nil+ case http.StatusForbidden: // Auth API returns 403 if credentials are admin keys be it active or inactive+ return true, res.StatusCode, nil+ default:+ return false, res.StatusCode, fmt.Errorf("unexpected HTTP status %d", res.StatusCode)+ }+}++func (s Scanner) Type() detector_typepb.DetectorType {+ return detector_typepb.DetectorType_Duo+}++func (s Scanner) Description() string {+ return "Duo is a security platform that provides multi-factor authentication and identity management services."+}diff --git a/pkg/detectors/duo/duo_integration_test.go b/pkg/detectors/duo/duo_integration_test.gonew file mode 100644index 000000000..8d3ef7fc9--- /dev/null+++ b/pkg/detectors/duo/duo_integration_test.go@@ -0,0 +1,310 @@+//go:build detectors+// +build detectors++package duo++import (+ "context"+ "fmt"+ "testing"+ "time"++ "github.com/google/go-cmp/cmp"+ "github.com/google/go-cmp/cmp/cmpopts"++ "github.com/trufflesecurity/trufflehog/v3/pkg/common"+ "github.com/trufflesecurity/trufflehog/v3/pkg/detectors"+ "github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"+)++func TestDuo_FromChunk(t *testing.T) {+ ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)+ defer cancel()++ testSecrets, err := common.GetSecret(ctx, "trufflehog-testing", "detectors6")+ if err != nil {+ t.Fatalf("could not get test secrets from GCP: %s", err)+ }++ host := testSecrets.MustGetField("DUO_APIHOST")+ ikey := testSecrets.MustGetField("DUO_AUTH_IKEY")+ skey := testSecrets.MustGetField("DUO_AUTH_SKEY")+ inactiveSKey := "CWZZCIOF2aEHdx2PfexiNC3Bedai2axLMC3C2IFe"++ type args struct {+ ctx context.Context+ data []byte+ verify bool+ }++ tests := []struct {+ name string+ s Scanner+ args args+ want []detectors.Result+ wantErr bool+ wantVerificationErr bool+ }{+ {+ name: "found, verified",+ s: Scanner{},+ args: args{+ ctx: context.Background(),+ data: fmt.Appendf(+ []byte{},+ "Using DUO_APIHOST=%s DUO_IKEY=%s DUO_SKEY=%s",+ host, ikey, skey,+ ),+ verify: true,+ },+ want: []detectors.Result{+ {+ DetectorType: detector_typepb.DetectorType_Duo,+ Verified: true,+ Raw: []byte(ikey),+ RawV2: []byte(fmt.Sprintf("%s:%s:%s", host, ikey, skey)),+ },+ },+ },+ {+ name: "found, real secrets, verification error due to timeout",+ s: Scanner{client: common.SaneHttpClientTimeOut(1 * time.Microsecond)},+ args: args{+ ctx: context.Background(),+ data: fmt.Appendf(+ []byte{},+ "DUO_APIHOST=%s DUO_IKEY=%s DUO_SKEY=%s",+ host, ikey, skey,+ ),+ verify: true,+ },+ want: []detectors.Result{+ {+ DetectorType: detector_typepb.DetectorType_Duo,+ Verified: false,+ Raw: []byte(ikey),+ RawV2: []byte(fmt.Sprintf("%s:%s:%s", host, ikey, skey)),+ },+ },+ wantVerificationErr: true,+ },+ {+ name: "found, real secrets, verification error due to unexpected api surface",+ s: Scanner{client: common.ConstantResponseHttpClient(500, "{}")},+ args: args{+ ctx: context.Background(),+ data: fmt.Appendf(+ []byte{},+ "DUO_APIHOST=%s DUO_IKEY=%s DUO_SKEY=%s",+ host, ikey, skey,+ ),+ verify: true,+ },+ want: []detectors.Result{+ {+ DetectorType: detector_typepb.DetectorType_Duo,+ Verified: false,+ Raw: []byte(ikey),+ RawV2: []byte(fmt.Sprintf("%s:%s:%s", host, ikey, skey)),+ },+ },+ wantVerificationErr: true,+ },+ {+ name: "found, unverified (inactive secret)",+ s: Scanner{},+ args: args{+ ctx: context.Background(),+ data: fmt.Appendf(+ []byte{},+ "DUO_APIHOST=%s DUO_IKEY=%s DUO_SKEY=%s",+ host, ikey, inactiveSKey,+ ),+ verify: true,+ },+ want: []detectors.Result{+ {+ DetectorType: detector_typepb.DetectorType_Duo,+ Verified: false,+ Raw: []byte(ikey),+ RawV2: []byte(fmt.Sprintf("%s:%s:%s", host, ikey, inactiveSKey)),+ },+ },+ },+ {+ name: "not found",+ s: Scanner{},+ args: args{+ ctx: context.Background(),+ data: []byte("no duo credentials here"),+ verify: true,+ },+ want: nil,+ },+ }++ for _, tt := range tests {+ t.Run(tt.name, func(t *testing.T) {+ got, err := tt.s.FromData(tt.args.ctx, tt.args.verify, tt.args.data)+ if (err != nil) != tt.wantErr {+ t.Fatalf("Duo.FromData() error = %v, wantErr %v", err, tt.wantErr)+ }++ for i := range got {+ if len(got[i].Raw) == 0 {+ t.Fatal("no raw secret present")+ }+ if (got[i].VerificationError() != nil) != tt.wantVerificationErr {+ t.Fatalf(+ "wantVerificationError=%v, verificationError=%v",+ tt.wantVerificationErr,+ got[i].VerificationError(),+ )+ }+ }++ ignoreOpts := cmpopts.IgnoreFields(+ detectors.Result{},+ "ExtraData",+ "verificationError",+ "primarySecret",+ )++ if diff := cmp.Diff(got, tt.want, ignoreOpts); diff != "" {+ t.Errorf("Duo.FromData() %s diff: (-got +want)\n%s", tt.name, diff)+ }+ })+ }+}++func TestDuo_FromChunk_AdminAPI(t *testing.T) {+ ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)+ defer cancel()++ testSecrets, err := common.GetSecret(ctx, "trufflehog-testing", "detectors6")+ if err != nil {+ t.Fatalf("could not get test secrets from GCP: %s", err)+ }++ // Auth API credentials+ host := testSecrets.MustGetField("DUO_APIHOST")+ inactiveSKey := "CWZZCIOF2aEHdx2PfexiNC3Bedai2axLMC3C2IFe"+ inactiveIKey := "DIBJ9FGFZDD8BQKF6PN1"++ // Admin API credentials+ adminIKey := testSecrets.MustGetField("DUO_ADMIN_IKEY")+ adminSKey := testSecrets.MustGetField("DUO_ADMIN_SKEY")++ type args struct {+ ctx context.Context+ data []byte+ verify bool+ }++ tests := []struct {+ name string+ s Scanner+ args args+ want []detectors.Result+ wantErr bool+ wantVerificationErr bool+ }{+ {+ name: "admin key, verified",+ s: Scanner{},+ args: args{+ ctx: context.Background(),+ data: fmt.Appendf(+ []byte{},+ "Using DUO_APIHOST=%s DUO_IKEY=%s DUO_SKEY=%s",+ host, adminIKey, adminSKey,+ ),+ verify: true,+ },+ want: []detectors.Result{+ {+ DetectorType: detector_typepb.DetectorType_Duo,+ Verified: true,+ Raw: []byte(adminIKey),+ RawV2: []byte(fmt.Sprintf("%s:%s:%s", host, adminIKey, adminSKey)),+ ExtraData: map[string]string{+ "application": "Admin API",+ },+ },+ },+ },+ {+ name: "admin key, unverified (invalid secret)",+ s: Scanner{},+ args: args{+ ctx: context.Background(),+ data: fmt.Appendf(+ []byte{},+ "Using DUO_APIHOST=%s DUO_IKEY=%s DUO_SKEY=%s",+ host, inactiveIKey, inactiveSKey,+ ),+ verify: true,+ },+ want: []detectors.Result{+ {+ DetectorType: detector_typepb.DetectorType_Duo,+ Verified: false,+ Raw: []byte(inactiveIKey),+ RawV2: []byte(fmt.Sprintf("%s:%s:%s", host, inactiveIKey, inactiveSKey)),+ ExtraData: map[string]string{+ "application": "Auth API",+ },+ },+ },+ wantVerificationErr: false,+ },+ }++ for _, tt := range tests {+ t.Run(tt.name, func(t *testing.T) {+ got, err := tt.s.FromData(tt.args.ctx, tt.args.verify, tt.args.data)+ if (err != nil) != tt.wantErr {+ t.Fatalf("Duo.FromData() error = %v, wantErr %v", err, tt.wantErr)+ }++ for i := range got {+ if len(got[i].Raw) == 0 {+ t.Fatal("no raw secret present")+ }+ if (got[i].VerificationError() != nil) != tt.wantVerificationErr {+ t.Fatalf(+ "wantVerificationError=%v, verificationError=%v",+ tt.wantVerificationErr,+ got[i].VerificationError(),+ )+ }+ }++ ignoreOpts := cmpopts.IgnoreFields(+ detectors.Result{},+ "verificationError",+ "primarySecret",+ )++ if diff := cmp.Diff(got, tt.want, ignoreOpts); diff != "" {+ t.Errorf("Duo.FromData() %s diff: (-got +want)\n%s", tt.name, diff)+ }+ })+ }+}++func BenchmarkFromData(benchmark *testing.B) {+ ctx := context.Background()+ s := Scanner{}+ for name, data := range detectors.MustGetBenchmarkData() {+ benchmark.Run(name, func(b *testing.B) {+ b.ResetTimer()+ for n := 0; n < b.N; n++ {+ _, err := s.FromData(ctx, false, data)+ if err != nil {+ b.Fatal(err)+ }+ }+ })+ }+}diff --git a/pkg/detectors/duo/duo_test.go b/pkg/detectors/duo/duo_test.gonew file mode 100644index 000000000..1160d911e--- /dev/null+++ b/pkg/detectors/duo/duo_test.go@@ -0,0 +1,163 @@+package duo++import (+ "context"+ "testing"++ "github.com/google/go-cmp/cmp"+ "github.com/stretchr/testify/require"++ "github.com/trufflesecurity/trufflehog/v3/pkg/detectors"+ "github.com/trufflesecurity/trufflehog/v3/pkg/engine/ahocorasick"+)++func TestDuo_Pattern(t *testing.T) {+ d := Scanner{}+ ahoCorasickCore := ahocorasick.NewAhoCorasickCore([]detectors.Detector{d})++ tests := []struct {+ name string+ input string+ want []string+ }{+ {+ name: "valid pattern - auth api credentials",+ input: `+ [INFO] Initializing Duo Auth API+ [DEBUG] DUO_API_HOST=api-123456.duosecurity.com+ [DEBUG] DUO_IKEY=DIXXXXXXXXXXXXXXXXXX+ [DEBUG] DUO_SKEY=CWZZCIOF2aEHdx2PfexiNC3Bedai2axLMC3C2IFe+ `,+ want: []string{+ "api-123456.duosecurity.com:DIXXXXXXXXXXXXXXXXXX:CWZZCIOF2aEHdx2PfexiNC3Bedai2axLMC3C2IFe",+ },+ },+ {+ name: "valid pattern - admin api credentials",+ input: `+ [INFO] Connecting to Duo Admin API+ [DEBUG] duo_host=api-abcdef.duosecurity.com+ [DEBUG] duo_integration_key=DIYYYYYYYYYYYYYYYYYY+ [DEBUG] duo_secret_key=CWZZCIOF2aEHdx2PfexiNC3Bedai2axLMC3C2IFe+ `,+ want: []string{+ "api-abcdef.duosecurity.com:DIYYYYYYYYYYYYYYYYYY:CWZZCIOF2aEHdx2PfexiNC3Bedai2axLMC3C2IFe",+ },+ },+ {+ name: "valid pattern - json config",+ input: `+ {+ "duo": {+ "host": "api-zzzzzz.duosecurity.com",+ "ikey": "DIABCDEFGHIJKLMNOPQR",+ "duo_skey": "CWZZCIOF2aEHdx2PfexiNC3Bedai2axLMC3C2IFe"+ }+ }+ `,+ want: []string{+ "api-zzzzzz.duosecurity.com:DIABCDEFGHIJKLMNOPQR:CWZZCIOF2aEHdx2PfexiNC3Bedai2axLMC3C2IFe",+ },+ },+ {+ name: "invalid pattern - only ikey",+ input: `+ [DEBUG] DUO_IKEY=DIXXXXXXXXXXXXXXXXXX+ `,+ want: nil,+ },+ {+ name: "invalid pattern - only skey",+ input: `+ [DEBUG] DUO_SKEY=CWZZCIOF2aEHdx2PfexiNC3Bedai2axLMC3C2IFe+ `,+ want: nil,+ },+ {+ name: "invalid pattern - only host",+ input: `+ [DEBUG] DUO_API_HOST=api-123456.duosecurity.com+ `,+ want: nil,+ },+ {+ name: "invalid pattern - missing host",+ input: `+ [DEBUG] DUO_IKEY=DIXXXXXXXXXXXXXXXXXX+ [DEBUG] DUO_SKEY=CWZZCIOF2aEHdx2PfexiNC3Bedai2axLMC3C2IFe+ `,+ want: nil,+ },+ {+ name: "invalid pattern - short ikey",+ input: `+ [DEBUG] DUO_API_HOST=api-123456.duosecurity.com+ [DEBUG] DUO_IKEY=DI123+ [DEBUG] DUO_SKEY=CWZZCIOF2aEHdx2PfexiNC3Bedai2axLMC3C2IFe+ `,+ want: nil,+ },+ {+ name: "invalid pattern - short skey",+ input: `+ [DEBUG] DUO_API_HOST=api-123456.duosecurity.com+ [DEBUG] DUO_IKEY=DIXXXXXXXXXXXXXXXXXX+ [DEBUG] DUO_SKEY=deadbeef+ `,+ want: nil,+ },+ {+ name: "invalid pattern - wrong host domain",+ input: `+ [DEBUG] DUO_API_HOST=duo.example.com+ [DEBUG] DUO_IKEY=DIXXXXXXXXXXXXXXXXXX+ [DEBUG] DUO_SKEY=CWZZCIOF2aEHdx2PfexiNC3Bedai2axLMC3C2IFe+ `,+ want: nil,+ },+ }++ for _, test := range tests {+ t.Run(test.name, func(t *testing.T) {+ matchedDetectors := ahoCorasickCore.FindDetectorMatches([]byte(test.input))+ if len(matchedDetectors) == 0 {+ if len(test.want) > 0 {+ t.Errorf(+ "test %q failed: expected keywords %v to be found",+ test.name,+ d.Keywords(),+ )+ }+ return+ }++ results, err := d.FromData(context.Background(), false, []byte(test.input))+ require.NoError(t, err)+ if len(results) != len(test.want) {+ t.Fatalf(+ "mismatch in result count: expected %d, got %d",+ len(test.want),+ len(results),+ )+ }++ actual := make(map[string]struct{}, len(results))+ for _, r := range results {+ if len(r.RawV2) > 0 {+ actual[string(r.RawV2)] = struct{}{}+ } else {+ actual[string(r.Raw)] = struct{}{}+ }+ }++ expected := make(map[string]struct{}, len(test.want))+ for _, v := range test.want {+ expected[v] = struct{}{}+ }++ if diff := cmp.Diff(expected, actual); diff != "" {+ t.Errorf("%s diff: (-want +got)\n%s", test.name, diff)+ }+ })+ }+}diff --git a/pkg/engine/defaults/defaults.go b/pkg/engine/defaults/defaults.goindex c37875198..370eed020 100644--- a/pkg/engine/defaults/defaults.go+++ b/pkg/engine/defaults/defaults.go@@ -256,6 +256,7 @@ import ("github.com/trufflesecurity/trufflehog/v3/pkg/detectors/droneci""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/dropbox""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/duffeltoken"+ "github.com/trufflesecurity/trufflehog/v3/pkg/detectors/duo""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/duply""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/dwolla""github.com/trufflesecurity/trufflehog/v3/pkg/detectors/dynalist"@@ -1155,6 +1156,7 @@ func buildDetectorList() []detectors.Detector {&droneci.Scanner{},&dropbox.Scanner{},&duffeltoken.Scanner{},+ &duo.Scanner{},&duply.Scanner{},&dwolla.Scanner{},&dynalist.Scanner{},@@ -1856,6 +1858,8 @@ func buildDetectorList() []detectors.Detector {return !feature.CloudflareApiTokenV2DetectorEnabled.Load()case *cloudflareglobalapikeyv2.Scanner:return !feature.CloudflareGlobalApiKeyV2DetectorEnabled.Load()+ case *duo.Scanner:+ return !feature.DuoDetectorEnabled.Load()default:return false}diff --git a/pkg/engine/defaults/defaults_test.go b/pkg/engine/defaults/defaults_test.goindex 18e4fc3a4..75fe77feb 100644--- a/pkg/engine/defaults/defaults_test.go+++ b/pkg/engine/defaults/defaults_test.go@@ -144,6 +144,7 @@ var excludedFromDefaultList = map[detector_typepb.DetectorType]struct{}{detector_typepb.DetectorType_Lob: {},detector_typepb.DetectorType_HashiCorpVaultBatchToken: {},detector_typepb.DetectorType_HashiCorpVaultToken: {},+ detector_typepb.DetectorType_Duo: {},// Reserved / special types.detector_typepb.DetectorType_CustomRegex: {}, // added dynamically via engine config, not via buildDetectorList()diff --git a/pkg/feature/feature.go b/pkg/feature/feature.goindex 7ac3d3a18..c9e8099f1 100644--- a/pkg/feature/feature.go+++ b/pkg/feature/feature.go@@ -40,6 +40,7 @@ var (HashiCorpVaultTokenDetectorEnabled atomic.BoolCloudflareApiTokenV2DetectorEnabled atomic.BoolCloudflareGlobalApiKeyV2DetectorEnabled atomic.Bool+ DuoDetectorEnabled atomic.Bool)type AtomicString struct {diff --git a/pkg/pb/detector_typepb/detector_type.pb.go b/pkg/pb/detector_typepb/detector_type.pb.goindex 81e7eb5d2..9c1c7dfb7 100644--- a/pkg/pb/detector_typepb/detector_type.pb.go+++ b/pkg/pb/detector_typepb/detector_type.pb.go@@ -1116,6 +1116,7 @@ const (DetectorType_Shippo DetectorType = 1060DetectorType_HashiCorpVaultBatchToken DetectorType = 1061DetectorType_HashiCorpVaultToken DetectorType = 1062+ DetectorType_Duo DetectorType = 1063)// Enum value maps for DetectorType.@@ -2180,6 +2181,7 @@ var (1060: "Shippo",1061: "HashiCorpVaultBatchToken",1062: "HashiCorpVaultToken",+ 1063: "Duo",}DetectorType_value = map[string]int32{"Alibaba": 0,@@ -3241,6 +3243,7 @@ var ("Shippo": 1060,"HashiCorpVaultBatchToken": 1061,"HashiCorpVaultToken": 1062,+ "Duo": 1063,})@@ -3276,7 +3279,7 @@ var File_detector_type_proto protoreflect.FileDescriptorvar file_detector_type_proto_rawDesc = []byte{0x0a, 0x13, 0x64, 0x65, 0x74, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x2e,0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x64, 0x65, 0x74, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x5f,- 0x74, 0x79, 0x70, 0x65, 0x2a, 0xbf, 0x8a, 0x01, 0x0a, 0x0c, 0x44, 0x65, 0x74, 0x65, 0x63, 0x74,+ 0x74, 0x79, 0x70, 0x65, 0x2a, 0xc9, 0x8a, 0x01, 0x0a, 0x0c, 0x44, 0x65, 0x74, 0x65, 0x63, 0x74,0x6f, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x41, 0x6c, 0x69, 0x62, 0x61, 0x62,0x61, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x41, 0x4d, 0x51, 0x50, 0x10, 0x01, 0x12, 0x07, 0x0a,0x03, 0x41, 0x57, 0x53, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x7a, 0x75, 0x72, 0x65, 0x10,@@ -4384,12 +4387,12 @@ var file_detector_type_proto_rawDesc = []byte{0x0a, 0x18, 0x48, 0x61, 0x73, 0x68, 0x69, 0x43, 0x6f, 0x72, 0x70, 0x56, 0x61, 0x75, 0x6c, 0x74,0x42, 0x61, 0x74, 0x63, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x10, 0xa5, 0x08, 0x12, 0x18, 0x0a,0x13, 0x48, 0x61, 0x73, 0x68, 0x69, 0x43, 0x6f, 0x72, 0x70, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x54,- 0x6f, 0x6b, 0x65, 0x6e, 0x10, 0xa6, 0x08, 0x42, 0x41, 0x5a, 0x3f, 0x67, 0x69, 0x74, 0x68, 0x75,- 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x72, 0x75, 0x66, 0x66, 0x6c, 0x65, 0x73, 0x65, 0x63,- 0x75, 0x72, 0x69, 0x74, 0x79, 0x2f, 0x74, 0x72, 0x75, 0x66, 0x66, 0x6c, 0x65, 0x68, 0x6f, 0x67,- 0x2f, 0x76, 0x33, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x62, 0x2f, 0x64, 0x65, 0x74, 0x65, 0x63,- 0x74, 0x6f, 0x72, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,- 0x6f, 0x33,+ 0x6f, 0x6b, 0x65, 0x6e, 0x10, 0xa6, 0x08, 0x12, 0x08, 0x0a, 0x03, 0x44, 0x75, 0x6f, 0x10, 0xa7,+ 0x08, 0x42, 0x41, 0x5a, 0x3f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f,+ 0x74, 0x72, 0x75, 0x66, 0x66, 0x6c, 0x65, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x2f,+ 0x74, 0x72, 0x75, 0x66, 0x66, 0x6c, 0x65, 0x68, 0x6f, 0x67, 0x2f, 0x76, 0x33, 0x2f, 0x70, 0x6b,+ 0x67, 0x2f, 0x70, 0x62, 0x2f, 0x64, 0x65, 0x74, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x5f, 0x74, 0x79,+ 0x70, 0x65, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,}var (diff --git a/proto/detector_type.proto b/proto/detector_type.protoindex 04df1a01b..dc33d9421 100644--- a/proto/detector_type.proto+++ b/proto/detector_type.proto@@ -1064,4 +1064,5 @@ enum DetectorType {Shippo = 1060;HashiCorpVaultBatchToken = 1061;HashiCorpVaultToken = 1062;+ Duo = 1063;}