@@ -30,7 +30,21 @@ import (
30
30
"github.com/trufflesecurity/trufflehog/v3/pkg/context"
31
31
"github.com/trufflesecurity/trufflehog/v3/pkg/detectors"
32
32
"github.com/trufflesecurity/trufflehog/v3/pkg/engine"
33
+ "github.com/trufflesecurity/trufflehog/v3/pkg/engine/circleci"
33
34
"github.com/trufflesecurity/trufflehog/v3/pkg/engine/defaults"
35
+ "github.com/trufflesecurity/trufflehog/v3/pkg/engine/docker"
36
+ "github.com/trufflesecurity/trufflehog/v3/pkg/engine/elasticsearch"
37
+ "github.com/trufflesecurity/trufflehog/v3/pkg/engine/filesystem"
38
+ "github.com/trufflesecurity/trufflehog/v3/pkg/engine/gcs"
39
+ "github.com/trufflesecurity/trufflehog/v3/pkg/engine/git"
40
+ "github.com/trufflesecurity/trufflehog/v3/pkg/engine/github"
41
+ "github.com/trufflesecurity/trufflehog/v3/pkg/engine/gitlab"
42
+ "github.com/trufflesecurity/trufflehog/v3/pkg/engine/huggingface"
43
+ "github.com/trufflesecurity/trufflehog/v3/pkg/engine/jenkins"
44
+ "github.com/trufflesecurity/trufflehog/v3/pkg/engine/postman"
45
+ "github.com/trufflesecurity/trufflehog/v3/pkg/engine/s3"
46
+ "github.com/trufflesecurity/trufflehog/v3/pkg/engine/syslog"
47
+ "github.com/trufflesecurity/trufflehog/v3/pkg/engine/travisci"
34
48
"github.com/trufflesecurity/trufflehog/v3/pkg/feature"
35
49
"github.com/trufflesecurity/trufflehog/v3/pkg/handlers"
36
50
"github.com/trufflesecurity/trufflehog/v3/pkg/log"
@@ -704,7 +718,7 @@ func runSingleScan(ctx context.Context, cmd string, cfg engine.Config) (metrics,
704
718
Bare : * gitScanBare ,
705
719
ExcludeGlobs : * gitScanExcludeGlobs ,
706
720
}
707
- if ref , err = eng . ScanGit (ctx , gitCfg ); err != nil {
721
+ if ref , err = git . Scan (ctx , gitCfg , eng ); err != nil {
708
722
return scanMetrics , fmt .Errorf ("failed to scan Git: %v" , err )
709
723
}
710
724
case githubScan .FullCommand ():
@@ -733,7 +747,7 @@ func runSingleScan(ctx context.Context, cmd string, cfg engine.Config) (metrics,
733
747
CommentsTimeframeDays : * githubCommentsTimeframeDays ,
734
748
Filter : filter ,
735
749
}
736
- if ref , err = eng . ScanGitHub (ctx , cfg ); err != nil {
750
+ if ref , err = github . Scan (ctx , cfg , eng ); err != nil {
737
751
return scanMetrics , fmt .Errorf ("failed to scan Github: %v" , err )
738
752
}
739
753
case githubExperimentalScan .FullCommand ():
@@ -744,7 +758,7 @@ func runSingleScan(ctx context.Context, cmd string, cfg engine.Config) (metrics,
744
758
CollisionThreshold : * githubExperimentalCollisionThreshold ,
745
759
DeleteCachedData : * githubExperimentalDeleteCache ,
746
760
}
747
- if ref , err = eng . ScanGitHubExperimental (ctx , cfg ); err != nil {
761
+ if ref , err = github . ScanExperimental (ctx , cfg , eng ); err != nil {
748
762
return scanMetrics , fmt .Errorf ("failed to scan using Github Experimental: %v" , err )
749
763
}
750
764
case gitlabScan .FullCommand ():
@@ -761,7 +775,7 @@ func runSingleScan(ctx context.Context, cmd string, cfg engine.Config) (metrics,
761
775
ExcludeRepos : * gitlabScanExcludeRepos ,
762
776
Filter : filter ,
763
777
}
764
- if ref , err = eng . ScanGitLab (ctx , cfg ); err != nil {
778
+ if ref , err = gitlab . Scan (ctx , cfg , eng ); err != nil {
765
779
return scanMetrics , fmt .Errorf ("failed to scan GitLab: %v" , err )
766
780
}
767
781
case filesystemScan .FullCommand ():
@@ -776,7 +790,7 @@ func runSingleScan(ctx context.Context, cmd string, cfg engine.Config) (metrics,
776
790
IncludePathsFile : * filesystemScanIncludePaths ,
777
791
ExcludePathsFile : * filesystemScanExcludePaths ,
778
792
}
779
- if ref , err = eng . ScanFileSystem (ctx , cfg ); err != nil {
793
+ if ref , err = filesystem . Scan (ctx , cfg , eng ); err != nil {
780
794
return scanMetrics , fmt .Errorf ("failed to scan filesystem: %v" , err )
781
795
}
782
796
case s3Scan .FullCommand ():
@@ -790,7 +804,7 @@ func runSingleScan(ctx context.Context, cmd string, cfg engine.Config) (metrics,
790
804
CloudCred : * s3ScanCloudEnv ,
791
805
MaxObjectSize : int64 (* s3ScanMaxObjectSize ),
792
806
}
793
- if ref , err = eng . ScanS3 (ctx , cfg ); err != nil {
807
+ if ref , err = s3 . Scan (ctx , cfg , eng ); err != nil {
794
808
return scanMetrics , fmt .Errorf ("failed to scan S3: %v" , err )
795
809
}
796
810
case syslogScan .FullCommand ():
@@ -802,15 +816,15 @@ func runSingleScan(ctx context.Context, cmd string, cfg engine.Config) (metrics,
802
816
KeyPath : * syslogTLSKey ,
803
817
Concurrency : * concurrency ,
804
818
}
805
- if ref , err = eng . ScanSyslog (ctx , cfg ); err != nil {
819
+ if ref , err = syslog . Scan (ctx , cfg , eng ); err != nil {
806
820
return scanMetrics , fmt .Errorf ("failed to scan syslog: %v" , err )
807
821
}
808
822
case circleCiScan .FullCommand ():
809
- if ref , err = eng . ScanCircleCI (ctx , * circleCiScanToken ); err != nil {
823
+ if ref , err = circleci . Scan (ctx , * circleCiScanToken , eng ); err != nil {
810
824
return scanMetrics , fmt .Errorf ("failed to scan CircleCI: %v" , err )
811
825
}
812
826
case travisCiScan .FullCommand ():
813
- if ref , err = eng . ScanTravisCI (ctx , * travisCiScanToken ); err != nil {
827
+ if ref , err = travisci . Scan (ctx , * travisCiScanToken , eng ); err != nil {
814
828
return scanMetrics , fmt .Errorf ("failed to scan TravisCI: %v" , err )
815
829
}
816
830
case gcsScan .FullCommand ():
@@ -827,7 +841,7 @@ func runSingleScan(ctx context.Context, cmd string, cfg engine.Config) (metrics,
827
841
Concurrency : * concurrency ,
828
842
MaxObjectSize : int64 (* gcsMaxObjectSize ),
829
843
}
830
- if ref , err = eng . ScanGCS (ctx , cfg ); err != nil {
844
+ if ref , err = gcs . Scan (ctx , cfg , eng ); err != nil {
831
845
return scanMetrics , fmt .Errorf ("failed to scan GCS: %v" , err )
832
846
}
833
847
case dockerScan .FullCommand ():
@@ -836,7 +850,7 @@ func runSingleScan(ctx context.Context, cmd string, cfg engine.Config) (metrics,
836
850
Images : * dockerScanImages ,
837
851
UseDockerKeychain : * dockerScanToken == "" ,
838
852
}
839
- if ref , err = eng . ScanDocker (ctx , cfg ); err != nil {
853
+ if ref , err = docker . Scan (ctx , cfg , eng ); err != nil {
840
854
return scanMetrics , fmt .Errorf ("failed to scan Docker: %v" , err )
841
855
}
842
856
case postmanScan .FullCommand ():
@@ -873,7 +887,7 @@ func runSingleScan(ctx context.Context, cmd string, cfg engine.Config) (metrics,
873
887
WorkspacePaths : * postmanWorkspacePaths ,
874
888
EnvironmentPaths : * postmanEnvironmentPaths ,
875
889
}
876
- if ref , err = eng . ScanPostman (ctx , cfg ); err != nil {
890
+ if ref , err = postman . Scan (ctx , cfg , eng ); err != nil {
877
891
return scanMetrics , fmt .Errorf ("failed to scan Postman: %v" , err )
878
892
}
879
893
case elasticsearchScan .FullCommand ():
@@ -889,17 +903,17 @@ func runSingleScan(ctx context.Context, cmd string, cfg engine.Config) (metrics,
889
903
SinceTimestamp : * elasticsearchSinceTimestamp ,
890
904
BestEffortScan : * elasticsearchBestEffortScan ,
891
905
}
892
- if ref , err = eng . ScanElasticsearch (ctx , cfg ); err != nil {
906
+ if ref , err = elasticsearch . Scan (ctx , cfg , eng ); err != nil {
893
907
return scanMetrics , fmt .Errorf ("failed to scan Elasticsearch: %v" , err )
894
908
}
895
909
case jenkinsScan .FullCommand ():
896
- cfg := engine .JenkinsConfig {
910
+ cfg := sources .JenkinsConfig {
897
911
Endpoint : * jenkinsURL ,
898
912
InsecureSkipVerifyTLS : * jenkinsInsecureSkipVerifyTLS ,
899
913
Username : * jenkinsUsername ,
900
914
Password : * jenkinsPassword ,
901
915
}
902
- if ref , err = eng . ScanJenkins (ctx , cfg ); err != nil {
916
+ if ref , err = jenkins . Scan (ctx , cfg , eng ); err != nil {
903
917
return scanMetrics , fmt .Errorf ("failed to scan Jenkins: %v" , err )
904
918
}
905
919
case huggingfaceScan .FullCommand ():
@@ -911,7 +925,7 @@ func runSingleScan(ctx context.Context, cmd string, cfg engine.Config) (metrics,
911
925
return scanMetrics , fmt .Errorf ("invalid config: you must specify at least one organization, user, model, space or dataset" )
912
926
}
913
927
914
- cfg := engine .HuggingfaceConfig {
928
+ cfg := sources .HuggingfaceConfig {
915
929
Endpoint : * huggingfaceEndpoint ,
916
930
Models : * huggingfaceModels ,
917
931
Spaces : * huggingfaceSpaces ,
@@ -932,7 +946,7 @@ func runSingleScan(ctx context.Context, cmd string, cfg engine.Config) (metrics,
932
946
IncludePrs : * huggingfaceIncludePrs ,
933
947
Concurrency : * concurrency ,
934
948
}
935
- if ref , err = eng . ScanHuggingface (ctx , cfg ); err != nil {
949
+ if ref , err = huggingface . Scan (ctx , cfg , eng ); err != nil {
936
950
return scanMetrics , fmt .Errorf ("failed to scan HuggingFace: %v" , err )
937
951
}
938
952
default :
0 commit comments