Find, verify, and analyze leaked credentials
Go credentialsdevsecopsdynamic-analysisprecommitscanningsecretsecret-managementsecretssecuritysecurity-toolstrufflehogverification
replace interface{} with any. (#1771)
ahrav22876f83814c
diff --git a/pkg/detectors/gemini/gemini.go b/pkg/detectors/gemini/gemini.goindex 3ef16d22a..7e47f10a5 100644--- a/pkg/detectors/gemini/gemini.go+++ b/pkg/detectors/gemini/gemini.go@@ -96,7 +96,7 @@ func constructRequest(secret, keyID string) (*http.Request, error) {return nil, err}- params := map[string]interface{}{+ params := map[string]any{"request": accountDetail,"nonce": time.Now().UnixNano(),}diff --git a/pkg/detectors/mockaroo/mockaroo.go b/pkg/detectors/mockaroo/mockaroo.goindex 03813265b..0a5127415 100644--- a/pkg/detectors/mockaroo/mockaroo.go+++ b/pkg/detectors/mockaroo/mockaroo.go@@ -83,8 +83,8 @@ func (s Scanner) Type() detectorspb.DetectorType {type typeRes struct {Types []struct {- Name string `json:"name"`- Type interface{} `json:"type"`- Parameters []interface{} `json:"parameters"`+ Name string `json:"name"`+ Type any `json:"type"`+ Parameters []any `json:"parameters"`} `json:"types"`}diff --git a/pkg/detectors/privatekey/cracker.go b/pkg/detectors/privatekey/cracker.goindex 1f79c2acd..b0744643b 100644--- a/pkg/detectors/privatekey/cracker.go+++ b/pkg/detectors/privatekey/cracker.go@@ -21,7 +21,7 @@ var (ErrUncrackable = errors.New("unable to crack encryption"))-func crack(in []byte) (interface{}, string, error) {+func crack(in []byte) (any, string, error) {for _, passphrase := range passphrases {parsed, err := ssh.ParseRawPrivateKeyWithPassphrase(in, passphrase)if err != nil {diff --git a/pkg/engine/engine.go b/pkg/engine/engine.goindex 4084fd2a3..ff6167905 100644--- a/pkg/engine/engine.go+++ b/pkg/engine/engine.go@@ -239,7 +239,7 @@ func (m *Metrics) getScanDuration() time.Duration {func (e *Engine) DetectorAvgTime() map[string][]time.Duration {logger := context.Background().Logger()avgTime := map[string][]time.Duration{}- e.metrics.detectorAvgTime.Range(func(k, v interface{}) bool {+ e.metrics.detectorAvgTime.Range(func(k, v any) bool {key, ok := k.(string)if !ok {logger.Info("expected detectorAvgTime key to be a string")diff --git a/pkg/output/plain.go b/pkg/output/plain.goindex 9629e4393..4dc2c0a27 100644--- a/pkg/output/plain.go+++ b/pkg/output/plain.go@@ -76,7 +76,7 @@ func (p *PlainPrinter) Print(_ context.Context, r *detectors.ResultWithMetadata)}}- aggregateData := make(map[string]interface{})+ aggregateData := make(map[string]any)var aggregateDataKeys []stringfor _, data := range meta {@@ -93,7 +93,7 @@ func (p *PlainPrinter) Print(_ context.Context, r *detectors.ResultWithMetadata)return nil}-func structToMap(obj interface{}) (m map[string]map[string]interface{}, err error) {+func structToMap(obj any) (m map[string]map[string]any, err error) {data, err := json.Marshal(obj)if err != nil {returndiff --git a/pkg/sources/github/github_test.go b/pkg/sources/github/github_test.goindex 4f5b51294..3dd03a0f6 100644--- a/pkg/sources/github/github_test.go+++ b/pkg/sources/github/github_test.go@@ -190,13 +190,13 @@ func TestAddMembersByApp(t *testing.T) {gock.New("https://api.github.com").Get("/app/installations").Reply(200).- JSON([]map[string]interface{}{+ JSON([]map[string]any{{"account": map[string]string{"login": "super-secret-org", "type": "Organization"}},})gock.New("https://api.github.com").Get("/orgs/super-secret-org/members").Reply(200).- JSON([]map[string]interface{}{+ JSON([]map[string]any{{"login": "ssm1"},{"login": "ssm2"},{"login": "ssm3"},@@ -221,7 +221,7 @@ func TestAddReposByApp(t *testing.T) {gock.New("https://api.github.com").Get("/installation/repositories").Reply(200).- JSON(map[string]interface{}{+ JSON(map[string]any{"repositories": []map[string]string{{"clone_url": "https://github/ssr1.git", "full_name": "ssr1"},{"clone_url": "https://github/ssr2.git", "full_name": "ssr2"},@@ -247,7 +247,7 @@ func TestAddOrgsByUser(t *testing.T) {gock.New("https://api.github.com").Get("/user/orgs").Reply(200).- JSON([]map[string]interface{}{+ JSON([]map[string]any{{"login": "sso2"},})diff --git a/pkg/sources/mock_job_progress_test.go b/pkg/sources/mock_job_progress_test.goindex de3e608fc..b0d051391 100644--- a/pkg/sources/mock_job_progress_test.go+++ b/pkg/sources/mock_job_progress_test.go@@ -41,7 +41,7 @@ func (m *MockJobProgressHook) End(arg0 JobProgressRef, arg1 time.Time) {}// End indicates an expected call of End.-func (mr *MockJobProgressHookMockRecorder) End(arg0, arg1 interface{}) *gomock.Call {+func (mr *MockJobProgressHookMockRecorder) End(arg0, arg1 any) *gomock.Call {mr.mock.ctrl.T.Helper()return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "End", reflect.TypeOf((*MockJobProgressHook)(nil).End), arg0, arg1)}@@ -53,7 +53,7 @@ func (m *MockJobProgressHook) EndEnumerating(arg0 JobProgressRef, arg1 time.Time}// EndEnumerating indicates an expected call of EndEnumerating.-func (mr *MockJobProgressHookMockRecorder) EndEnumerating(arg0, arg1 interface{}) *gomock.Call {+func (mr *MockJobProgressHookMockRecorder) EndEnumerating(arg0, arg1 any) *gomock.Call {mr.mock.ctrl.T.Helper()return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EndEnumerating", reflect.TypeOf((*MockJobProgressHook)(nil).EndEnumerating), arg0, arg1)}@@ -65,7 +65,7 @@ func (m *MockJobProgressHook) EndUnitChunking(arg0 JobProgressRef, arg1 SourceUn}// EndUnitChunking indicates an expected call of EndUnitChunking.-func (mr *MockJobProgressHookMockRecorder) EndUnitChunking(arg0, arg1, arg2 interface{}) *gomock.Call {+func (mr *MockJobProgressHookMockRecorder) EndUnitChunking(arg0, arg1, arg2 any) *gomock.Call {mr.mock.ctrl.T.Helper()return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EndUnitChunking", reflect.TypeOf((*MockJobProgressHook)(nil).EndUnitChunking), arg0, arg1, arg2)}@@ -77,7 +77,7 @@ func (m *MockJobProgressHook) Finish(arg0 JobProgressRef) {}// Finish indicates an expected call of Finish.-func (mr *MockJobProgressHookMockRecorder) Finish(arg0 interface{}) *gomock.Call {+func (mr *MockJobProgressHookMockRecorder) Finish(arg0 any) *gomock.Call {mr.mock.ctrl.T.Helper()return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Finish", reflect.TypeOf((*MockJobProgressHook)(nil).Finish), arg0)}@@ -89,7 +89,7 @@ func (m *MockJobProgressHook) ReportChunk(arg0 JobProgressRef, arg1 SourceUnit,}// ReportChunk indicates an expected call of ReportChunk.-func (mr *MockJobProgressHookMockRecorder) ReportChunk(arg0, arg1, arg2 interface{}) *gomock.Call {+func (mr *MockJobProgressHookMockRecorder) ReportChunk(arg0, arg1, arg2 any) *gomock.Call {mr.mock.ctrl.T.Helper()return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReportChunk", reflect.TypeOf((*MockJobProgressHook)(nil).ReportChunk), arg0, arg1, arg2)}@@ -101,7 +101,7 @@ func (m *MockJobProgressHook) ReportError(arg0 JobProgressRef, arg1 error) {}// ReportError indicates an expected call of ReportError.-func (mr *MockJobProgressHookMockRecorder) ReportError(arg0, arg1 interface{}) *gomock.Call {+func (mr *MockJobProgressHookMockRecorder) ReportError(arg0, arg1 any) *gomock.Call {mr.mock.ctrl.T.Helper()return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReportError", reflect.TypeOf((*MockJobProgressHook)(nil).ReportError), arg0, arg1)}@@ -113,7 +113,7 @@ func (m *MockJobProgressHook) ReportUnit(arg0 JobProgressRef, arg1 SourceUnit) {}// ReportUnit indicates an expected call of ReportUnit.-func (mr *MockJobProgressHookMockRecorder) ReportUnit(arg0, arg1 interface{}) *gomock.Call {+func (mr *MockJobProgressHookMockRecorder) ReportUnit(arg0, arg1 any) *gomock.Call {mr.mock.ctrl.T.Helper()return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReportUnit", reflect.TypeOf((*MockJobProgressHook)(nil).ReportUnit), arg0, arg1)}@@ -125,7 +125,7 @@ func (m *MockJobProgressHook) Start(arg0 JobProgressRef, arg1 time.Time) {}// Start indicates an expected call of Start.-func (mr *MockJobProgressHookMockRecorder) Start(arg0, arg1 interface{}) *gomock.Call {+func (mr *MockJobProgressHookMockRecorder) Start(arg0, arg1 any) *gomock.Call {mr.mock.ctrl.T.Helper()return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Start", reflect.TypeOf((*MockJobProgressHook)(nil).Start), arg0, arg1)}@@ -137,7 +137,7 @@ func (m *MockJobProgressHook) StartEnumerating(arg0 JobProgressRef, arg1 time.Ti}// StartEnumerating indicates an expected call of StartEnumerating.-func (mr *MockJobProgressHookMockRecorder) StartEnumerating(arg0, arg1 interface{}) *gomock.Call {+func (mr *MockJobProgressHookMockRecorder) StartEnumerating(arg0, arg1 any) *gomock.Call {mr.mock.ctrl.T.Helper()return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StartEnumerating", reflect.TypeOf((*MockJobProgressHook)(nil).StartEnumerating), arg0, arg1)}@@ -149,7 +149,7 @@ func (m *MockJobProgressHook) StartUnitChunking(arg0 JobProgressRef, arg1 Source}// StartUnitChunking indicates an expected call of StartUnitChunking.-func (mr *MockJobProgressHookMockRecorder) StartUnitChunking(arg0, arg1, arg2 interface{}) *gomock.Call {+func (mr *MockJobProgressHookMockRecorder) StartUnitChunking(arg0, arg1, arg2 any) *gomock.Call {mr.mock.ctrl.T.Helper()return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StartUnitChunking", reflect.TypeOf((*MockJobProgressHook)(nil).StartUnitChunking), arg0, arg1, arg2)}