Skip to content

Find, verify, and analyze leaked credentials

add proto fields for Git (#2104)

ahravfd33198ad8fa
diff --git a/pkg/pb/sourcespb/sources.pb.go b/pkg/pb/sourcespb/sources.pb.go
index 647678c5f..439d7219c 100644
--- a/pkg/pb/sourcespb/sources.pb.go
+++ b/pkg/pb/sourcespb/sources.pb.go
@@ -1290,12 +1290,17 @@ type Git struct {
// *Git_BasicAuth
// *Git_Unauthenticated
// *Git_SshAuth
- Credential isGit_Credential `protobuf_oneof:"credential"`
- Directories []string `protobuf:"bytes,3,rep,name=directories,proto3" json:"directories,omitempty"`
- Repositories []string `protobuf:"bytes,4,rep,name=repositories,proto3" json:"repositories,omitempty"`
- Head string `protobuf:"bytes,6,opt,name=head,proto3" json:"head,omitempty"`
- Base string `protobuf:"bytes,7,opt,name=base,proto3" json:"base,omitempty"`
- Bare bool `protobuf:"varint,8,opt,name=bare,proto3" json:"bare,omitempty"`
+ Credential isGit_Credential `protobuf_oneof:"credential"`
+ Directories []string `protobuf:"bytes,3,rep,name=directories,proto3" json:"directories,omitempty"`
+ Repositories []string `protobuf:"bytes,4,rep,name=repositories,proto3" json:"repositories,omitempty"`
+ Head string `protobuf:"bytes,6,opt,name=head,proto3" json:"head,omitempty"`
+ Base string `protobuf:"bytes,7,opt,name=base,proto3" json:"base,omitempty"`
+ Bare bool `protobuf:"varint,8,opt,name=bare,proto3" json:"bare,omitempty"`
+ IncludePathsFile string `protobuf:"bytes,9,opt,name=include_paths_file,json=includePathsFile,proto3" json:"include_paths_file,omitempty"` // path to file containing newline separated list of paths
+ ExcludePathsFile string `protobuf:"bytes,10,opt,name=exclude_paths_file,json=excludePathsFile,proto3" json:"exclude_paths_file,omitempty"` // path to file containing newline separated list of paths
+ ExcludeGlobs string `protobuf:"bytes,11,opt,name=exclude_globs,json=excludeGlobs,proto3" json:"exclude_globs,omitempty"` // comma separated list of globs
+ MaxDepth int64 `protobuf:"varint,12,opt,name=max_depth,json=maxDepth,proto3" json:"max_depth,omitempty"`
+ Uri string `protobuf:"bytes,13,opt,name=uri,proto3" json:"uri,omitempty"` // repository URL. https://, file://, or ssh://
}
func (x *Git) Reset() {
@@ -1393,6 +1398,41 @@ func (x *Git) GetBare() bool {
return false
}
+func (x *Git) GetIncludePathsFile() string {
+ if x != nil {
+ return x.IncludePathsFile
+ }
+ return ""
+}
+
+func (x *Git) GetExcludePathsFile() string {
+ if x != nil {
+ return x.ExcludePathsFile
+ }
+ return ""
+}
+
+func (x *Git) GetExcludeGlobs() string {
+ if x != nil {
+ return x.ExcludeGlobs
+ }
+ return ""
+}
+
+func (x *Git) GetMaxDepth() int64 {
+ if x != nil {
+ return x.MaxDepth
+ }
+ return 0
+}
+
+func (x *Git) GetUri() string {
+ if x != nil {
+ return x.Uri
+ }
+ return ""
+}
+
type isGit_Credential interface {
isGit_Credential()
}
@@ -3495,7 +3535,7 @@ var file_sources_proto_rawDesc = []byte{
0x0f, 0x6d, 0x61, 0x78, 0x5f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x73, 0x69, 0x7a, 0x65,
0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x6d, 0x61, 0x78, 0x4f, 0x62, 0x6a, 0x65, 0x63,
0x74, 0x53, 0x69, 0x7a, 0x65, 0x42, 0x0c, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74,
- 0x69, 0x61, 0x6c, 0x22, 0xcb, 0x02, 0x0a, 0x03, 0x47, 0x69, 0x74, 0x12, 0x37, 0x0a, 0x0a, 0x62,
+ 0x69, 0x61, 0x6c, 0x22, 0xfb, 0x03, 0x0a, 0x03, 0x47, 0x69, 0x74, 0x12, 0x37, 0x0a, 0x0a, 0x62,
0x61, 0x73, 0x69, 0x63, 0x5f, 0x61, 0x75, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x16, 0x2e, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x2e, 0x42, 0x61,
0x73, 0x69, 0x63, 0x41, 0x75, 0x74, 0x68, 0x48, 0x00, 0x52, 0x09, 0x62, 0x61, 0x73, 0x69, 0x63,
@@ -3515,7 +3555,18 @@ var file_sources_proto_rawDesc = []byte{
0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x65, 0x61, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x62,
0x61, 0x73, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x62, 0x61, 0x73, 0x65, 0x12,
0x12, 0x0a, 0x04, 0x62, 0x61, 0x72, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x62,
- 0x61, 0x72, 0x65, 0x42, 0x0c, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61,
+ 0x61, 0x72, 0x65, 0x12, 0x2c, 0x0a, 0x12, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x70,
+ 0x61, 0x74, 0x68, 0x73, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x10, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x50, 0x61, 0x74, 0x68, 0x73, 0x46, 0x69, 0x6c,
+ 0x65, 0x12, 0x2c, 0x0a, 0x12, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x70, 0x61, 0x74,
+ 0x68, 0x73, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x65,
+ 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x50, 0x61, 0x74, 0x68, 0x73, 0x46, 0x69, 0x6c, 0x65, 0x12,
+ 0x23, 0x0a, 0x0d, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x67, 0x6c, 0x6f, 0x62, 0x73,
+ 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x47,
+ 0x6c, 0x6f, 0x62, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x78, 0x5f, 0x64, 0x65, 0x70, 0x74,
+ 0x68, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x44, 0x65, 0x70, 0x74,
+ 0x68, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x69, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03,
+ 0x75, 0x72, 0x69, 0x42, 0x0c, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61,
0x6c, 0x22, 0x81, 0x02, 0x0a, 0x06, 0x47, 0x69, 0x74, 0x4c, 0x61, 0x62, 0x12, 0x24, 0x0a, 0x08,
0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x08,
0xfa, 0x42, 0x05, 0x72, 0x03, 0x90, 0x01, 0x01, 0x52, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69,
diff --git a/pkg/pb/sourcespb/sources.pb.validate.go b/pkg/pb/sourcespb/sources.pb.validate.go
index 7831779a7..b5532f6ba 100644
--- a/pkg/pb/sourcespb/sources.pb.validate.go
+++ b/pkg/pb/sourcespb/sources.pb.validate.go
@@ -1612,6 +1612,16 @@ func (m *Git) validate(all bool) error {
// no validation rules for Bare
+ // no validation rules for IncludePathsFile
+
+ // no validation rules for ExcludePathsFile
+
+ // no validation rules for ExcludeGlobs
+
+ // no validation rules for MaxDepth
+
+ // no validation rules for Uri
+
switch m.Credential.(type) {
case *Git_BasicAuth:
diff --git a/proto/sources.proto b/proto/sources.proto
index ec67d5a1a..148cc6751 100644
--- a/proto/sources.proto
+++ b/proto/sources.proto
@@ -172,6 +172,15 @@ message Git {
string head = 6;
string base = 7;
bool bare = 8;
+ string include_paths_file = 9; // path to file containing newline separated list of paths
+ string exclude_paths_file = 10; // path to file containing newline separated list of paths
+ string exclude_globs = 11; // comma separated list of globs
+ int64 max_depth = 12;
+ // This field is generally used by the CLI or within CI/CD systems to specify a single repository,
+ // whereas the repositories field is used by the enterprise config to specify multiple repositories.
+ // Passing a single repository via the uri field also allows for additional options to be specified
+ // like head, base, bare, etc.
+ string uri = 13; // repository URL. https://, file://, or ssh://
}
message GitLab {