Skip to content

Find, verify, and analyze leaked credentials

Add scan_all_installations option for multi-org GitHub App scanning (#4775)

Dustin Decker39a1435e800f
diff --git a/pkg/pb/sourcespb/sources.pb.go b/pkg/pb/sourcespb/sources.pb.go
index 5483055f8..26c063ec3 100644
--- a/pkg/pb/sourcespb/sources.pb.go
+++ b/pkg/pb/sourcespb/sources.pb.go
@@ -2107,6 +2107,8 @@ type GitHub struct {
NoCleanup bool `protobuf:"varint,23,opt,name=no_cleanup,json=noCleanup,proto3" json:"no_cleanup,omitempty"`
IgnoreGists bool `protobuf:"varint,24,opt,name=ignore_gists,json=ignoreGists,proto3" json:"ignore_gists,omitempty"`
PrintLegacyJson bool `protobuf:"varint,25,opt,name=print_legacy_json,json=printLegacyJson,proto3" json:"print_legacy_json,omitempty"`
+ // When using GitHub App credentials, enumerate repositories from every app installation.
+ ScanAllInstallations bool `protobuf:"varint,26,opt,name=scan_all_installations,json=scanAllInstallations,proto3" json:"scan_all_installations,omitempty"`
}
func (x *GitHub) Reset() {
@@ -2323,6 +2325,13 @@ func (x *GitHub) GetPrintLegacyJson() bool {
return false
}
+func (x *GitHub) GetScanAllInstallations() bool {
+ if x != nil {
+ return x.ScanAllInstallations
+ }
+ return false
+}
+
type isGitHub_Credential interface {
isGitHub_Credential()
}
@@ -5477,7 +5486,7 @@ var file_sources_proto_rawDesc = []byte{
0x70, 0x12, 0x2a, 0x0a, 0x11, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x5f, 0x6c, 0x65, 0x67, 0x61, 0x63,
0x79, 0x5f, 0x6a, 0x73, 0x6f, 0x6e, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x70, 0x72,
0x69, 0x6e, 0x74, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x4a, 0x73, 0x6f, 0x6e, 0x42, 0x0c, 0x0a,
- 0x0a, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x22, 0x9a, 0x08, 0x0a, 0x06,
+ 0x0a, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x22, 0xd0, 0x08, 0x0a, 0x06,
0x47, 0x69, 0x74, 0x48, 0x75, 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, 0x6e, 0x74, 0x12, 0x37, 0x0a, 0x0a,
@@ -5542,525 +5551,528 @@ var file_sources_proto_rawDesc = []byte{
0x08, 0x52, 0x0b, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x47, 0x69, 0x73, 0x74, 0x73, 0x12, 0x2a,
0x0a, 0x11, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x5f, 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x5f, 0x6a,
0x73, 0x6f, 0x6e, 0x18, 0x19, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x70, 0x72, 0x69, 0x6e, 0x74,
- 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x4a, 0x73, 0x6f, 0x6e, 0x42, 0x0c, 0x0a, 0x0a, 0x63, 0x72,
- 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x22, 0xe4, 0x01, 0x0a, 0x12, 0x47, 0x69, 0x74,
- 0x48, 0x75, 0x62, 0x45, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x6c, 0x12,
- 0x1e, 0x0a, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x01, 0x20,
- 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x12,
- 0x16, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00,
- 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x29, 0x0a, 0x10, 0x6f, 0x62, 0x6a, 0x65, 0x63,
- 0x74, 0x5f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28,
- 0x08, 0x52, 0x0f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65,
- 0x72, 0x79, 0x12, 0x2f, 0x0a, 0x13, 0x63, 0x6f, 0x6c, 0x6c, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x5f,
- 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52,
- 0x12, 0x63, 0x6f, 0x6c, 0x6c, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x68, 0x72, 0x65, 0x73, 0x68,
- 0x6f, 0x6c, 0x64, 0x12, 0x2c, 0x0a, 0x12, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x5f, 0x63, 0x61,
- 0x63, 0x68, 0x65, 0x64, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52,
- 0x10, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x43, 0x61, 0x63, 0x68, 0x65, 0x64, 0x44, 0x61, 0x74,
- 0x61, 0x42, 0x0c, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x22,
- 0xe4, 0x02, 0x0a, 0x0e, 0x47, 0x69, 0x74, 0x48, 0x75, 0x62, 0x52, 0x65, 0x61, 0x6c, 0x74, 0x69,
- 0x6d, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x6c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x65, 0x72, 0x5f, 0x70,
- 0x6f, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0c, 0x6c, 0x69, 0x73, 0x74, 0x65,
- 0x6e, 0x65, 0x72, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x77, 0x65, 0x62, 0x68, 0x6f,
- 0x6f, 0x6b, 0x5f, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
- 0x0d, 0x77, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, 0x24,
- 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
- 0x42, 0x08, 0xfa, 0x42, 0x05, 0x72, 0x03, 0x90, 0x01, 0x01, 0x52, 0x08, 0x65, 0x6e, 0x64, 0x70,
- 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x37, 0x0a, 0x0a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x5f, 0x61,
- 0x70, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x63, 0x72, 0x65, 0x64, 0x65,
- 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x2e, 0x47, 0x69, 0x74, 0x48, 0x75, 0x62, 0x41, 0x70, 0x70,
- 0x48, 0x00, 0x52, 0x09, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x41, 0x70, 0x70, 0x12, 0x16, 0x0a,
- 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05,
- 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x48, 0x0a, 0x0f, 0x75, 0x6e, 0x61, 0x75, 0x74, 0x68, 0x65,
- 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c,
- 0x2e, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x2e, 0x55, 0x6e, 0x61,
- 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x48, 0x00, 0x52, 0x0f,
- 0x75, 0x6e, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12,
- 0x37, 0x0a, 0x0a, 0x62, 0x61, 0x73, 0x69, 0x63, 0x5f, 0x61, 0x75, 0x74, 0x68, 0x18, 0x07, 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, 0x41, 0x75, 0x74, 0x68, 0x42, 0x0c, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x64,
- 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x22, 0xce, 0x01, 0x0a, 0x0b, 0x47, 0x6f, 0x6f, 0x67, 0x6c,
- 0x65, 0x44, 0x72, 0x69, 0x76, 0x65, 0x12, 0x25, 0x0a, 0x0d, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73,
- 0x68, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52,
- 0x0c, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x2c, 0x0a,
- 0x11, 0x75, 0x73, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69,
- 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x0f, 0x75, 0x73, 0x65, 0x54,
- 0x6f, 0x6b, 0x65, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x2b, 0x0a, 0x05, 0x6f,
- 0x61, 0x75, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x63, 0x72, 0x65,
- 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x2e, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x48,
- 0x00, 0x52, 0x05, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x12, 0x2f, 0x0a, 0x03, 0x64, 0x77, 0x64, 0x18,
- 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69,
- 0x61, 0x6c, 0x73, 0x2e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x44, 0x72, 0x69, 0x76, 0x65, 0x44,
- 0x57, 0x44, 0x48, 0x00, 0x52, 0x03, 0x64, 0x77, 0x64, 0x42, 0x0c, 0x0a, 0x0a, 0x63, 0x72, 0x65,
- 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x22, 0xf9, 0x06, 0x0a, 0x0b, 0x48, 0x75, 0x67, 0x67,
- 0x69, 0x6e, 0x67, 0x66, 0x61, 0x63, 0x65, 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, 0x6e, 0x74, 0x12, 0x16, 0x0a,
- 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05,
- 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x48, 0x0a, 0x0f, 0x75, 0x6e, 0x61, 0x75, 0x74, 0x68, 0x65,
- 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c,
- 0x2e, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x2e, 0x55, 0x6e, 0x61,
- 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x48, 0x00, 0x52, 0x0f,
- 0x75, 0x6e, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12,
- 0x16, 0x0a, 0x06, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52,
- 0x06, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x70, 0x61, 0x63, 0x65,
- 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x12,
- 0x1a, 0x0a, 0x08, 0x64, 0x61, 0x74, 0x61, 0x73, 0x65, 0x74, 0x73, 0x18, 0x0c, 0x20, 0x03, 0x28,
- 0x09, 0x52, 0x08, 0x64, 0x61, 0x74, 0x61, 0x73, 0x65, 0x74, 0x73, 0x12, 0x24, 0x0a, 0x0d, 0x6f,
- 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x06, 0x20, 0x03,
- 0x28, 0x09, 0x52, 0x0d, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e,
- 0x73, 0x12, 0x14, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x18, 0x0f, 0x20, 0x03, 0x28, 0x09,
- 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x69, 0x67, 0x6e, 0x6f, 0x72,
- 0x65, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c,
- 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x12, 0x25, 0x0a, 0x0e,
- 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x18, 0x08,
- 0x20, 0x03, 0x28, 0x09, 0x52, 0x0d, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x4d, 0x6f, 0x64,
- 0x65, 0x6c, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x5f, 0x73, 0x70,
- 0x61, 0x63, 0x65, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x69, 0x67, 0x6e, 0x6f,
- 0x72, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x69, 0x6e, 0x63, 0x6c,
- 0x75, 0x64, 0x65, 0x5f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x09,
- 0x52, 0x0d, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x73, 0x12,
- 0x27, 0x0a, 0x0f, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x73, 0x65,
- 0x74, 0x73, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65,
- 0x44, 0x61, 0x74, 0x61, 0x73, 0x65, 0x74, 0x73, 0x12, 0x29, 0x0a, 0x10, 0x69, 0x6e, 0x63, 0x6c,
- 0x75, 0x64, 0x65, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x73, 0x65, 0x74, 0x73, 0x18, 0x0e, 0x20, 0x03,
- 0x28, 0x09, 0x52, 0x0f, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x44, 0x61, 0x74, 0x61, 0x73,
- 0x65, 0x74, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x73, 0x6b, 0x69, 0x70, 0x5f, 0x61, 0x6c, 0x6c, 0x5f,
- 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x18, 0x10, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x73, 0x6b,
- 0x69, 0x70, 0x41, 0x6c, 0x6c, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x73,
- 0x6b, 0x69, 0x70, 0x5f, 0x61, 0x6c, 0x6c, 0x5f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x18, 0x11,
- 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x73, 0x6b, 0x69, 0x70, 0x41, 0x6c, 0x6c, 0x53, 0x70, 0x61,
- 0x63, 0x65, 0x73, 0x12, 0x2a, 0x0a, 0x11, 0x73, 0x6b, 0x69, 0x70, 0x5f, 0x61, 0x6c, 0x6c, 0x5f,
- 0x64, 0x61, 0x74, 0x61, 0x73, 0x65, 0x74, 0x73, 0x18, 0x12, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f,
- 0x73, 0x6b, 0x69, 0x70, 0x41, 0x6c, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x73, 0x65, 0x74, 0x73, 0x12,
- 0x2f, 0x0a, 0x13, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x64, 0x69, 0x73, 0x63, 0x75,
- 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x12, 0x69, 0x6e,
- 0x63, 0x6c, 0x75, 0x64, 0x65, 0x44, 0x69, 0x73, 0x63, 0x75, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73,
- 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x70, 0x72, 0x73, 0x18,
- 0x13, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x50, 0x72,
- 0x73, 0x12, 0x18, 0x0a, 0x07, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x18, 0x14, 0x20, 0x03,
- 0x28, 0x09, 0x52, 0x07, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x69,
- 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x5f, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x18, 0x15, 0x20,
- 0x03, 0x28, 0x09, 0x52, 0x0d, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x42, 0x75, 0x63, 0x6b, 0x65,
- 0x74, 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x62, 0x75,
- 0x63, 0x6b, 0x65, 0x74, 0x73, 0x18, 0x16, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x69, 0x6e, 0x63,
- 0x6c, 0x75, 0x64, 0x65, 0x42, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x12, 0x28, 0x0a, 0x10, 0x73,
- 0x6b, 0x69, 0x70, 0x5f, 0x61, 0x6c, 0x6c, 0x5f, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x18,
- 0x17, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x73, 0x6b, 0x69, 0x70, 0x41, 0x6c, 0x6c, 0x42, 0x75,
- 0x63, 0x6b, 0x65, 0x74, 0x73, 0x42, 0x0c, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74,
- 0x69, 0x61, 0x6c, 0x22, 0xcc, 0x03, 0x0a, 0x04, 0x4a, 0x49, 0x52, 0x41, 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,
- 0x6e, 0x74, 0x12, 0x37, 0x0a, 0x0a, 0x62, 0x61, 0x73, 0x69, 0x63, 0x5f, 0x61, 0x75, 0x74, 0x68,
- 0x18, 0x02, 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, 0x41, 0x75, 0x74, 0x68, 0x12, 0x48, 0x0a, 0x0f, 0x75,
+ 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x4a, 0x73, 0x6f, 0x6e, 0x12, 0x34, 0x0a, 0x16, 0x73, 0x63,
+ 0x61, 0x6e, 0x5f, 0x61, 0x6c, 0x6c, 0x5f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x61, 0x74,
+ 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x1a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x14, 0x73, 0x63, 0x61, 0x6e,
+ 0x41, 0x6c, 0x6c, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73,
+ 0x42, 0x0c, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x22, 0xe4,
+ 0x01, 0x0a, 0x12, 0x47, 0x69, 0x74, 0x48, 0x75, 0x62, 0x45, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d,
+ 0x65, 0x6e, 0x74, 0x61, 0x6c, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74,
+ 0x6f, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73,
+ 0x69, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x16, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02,
+ 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x29, 0x0a,
+ 0x10, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72,
+ 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x44,
+ 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x12, 0x2f, 0x0a, 0x13, 0x63, 0x6f, 0x6c, 0x6c,
+ 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x18,
+ 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x12, 0x63, 0x6f, 0x6c, 0x6c, 0x69, 0x73, 0x69, 0x6f, 0x6e,
+ 0x54, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x12, 0x2c, 0x0a, 0x12, 0x64, 0x65, 0x6c,
+ 0x65, 0x74, 0x65, 0x5f, 0x63, 0x61, 0x63, 0x68, 0x65, 0x64, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18,
+ 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x43, 0x61, 0x63,
+ 0x68, 0x65, 0x64, 0x44, 0x61, 0x74, 0x61, 0x42, 0x0c, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x64, 0x65,
+ 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x22, 0xe4, 0x02, 0x0a, 0x0e, 0x47, 0x69, 0x74, 0x48, 0x75, 0x62,
+ 0x52, 0x65, 0x61, 0x6c, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x6c, 0x69, 0x73, 0x74,
+ 0x65, 0x6e, 0x65, 0x72, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52,
+ 0x0c, 0x6c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x65, 0x72, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x25, 0x0a,
+ 0x0e, 0x77, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x5f, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18,
+ 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x77, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x53, 0x65,
+ 0x63, 0x72, 0x65, 0x74, 0x12, 0x24, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74,
+ 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x72, 0x03, 0x90, 0x01, 0x01,
+ 0x52, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x37, 0x0a, 0x0a, 0x67, 0x69,
+ 0x74, 0x68, 0x75, 0x62, 0x5f, 0x61, 0x70, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16,
+ 0x2e, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x2e, 0x47, 0x69, 0x74,
+ 0x48, 0x75, 0x62, 0x41, 0x70, 0x70, 0x48, 0x00, 0x52, 0x09, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62,
+ 0x41, 0x70, 0x70, 0x12, 0x16, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x05, 0x20, 0x01,
+ 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x48, 0x0a, 0x0f, 0x75,
+ 0x6e, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x06,
+ 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61,
+ 0x6c, 0x73, 0x2e, 0x55, 0x6e, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74,
+ 0x65, 0x64, 0x48, 0x00, 0x52, 0x0f, 0x75, 0x6e, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69,
+ 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x37, 0x0a, 0x0a, 0x62, 0x61, 0x73, 0x69, 0x63, 0x5f, 0x61,
+ 0x75, 0x74, 0x68, 0x18, 0x07, 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, 0x41, 0x75, 0x74, 0x68, 0x42, 0x0c,
+ 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x22, 0xce, 0x01, 0x0a,
+ 0x0b, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x44, 0x72, 0x69, 0x76, 0x65, 0x12, 0x25, 0x0a, 0x0d,
+ 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20,
+ 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0c, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x54, 0x6f,
+ 0x6b, 0x65, 0x6e, 0x12, 0x2c, 0x0a, 0x11, 0x75, 0x73, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e,
+ 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00,
+ 0x52, 0x0f, 0x75, 0x73, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63,
+ 0x65, 0x12, 0x2b, 0x0a, 0x05, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b,
+ 0x32, 0x13, 0x2e, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x2e, 0x4f,
+ 0x61, 0x75, 0x74, 0x68, 0x32, 0x48, 0x00, 0x52, 0x05, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x12, 0x2f,
+ 0x0a, 0x03, 0x64, 0x77, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x63, 0x72,
+ 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x2e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
+ 0x44, 0x72, 0x69, 0x76, 0x65, 0x44, 0x57, 0x44, 0x48, 0x00, 0x52, 0x03, 0x64, 0x77, 0x64, 0x42,
+ 0x0c, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x22, 0xf9, 0x06,
+ 0x0a, 0x0b, 0x48, 0x75, 0x67, 0x67, 0x69, 0x6e, 0x67, 0x66, 0x61, 0x63, 0x65, 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, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01,
+ 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x48, 0x0a, 0x0f, 0x75,
0x6e, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x03,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61,
0x6c, 0x73, 0x2e, 0x55, 0x6e, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74,
0x65, 0x64, 0x48, 0x00, 0x52, 0x0f, 0x75, 0x6e, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69,
- 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x2b, 0x0a, 0x05, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x18, 0x04,
- 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61,
- 0x6c, 0x73, 0x2e, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x48, 0x00, 0x52, 0x05, 0x6f, 0x61, 0x75,
- 0x74, 0x68, 0x12, 0x16, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28,
- 0x09, 0x48, 0x00, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72,
- 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x70, 0x72,
- 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65,
- 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52,
- 0x0e, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x12,
- 0x37, 0x0a, 0x18, 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x5f, 0x73, 0x6b, 0x69, 0x70,
- 0x5f, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x74, 0x6c, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28,
- 0x08, 0x52, 0x15, 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x53, 0x6b, 0x69, 0x70, 0x56,
- 0x65, 0x72, 0x69, 0x66, 0x79, 0x54, 0x6c, 0x73, 0x12, 0x4a, 0x0a, 0x11, 0x69, 0x6e, 0x73, 0x74,
- 0x61, 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x09, 0x20,
- 0x01, 0x28, 0x0e, 0x32, 0x1d, 0x2e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x4a, 0x69,
- 0x72, 0x61, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79,
- 0x70, 0x65, 0x52, 0x10, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e,
- 0x54, 0x79, 0x70, 0x65, 0x42, 0x0c, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69,
- 0x61, 0x6c, 0x22, 0x73, 0x0a, 0x19, 0x4e, 0x50, 0x4d, 0x55, 0x6e, 0x61, 0x75, 0x74, 0x68, 0x65,
- 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12,
- 0x48, 0x0a, 0x0f, 0x75, 0x6e, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74,
- 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x72, 0x65, 0x64, 0x65,
- 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x2e, 0x55, 0x6e, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74,
- 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x48, 0x00, 0x52, 0x0f, 0x75, 0x6e, 0x61, 0x75, 0x74, 0x68,
- 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x42, 0x0c, 0x0a, 0x0a, 0x63, 0x72, 0x65,
- 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x22, 0x74, 0x0a, 0x1a, 0x50, 0x79, 0x50, 0x49, 0x55,
+ 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x18,
+ 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x12, 0x16, 0x0a,
+ 0x06, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x73,
+ 0x70, 0x61, 0x63, 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x61, 0x74, 0x61, 0x73, 0x65, 0x74,
+ 0x73, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x64, 0x61, 0x74, 0x61, 0x73, 0x65, 0x74,
+ 0x73, 0x12, 0x24, 0x0a, 0x0d, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f,
+ 0x6e, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0d, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69,
+ 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73,
+ 0x18, 0x0f, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x12, 0x23, 0x0a,
+ 0x0d, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x18, 0x07,
+ 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x4d, 0x6f, 0x64, 0x65,
+ 0x6c, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x6d, 0x6f,
+ 0x64, 0x65, 0x6c, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0d, 0x69, 0x6e, 0x63, 0x6c,
+ 0x75, 0x64, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x69, 0x67, 0x6e,
+ 0x6f, 0x72, 0x65, 0x5f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x09,
+ 0x52, 0x0c, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x73, 0x12, 0x25,
+ 0x0a, 0x0e, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73,
+ 0x18, 0x0a, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0d, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x53,
+ 0x70, 0x61, 0x63, 0x65, 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x5f,
+ 0x64, 0x61, 0x74, 0x61, 0x73, 0x65, 0x74, 0x73, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e,
+ 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x44, 0x61, 0x74, 0x61, 0x73, 0x65, 0x74, 0x73, 0x12, 0x29,
+ 0x0a, 0x10, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x73, 0x65,
+ 0x74, 0x73, 0x18, 0x0e, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64,
+ 0x65, 0x44, 0x61, 0x74, 0x61, 0x73, 0x65, 0x74, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x73, 0x6b, 0x69,
+ 0x70, 0x5f, 0x61, 0x6c, 0x6c, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x18, 0x10, 0x20, 0x01,
+ 0x28, 0x08, 0x52, 0x0d, 0x73, 0x6b, 0x69, 0x70, 0x41, 0x6c, 0x6c, 0x4d, 0x6f, 0x64, 0x65, 0x6c,
+ 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x73, 0x6b, 0x69, 0x70, 0x5f, 0x61, 0x6c, 0x6c, 0x5f, 0x73, 0x70,
+ 0x61, 0x63, 0x65, 0x73, 0x18, 0x11, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x73, 0x6b, 0x69, 0x70,
+ 0x41, 0x6c, 0x6c, 0x53, 0x70, 0x61, 0x63, 0x65, 0x73, 0x12, 0x2a, 0x0a, 0x11, 0x73, 0x6b, 0x69,
+ 0x70, 0x5f, 0x61, 0x6c, 0x6c, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x73, 0x65, 0x74, 0x73, 0x18, 0x12,
+ 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x73, 0x6b, 0x69, 0x70, 0x41, 0x6c, 0x6c, 0x44, 0x61, 0x74,
+ 0x61, 0x73, 0x65, 0x74, 0x73, 0x12, 0x2f, 0x0a, 0x13, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65,
+ 0x5f, 0x64, 0x69, 0x73, 0x63, 0x75, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x0b, 0x20, 0x01,
+ 0x28, 0x08, 0x52, 0x12, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x44, 0x69, 0x73, 0x63, 0x75,
+ 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64,
+ 0x65, 0x5f, 0x70, 0x72, 0x73, 0x18, 0x13, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x69, 0x6e, 0x63,
+ 0x6c, 0x75, 0x64, 0x65, 0x50, 0x72, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x62, 0x75, 0x63, 0x6b, 0x65,
+ 0x74, 0x73, 0x18, 0x14, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74,
+ 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x5f, 0x62, 0x75, 0x63, 0x6b,
+ 0x65, 0x74, 0x73, 0x18, 0x15, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0d, 0x69, 0x67, 0x6e, 0x6f, 0x72,
+ 0x65, 0x42, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x69, 0x6e, 0x63, 0x6c,
+ 0x75, 0x64, 0x65, 0x5f, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x18, 0x16, 0x20, 0x03, 0x28,
+ 0x09, 0x52, 0x0e, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x42, 0x75, 0x63, 0x6b, 0x65, 0x74,
+ 0x73, 0x12, 0x28, 0x0a, 0x10, 0x73, 0x6b, 0x69, 0x70, 0x5f, 0x61, 0x6c, 0x6c, 0x5f, 0x62, 0x75,
+ 0x63, 0x6b, 0x65, 0x74, 0x73, 0x18, 0x17, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x73, 0x6b, 0x69,
+ 0x70, 0x41, 0x6c, 0x6c, 0x42, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x42, 0x0c, 0x0a, 0x0a, 0x63,
+ 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x22, 0xcc, 0x03, 0x0a, 0x04, 0x4a, 0x49,
+ 0x52, 0x41, 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, 0x6e, 0x74, 0x12, 0x37, 0x0a, 0x0a, 0x62, 0x61, 0x73, 0x69,
+ 0x63, 0x5f, 0x61, 0x75, 0x74, 0x68, 0x18, 0x02, 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, 0x41, 0x75, 0x74,
+ 0x68, 0x12, 0x48, 0x0a, 0x0f, 0x75, 0x6e, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63,
+ 0x61, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x72, 0x65,
+ 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x2e, 0x55, 0x6e, 0x61, 0x75, 0x74, 0x68, 0x65,
+ 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x48, 0x00, 0x52, 0x0f, 0x75, 0x6e, 0x61, 0x75,
+ 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x2b, 0x0a, 0x05, 0x6f,
+ 0x61, 0x75, 0x74, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x63, 0x72, 0x65,
+ 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x2e, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x48,
+ 0x00, 0x52, 0x05, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x12, 0x16, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65,
+ 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e,
+ 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x18, 0x05, 0x20, 0x03,
+ 0x28, 0x09, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x12, 0x27, 0x0a, 0x0f,
+ 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x18,
+ 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x50, 0x72, 0x6f,
+ 0x6a, 0x65, 0x63, 0x74, 0x73, 0x12, 0x37, 0x0a, 0x18, 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72,
+ 0x65, 0x5f, 0x73, 0x6b, 0x69, 0x70, 0x5f, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x74, 0x6c,
+ 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x15, 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72,
+ 0x65, 0x53, 0x6b, 0x69, 0x70, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x54, 0x6c, 0x73, 0x12, 0x4a,
+ 0x0a, 0x11, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74,
+ 0x79, 0x70, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1d, 0x2e, 0x73, 0x6f, 0x75, 0x72,
+ 0x63, 0x65, 0x73, 0x2e, 0x4a, 0x69, 0x72, 0x61, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x61,
+ 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x10, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c,
+ 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x42, 0x0c, 0x0a, 0x0a, 0x63, 0x72,
+ 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x22, 0x73, 0x0a, 0x19, 0x4e, 0x50, 0x4d, 0x55,
0x6e, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x50, 0x61,
0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x48, 0x0a, 0x0f, 0x75, 0x6e, 0x61, 0x75, 0x74, 0x68, 0x65,
0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c,
0x2e, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x2e, 0x55, 0x6e, 0x61,
0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x48, 0x00, 0x52, 0x0f,
0x75, 0x6e, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x42,
- 0x0c, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x22, 0xde, 0x03,
- 0x0a, 0x02, 0x53, 0x33, 0x12, 0x37, 0x0a, 0x0a, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x6b,
- 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x63, 0x72, 0x65, 0x64, 0x65,
- 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x2e, 0x4b, 0x65, 0x79, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74,
- 0x48, 0x00, 0x52, 0x09, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4b, 0x65, 0x79, 0x12, 0x48, 0x0a,
+ 0x0c, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x22, 0x74, 0x0a,
+ 0x1a, 0x50, 0x79, 0x50, 0x49, 0x55, 0x6e, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63,
+ 0x61, 0x74, 0x65, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x48, 0x0a, 0x0f, 0x75,
+ 0x6e, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x01,
+ 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61,
+ 0x6c, 0x73, 0x2e, 0x55, 0x6e, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74,
+ 0x65, 0x64, 0x48, 0x00, 0x52, 0x0f, 0x75, 0x6e, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69,
+ 0x63, 0x61, 0x74, 0x65, 0x64, 0x42, 0x0c, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74,
+ 0x69, 0x61, 0x6c, 0x22, 0xde, 0x03, 0x0a, 0x02, 0x53, 0x33, 0x12, 0x37, 0x0a, 0x0a, 0x61, 0x63,
+ 0x63, 0x65, 0x73, 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16,
+ 0x2e, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x2e, 0x4b, 0x65, 0x79,
+ 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x48, 0x00, 0x52, 0x09, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73,
+ 0x4b, 0x65, 0x79, 0x12, 0x48, 0x0a, 0x0f, 0x75, 0x6e, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74,
+ 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63,
+ 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x2e, 0x55, 0x6e, 0x61, 0x75, 0x74,
+ 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x48, 0x00, 0x52, 0x0f, 0x75, 0x6e,
+ 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x4c, 0x0a,
+ 0x11, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x5f, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65,
+ 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x63, 0x72, 0x65, 0x64, 0x65,
+ 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x2e, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x45, 0x6e, 0x76, 0x69,
+ 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x10, 0x63, 0x6c, 0x6f, 0x75, 0x64,
+ 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x49, 0x0a, 0x0d, 0x73,
+ 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x05, 0x20, 0x01,
+ 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73,
+ 0x2e, 0x41, 0x57, 0x53, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e,
+ 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x48, 0x00, 0x52, 0x0c, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f,
+ 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74,
+ 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x73,
+ 0x12, 0x26, 0x0a, 0x0f, 0x6d, 0x61, 0x78, 0x5f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x73,
+ 0x69, 0x7a, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x6d, 0x61, 0x78, 0x4f, 0x62,
+ 0x6a, 0x65, 0x63, 0x74, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x6f, 0x6c, 0x65,
+ 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x72, 0x6f, 0x6c, 0x65, 0x73, 0x12, 0x25,
+ 0x0a, 0x0e, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x5f, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x73,
+ 0x18, 0x08, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0d, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x42, 0x75,
+ 0x63, 0x6b, 0x65, 0x74, 0x73, 0x12, 0x2f, 0x0a, 0x11, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f,
+ 0x72, 0x65, 0x73, 0x75, 0x6d, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08,
+ 0x42, 0x02, 0x18, 0x01, 0x52, 0x10, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x75,
+ 0x6d, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0c, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e,
+ 0x74, 0x69, 0x61, 0x6c, 0x22, 0xc4, 0x01, 0x0a, 0x05, 0x53, 0x6c, 0x61, 0x63, 0x6b, 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, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20,
+ 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x32, 0x0a, 0x06,
+ 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x63,
+ 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x2e, 0x53, 0x6c, 0x61, 0x63, 0x6b,
+ 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x48, 0x00, 0x52, 0x06, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73,
+ 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x73, 0x18, 0x03, 0x20, 0x03,
+ 0x28, 0x09, 0x52, 0x08, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x73, 0x12, 0x1f, 0x0a, 0x0b,
+ 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x04, 0x20, 0x03, 0x28,
+ 0x09, 0x52, 0x0a, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x0c, 0x0a,
+ 0x0a, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x22, 0x06, 0x0a, 0x04, 0x54,
+ 0x65, 0x73, 0x74, 0x22, 0x31, 0x0a, 0x09, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x6b, 0x69, 0x74, 0x65,
+ 0x12, 0x16, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48,
+ 0x00, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x42, 0x0c, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x64,
+ 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x22, 0xa5, 0x02, 0x0a, 0x06, 0x47, 0x65, 0x72, 0x72, 0x69,
+ 0x74, 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, 0x6e, 0x74, 0x12, 0x37, 0x0a, 0x0a, 0x62, 0x61, 0x73, 0x69, 0x63,
+ 0x5f, 0x61, 0x75, 0x74, 0x68, 0x18, 0x02, 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, 0x41, 0x75, 0x74, 0x68,
+ 0x12, 0x48, 0x0a, 0x0f, 0x75, 0x6e, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61,
+ 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x72, 0x65, 0x64,
+ 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x2e, 0x55, 0x6e, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e,
+ 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x48, 0x00, 0x52, 0x0f, 0x75, 0x6e, 0x61, 0x75, 0x74,
+ 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72,
+ 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x70, 0x72,
+ 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x73, 0x6b, 0x69, 0x70, 0x5f, 0x62,
+ 0x69, 0x6e, 0x61, 0x72, 0x69, 0x65, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x73,
+ 0x6b, 0x69, 0x70, 0x42, 0x69, 0x6e, 0x61, 0x72, 0x69, 0x65, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x73,
+ 0x6b, 0x69, 0x70, 0x5f, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x73, 0x18, 0x06, 0x20, 0x01,
+ 0x28, 0x08, 0x52, 0x0c, 0x73, 0x6b, 0x69, 0x70, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x73,
+ 0x42, 0x0c, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x22, 0xa8,
+ 0x02, 0x0a, 0x07, 0x4a, 0x65, 0x6e, 0x6b, 0x69, 0x6e, 0x73, 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, 0x6e, 0x74,
+ 0x12, 0x37, 0x0a, 0x0a, 0x62, 0x61, 0x73, 0x69, 0x63, 0x5f, 0x61, 0x75, 0x74, 0x68, 0x18, 0x02,
+ 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, 0x41, 0x75, 0x74, 0x68, 0x12, 0x2d, 0x0a, 0x06, 0x68, 0x65, 0x61,
+ 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x63, 0x72, 0x65, 0x64,
+ 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x48, 0x00,
+ 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x48, 0x0a, 0x0f, 0x75, 0x6e, 0x61, 0x75,
+ 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28,
+ 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x2e,
+ 0x55, 0x6e, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x48,
+ 0x00, 0x52, 0x0f, 0x75, 0x6e, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74,
+ 0x65, 0x64, 0x12, 0x37, 0x0a, 0x18, 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x5f, 0x73,
+ 0x6b, 0x69, 0x70, 0x5f, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x74, 0x6c, 0x73, 0x18, 0x04,
+ 0x20, 0x01, 0x28, 0x08, 0x52, 0x15, 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x53, 0x6b,
+ 0x69, 0x70, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x54, 0x6c, 0x73, 0x42, 0x0c, 0x0a, 0x0a, 0x63,
+ 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x22, 0xbd, 0x02, 0x0a, 0x05, 0x54, 0x65,
+ 0x61, 0x6d, 0x73, 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, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x05, 0x74, 0x6f, 0x6b,
+ 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65,
+ 0x6e, 0x12, 0x46, 0x0a, 0x0d, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74,
+ 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x63, 0x72, 0x65, 0x64, 0x65,
+ 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x2e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x43, 0x72, 0x65,
+ 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x48, 0x00, 0x52, 0x0d, 0x61, 0x75, 0x74, 0x68,
+ 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x2b, 0x0a, 0x05, 0x6f, 0x61, 0x75,
+ 0x74, 0x68, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x63, 0x72, 0x65, 0x64, 0x65,
+ 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x2e, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x48, 0x00, 0x52,
+ 0x05, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65,
+ 0x6c, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65,
+ 0x6c, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x5f, 0x6c, 0x69, 0x73,
+ 0x74, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x4c,
+ 0x69, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x74, 0x65, 0x61, 0x6d, 0x5f, 0x69, 0x64, 0x73, 0x18,
+ 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x74, 0x65, 0x61, 0x6d, 0x49, 0x64, 0x73, 0x12, 0x1b,
+ 0x0a, 0x09, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28,
+ 0x09, 0x52, 0x08, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x49, 0x64, 0x42, 0x0c, 0x0a, 0x0a, 0x63,
+ 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x22, 0x95, 0x01, 0x0a, 0x06, 0x53, 0x79,
+ 0x73, 0x6c, 0x6f, 0x67, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c,
+ 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c,
+ 0x12, 0x25, 0x0a, 0x0e, 0x6c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65,
+ 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6c, 0x69, 0x73, 0x74, 0x65, 0x6e,
+ 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x6c, 0x73, 0x43, 0x65,
+ 0x72, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x74, 0x6c, 0x73, 0x43, 0x65, 0x72,
+ 0x74, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x6c, 0x73, 0x4b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28,
+ 0x09, 0x52, 0x06, 0x74, 0x6c, 0x73, 0x4b, 0x65, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x6f, 0x72,
+ 0x6d, 0x61, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61,
+ 0x74, 0x22, 0xca, 0x01, 0x0a, 0x07, 0x46, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x72, 0x12, 0x48, 0x0a,
0x0f, 0x75, 0x6e, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64,
- 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74,
+ 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74,
0x69, 0x61, 0x6c, 0x73, 0x2e, 0x55, 0x6e, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63,
0x61, 0x74, 0x65, 0x64, 0x48, 0x00, 0x52, 0x0f, 0x75, 0x6e, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e,
- 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x4c, 0x0a, 0x11, 0x63, 0x6c, 0x6f, 0x75, 0x64,
- 0x5f, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01,
- 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73,
- 0x2e, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e,
- 0x74, 0x48, 0x00, 0x52, 0x10, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f,
- 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x49, 0x0a, 0x0d, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e,
- 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x63,
- 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x2e, 0x41, 0x57, 0x53, 0x53, 0x65,
- 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74,
- 0x48, 0x00, 0x52, 0x0c, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e,
- 0x12, 0x18, 0x0a, 0x07, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28,
- 0x09, 0x52, 0x07, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6d, 0x61,
- 0x78, 0x5f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x06, 0x20,
- 0x01, 0x28, 0x03, 0x52, 0x0d, 0x6d, 0x61, 0x78, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x69,
- 0x7a, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x6f, 0x6c, 0x65, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28,
- 0x09, 0x52, 0x05, 0x72, 0x6f, 0x6c, 0x65, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x69, 0x67, 0x6e, 0x6f,
- 0x72, 0x65, 0x5f, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x09,
- 0x52, 0x0d, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x42, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x12,
- 0x2f, 0x0a, 0x11, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x72, 0x65, 0x73, 0x75, 0x6d, 0x70,
- 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x42, 0x02, 0x18, 0x01, 0x52, 0x10,
- 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6d, 0x70, 0x74, 0x69, 0x6f, 0x6e,
- 0x42, 0x0c, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x22, 0xc4,
- 0x01, 0x0a, 0x05, 0x53, 0x6c, 0x61, 0x63, 0x6b, 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, 0x6e, 0x74, 0x12, 0x16,
- 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52,
- 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x32, 0x0a, 0x06, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73,
- 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74,
- 0x69, 0x61, 0x6c, 0x73, 0x2e, 0x53, 0x6c, 0x61, 0x63, 0x6b, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73,
- 0x48, 0x00, 0x52, 0x06, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x68,
- 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x63, 0x68,
- 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65,
- 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x69, 0x67, 0x6e,
- 0x6f, 0x72, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x0c, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x64, 0x65,
- 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x22, 0x06, 0x0a, 0x04, 0x54, 0x65, 0x73, 0x74, 0x22, 0x31, 0x0a,
- 0x09, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x6b, 0x69, 0x74, 0x65, 0x12, 0x16, 0x0a, 0x05, 0x74, 0x6f,
- 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x74, 0x6f, 0x6b,
- 0x65, 0x6e, 0x42, 0x0c, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c,
- 0x22, 0xa5, 0x02, 0x0a, 0x06, 0x47, 0x65, 0x72, 0x72, 0x69, 0x74, 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, 0x6e,
- 0x74, 0x12, 0x37, 0x0a, 0x0a, 0x62, 0x61, 0x73, 0x69, 0x63, 0x5f, 0x61, 0x75, 0x74, 0x68, 0x18,
- 0x02, 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, 0x41, 0x75, 0x74, 0x68, 0x12, 0x48, 0x0a, 0x0f, 0x75, 0x6e,
- 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20,
- 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c,
- 0x73, 0x2e, 0x55, 0x6e, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65,
- 0x64, 0x48, 0x00, 0x52, 0x0f, 0x75, 0x6e, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63,
- 0x61, 0x74, 0x65, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73,
- 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73,
- 0x12, 0x23, 0x0a, 0x0d, 0x73, 0x6b, 0x69, 0x70, 0x5f, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x69, 0x65,
- 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x73, 0x6b, 0x69, 0x70, 0x42, 0x69, 0x6e,
- 0x61, 0x72, 0x69, 0x65, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x73, 0x6b, 0x69, 0x70, 0x5f, 0x61, 0x72,
- 0x63, 0x68, 0x69, 0x76, 0x65, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x73, 0x6b,
- 0x69, 0x70, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x73, 0x42, 0x0c, 0x0a, 0x0a, 0x63, 0x72,
- 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x22, 0xa8, 0x02, 0x0a, 0x07, 0x4a, 0x65, 0x6e,
- 0x6b, 0x69, 0x6e, 0x73, 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, 0x6e, 0x74, 0x12, 0x37, 0x0a, 0x0a, 0x62, 0x61,
- 0x73, 0x69, 0x63, 0x5f, 0x61, 0x75, 0x74, 0x68, 0x18, 0x02, 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, 0x41,
- 0x75, 0x74, 0x68, 0x12, 0x2d, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20,
- 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c,
- 0x73, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x48, 0x00, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64,
- 0x65, 0x72, 0x12, 0x48, 0x0a, 0x0f, 0x75, 0x6e, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69,
- 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x72,
+ 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x6f, 0x6d, 0x61, 0x69,
+ 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e,
+ 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x78, 0x5f, 0x64, 0x65, 0x70, 0x74, 0x68, 0x18, 0x03,
+ 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x44, 0x65, 0x70, 0x74, 0x68, 0x12, 0x30,
+ 0x0a, 0x05, 0x73, 0x69, 0x6e, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e,
+ 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,
+ 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x05, 0x73, 0x69, 0x6e, 0x63, 0x65,
+ 0x42, 0x0c, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x22, 0x51,
+ 0x0a, 0x0d, 0x53, 0x6c, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x61, 0x6c, 0x74, 0x69, 0x6d, 0x65, 0x12,
+ 0x32, 0x0a, 0x06, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
+ 0x18, 0x2e, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x2e, 0x53, 0x6c,
+ 0x61, 0x63, 0x6b, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x48, 0x00, 0x52, 0x06, 0x74, 0x6f, 0x6b,
+ 0x65, 0x6e, 0x73, 0x42, 0x0c, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61,
+ 0x6c, 0x22, 0xe9, 0x01, 0x0a, 0x0a, 0x53, 0x68, 0x61, 0x72, 0x65, 0x70, 0x6f, 0x69, 0x6e, 0x74,
+ 0x12, 0x2b, 0x0a, 0x05, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
+ 0x13, 0x2e, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x2e, 0x4f, 0x61,
+ 0x75, 0x74, 0x68, 0x32, 0x48, 0x00, 0x52, 0x05, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x12, 0x19, 0x0a,
+ 0x08, 0x73, 0x69, 0x74, 0x65, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x07, 0x73, 0x69, 0x74, 0x65, 0x55, 0x72, 0x6c, 0x12, 0x29, 0x0a, 0x10, 0x69, 0x6e, 0x63, 0x6c,
+ 0x75, 0x64, 0x65, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01,
+ 0x28, 0x08, 0x52, 0x0f, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69,
+ 0x6f, 0x6e, 0x73, 0x12, 0x29, 0x0a, 0x10, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x63,
+ 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x69,
+ 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x2f,
+ 0x0a, 0x13, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x61, 0x74, 0x74, 0x61, 0x63, 0x68,
+ 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x12, 0x69, 0x6e, 0x63,
+ 0x6c, 0x75, 0x64, 0x65, 0x41, 0x74, 0x74, 0x61, 0x63, 0x68, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x42,
+ 0x0c, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x22, 0xf6, 0x03,
+ 0x0a, 0x0a, 0x41, 0x7a, 0x75, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 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,
+ 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28,
+ 0x09, 0x48, 0x00, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x2b, 0x0a, 0x05, 0x6f, 0x61,
+ 0x75, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x63, 0x72, 0x65, 0x64,
+ 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x2e, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x48, 0x00,
+ 0x52, 0x05, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x12, 0x22, 0x0a, 0x0c, 0x72, 0x65, 0x70, 0x6f, 0x73,
+ 0x69, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x72,
+ 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x0d, 0x6f,
+ 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x05, 0x20, 0x03,
+ 0x28, 0x09, 0x52, 0x0d, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e,
+ 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x18, 0x06, 0x20,
+ 0x03, 0x28, 0x09, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x12, 0x23, 0x0a,
+ 0x0d, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x66, 0x6f, 0x72, 0x6b, 0x73, 0x18, 0x07,
+ 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x46, 0x6f, 0x72,
+ 0x6b, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x5f, 0x72, 0x65, 0x70,
+ 0x6f, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65,
+ 0x52, 0x65, 0x70, 0x6f, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65,
+ 0x5f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x69, 0x6e,
+ 0x63, 0x6c, 0x75, 0x64, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x12, 0x29, 0x0a, 0x10, 0x69, 0x6e,
+ 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x18, 0x0a,
+ 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x50, 0x72, 0x6f,
+ 0x6a, 0x65, 0x63, 0x74, 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x5f,
+ 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e,
+ 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x12, 0x23,
+ 0x0a, 0x0d, 0x73, 0x6b, 0x69, 0x70, 0x5f, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x69, 0x65, 0x73, 0x18,
+ 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x73, 0x6b, 0x69, 0x70, 0x42, 0x69, 0x6e, 0x61, 0x72,
+ 0x69, 0x65, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x73, 0x6b, 0x69, 0x70, 0x5f, 0x61, 0x72, 0x63, 0x68,
+ 0x69, 0x76, 0x65, 0x73, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x73, 0x6b, 0x69, 0x70,
+ 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x73, 0x42, 0x0c, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x64,
+ 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x22, 0xd5, 0x04, 0x0a, 0x07, 0x50, 0x6f, 0x73, 0x74, 0x6d,
+ 0x61, 0x6e, 0x12, 0x48, 0x0a, 0x0f, 0x75, 0x6e, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69,
+ 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x72,
0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x2e, 0x55, 0x6e, 0x61, 0x75, 0x74, 0x68,
0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x48, 0x00, 0x52, 0x0f, 0x75, 0x6e, 0x61,
- 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x37, 0x0a, 0x18,
- 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x5f, 0x73, 0x6b, 0x69, 0x70, 0x5f, 0x76, 0x65,
- 0x72, 0x69, 0x66, 0x79, 0x5f, 0x74, 0x6c, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x15,
- 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x53, 0x6b, 0x69, 0x70, 0x56, 0x65, 0x72, 0x69,
- 0x66, 0x79, 0x54, 0x6c, 0x73, 0x42, 0x0c, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74,
- 0x69, 0x61, 0x6c, 0x22, 0xbd, 0x02, 0x0a, 0x05, 0x54, 0x65, 0x61, 0x6d, 0x73, 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, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01,
- 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x46, 0x0a, 0x0d, 0x61,
- 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01,
- 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73,
- 0x2e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61,
- 0x6c, 0x73, 0x48, 0x00, 0x52, 0x0d, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61,
- 0x74, 0x65, 0x64, 0x12, 0x2b, 0x0a, 0x05, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x18, 0x07, 0x20, 0x01,
- 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73,
- 0x2e, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x48, 0x00, 0x52, 0x05, 0x6f, 0x61, 0x75, 0x74, 0x68,
- 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x73, 0x18, 0x04, 0x20, 0x03,
- 0x28, 0x09, 0x52, 0x08, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x73, 0x12, 0x1f, 0x0a, 0x0b,
- 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x05, 0x20, 0x03, 0x28,
- 0x09, 0x52, 0x0a, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x19, 0x0a,
- 0x08, 0x74, 0x65, 0x61, 0x6d, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52,
- 0x07, 0x74, 0x65, 0x61, 0x6d, 0x49, 0x64, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x65, 0x6e, 0x61,
- 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x65, 0x6e,
- 0x61, 0x6e, 0x74, 0x49, 0x64, 0x42, 0x0c, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74,
- 0x69, 0x61, 0x6c, 0x22, 0x95, 0x01, 0x0a, 0x06, 0x53, 0x79, 0x73, 0x6c, 0x6f, 0x67, 0x12, 0x1a,
- 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
- 0x52, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x25, 0x0a, 0x0e, 0x6c, 0x69,
- 0x73, 0x74, 0x65, 0x6e, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01,
- 0x28, 0x09, 0x52, 0x0d, 0x6c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73,
- 0x73, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x6c, 0x73, 0x43, 0x65, 0x72, 0x74, 0x18, 0x03, 0x20, 0x01,
- 0x28, 0x09, 0x52, 0x07, 0x74, 0x6c, 0x73, 0x43, 0x65, 0x72, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x74,
- 0x6c, 0x73, 0x4b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x6c, 0x73,
- 0x4b, 0x65, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x05, 0x20,
- 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x22, 0xca, 0x01, 0x0a, 0x07,
- 0x46, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x72, 0x12, 0x48, 0x0a, 0x0f, 0x75, 0x6e, 0x61, 0x75, 0x74,
- 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b,
- 0x32, 0x1c, 0x2e, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x2e, 0x55,
- 0x6e, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x48, 0x00,
- 0x52, 0x0f, 0x75, 0x6e, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65,
- 0x64, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03,
- 0x28, 0x09, 0x52, 0x07, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d,
- 0x61, 0x78, 0x5f, 0x64, 0x65, 0x70, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08,
- 0x6d, 0x61, 0x78, 0x44, 0x65, 0x70, 0x74, 0x68, 0x12, 0x30, 0x0a, 0x05, 0x73, 0x69, 0x6e, 0x63,
- 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
- 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74,
- 0x61, 0x6d, 0x70, 0x52, 0x05, 0x73, 0x69, 0x6e, 0x63, 0x65, 0x42, 0x0c, 0x0a, 0x0a, 0x63, 0x72,
- 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x22, 0x51, 0x0a, 0x0d, 0x53, 0x6c, 0x61, 0x63,
- 0x6b, 0x52, 0x65, 0x61, 0x6c, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x32, 0x0a, 0x06, 0x74, 0x6f, 0x6b,
- 0x65, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x63, 0x72, 0x65, 0x64,
- 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x2e, 0x53, 0x6c, 0x61, 0x63, 0x6b, 0x54, 0x6f, 0x6b,
- 0x65, 0x6e, 0x73, 0x48, 0x00, 0x52, 0x06, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x42, 0x0c, 0x0a,
- 0x0a, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x22, 0xe9, 0x01, 0x0a, 0x0a,
- 0x53, 0x68, 0x61, 0x72, 0x65, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x2b, 0x0a, 0x05, 0x6f, 0x61,
- 0x75, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x63, 0x72, 0x65, 0x64,
- 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x2e, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x48, 0x00,
- 0x52, 0x05, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x69, 0x74, 0x65, 0x5f,
- 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x69, 0x74, 0x65, 0x55,
- 0x72, 0x6c, 0x12, 0x29, 0x0a, 0x10, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x76, 0x65,
- 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x69, 0x6e,
- 0x63, 0x6c, 0x75, 0x64, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x29, 0x0a,
- 0x10, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74,
- 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65,
- 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x2f, 0x0a, 0x13, 0x69, 0x6e, 0x63, 0x6c,
- 0x75, 0x64, 0x65, 0x5f, 0x61, 0x74, 0x74, 0x61, 0x63, 0x68, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18,
- 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x12, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x41, 0x74,
- 0x74, 0x61, 0x63, 0x68, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x42, 0x0c, 0x0a, 0x0a, 0x63, 0x72, 0x65,
- 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x22, 0xf6, 0x03, 0x0a, 0x0a, 0x41, 0x7a, 0x75, 0x72,
- 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 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, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x05,
+ 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x05,
0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x74,
- 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x2b, 0x0a, 0x05, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x18, 0x03, 0x20,
- 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c,
- 0x73, 0x2e, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x48, 0x00, 0x52, 0x05, 0x6f, 0x61, 0x75, 0x74,
- 0x68, 0x12, 0x22, 0x0a, 0x0c, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x65,
- 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74,
- 0x6f, 0x72, 0x69, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x0d, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a,
- 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0d, 0x6f, 0x72,
- 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x70,
- 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x70,
- 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x69, 0x6e, 0x63, 0x6c, 0x75,
- 0x64, 0x65, 0x5f, 0x66, 0x6f, 0x72, 0x6b, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c,
- 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x46, 0x6f, 0x72, 0x6b, 0x73, 0x12, 0x21, 0x0a, 0x0c,
- 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x5f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x18, 0x08, 0x20, 0x03,
- 0x28, 0x09, 0x52, 0x0b, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x12,
- 0x23, 0x0a, 0x0d, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x72, 0x65, 0x70, 0x6f, 0x73,
- 0x18, 0x09, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x52,
- 0x65, 0x70, 0x6f, 0x73, 0x12, 0x29, 0x0a, 0x10, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f,
- 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f,
- 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x12,
- 0x27, 0x0a, 0x0f, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63,
- 0x74, 0x73, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65,
- 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x73, 0x6b, 0x69, 0x70,
- 0x5f, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x69, 0x65, 0x73, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52,
- 0x0c, 0x73, 0x6b, 0x69, 0x70, 0x42, 0x69, 0x6e, 0x61, 0x72, 0x69, 0x65, 0x73, 0x12, 0x23, 0x0a,
- 0x0d, 0x73, 0x6b, 0x69, 0x70, 0x5f, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x73, 0x18, 0x0d,
- 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x73, 0x6b, 0x69, 0x70, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76,
- 0x65, 0x73, 0x42, 0x0c, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c,
- 0x22, 0xd5, 0x04, 0x0a, 0x07, 0x50, 0x6f, 0x73, 0x74, 0x6d, 0x61, 0x6e, 0x12, 0x48, 0x0a, 0x0f,
- 0x75, 0x6e, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18,
- 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69,
- 0x61, 0x6c, 0x73, 0x2e, 0x55, 0x6e, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61,
- 0x74, 0x65, 0x64, 0x48, 0x00, 0x52, 0x0f, 0x75, 0x6e, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74,
- 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18,
- 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1e,
- 0x0a, 0x0a, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03,
- 0x28, 0x09, 0x52, 0x0a, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x12, 0x20,
- 0x0a, 0x0b, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20,
- 0x03, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73,
- 0x12, 0x22, 0x0a, 0x0c, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73,
- 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d,
- 0x65, 0x6e, 0x74, 0x73, 0x12, 0x2f, 0x0a, 0x13, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f,
- 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28,
- 0x09, 0x52, 0x12, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63,
- 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x31, 0x0a, 0x14, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65,
- 0x5f, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x07, 0x20,
- 0x03, 0x28, 0x09, 0x52, 0x13, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x45, 0x6e, 0x76, 0x69,
- 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x2f, 0x0a, 0x13, 0x69, 0x6e, 0x63, 0x6c,
- 0x75, 0x64, 0x65, 0x5f, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18,
- 0x08, 0x20, 0x03, 0x28, 0x09, 0x52, 0x12, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x43, 0x6f,
- 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x31, 0x0a, 0x14, 0x69, 0x6e, 0x63,
- 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74,
- 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x09, 0x52, 0x13, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65,
- 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x2b, 0x0a, 0x11,
- 0x64, 0x65, 0x74, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x5f, 0x6b, 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64,
- 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x09, 0x52, 0x10, 0x64, 0x65, 0x74, 0x65, 0x63, 0x74, 0x6f,
- 0x72, 0x4b, 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64, 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x77, 0x6f, 0x72,
- 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x73, 0x18, 0x0b, 0x20, 0x03,
- 0x28, 0x09, 0x52, 0x0e, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x50, 0x61, 0x74,
- 0x68, 0x73, 0x12, 0x29, 0x0a, 0x10, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e,
- 0x5f, 0x70, 0x61, 0x74, 0x68, 0x73, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x63, 0x6f,
- 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x61, 0x74, 0x68, 0x73, 0x12, 0x2b, 0x0a,
- 0x11, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x70, 0x61, 0x74,
- 0x68, 0x73, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x09, 0x52, 0x10, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f,
- 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x50, 0x61, 0x74, 0x68, 0x73, 0x42, 0x0c, 0x0a, 0x0a, 0x63, 0x72,
- 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x22, 0xac, 0x01, 0x0a, 0x07, 0x57, 0x65, 0x62,
- 0x68, 0x6f, 0x6f, 0x6b, 0x12, 0x2e, 0x0a, 0x0e, 0x6c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x5f, 0x61,
- 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42,
- 0x04, 0x72, 0x02, 0x68, 0x01, 0x52, 0x0d, 0x6c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x41, 0x64, 0x64,
- 0x72, 0x65, 0x73, 0x73, 0x12, 0x2d, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02,
- 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61,
- 0x6c, 0x73, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x48, 0x00, 0x52, 0x06, 0x68, 0x65, 0x61,
- 0x64, 0x65, 0x72, 0x12, 0x29, 0x0a, 0x06, 0x76, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x18, 0x04, 0x20,
- 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x56, 0x65,
- 0x63, 0x74, 0x6f, 0x72, 0x48, 0x01, 0x52, 0x06, 0x76, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x42, 0x0c,
- 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x42, 0x09, 0x0a, 0x07,
- 0x76, 0x61, 0x72, 0x69, 0x61, 0x6e, 0x74, 0x22, 0x4e, 0x0a, 0x06, 0x56, 0x65, 0x63, 0x74, 0x6f,
- 0x72, 0x12, 0x23, 0x0a, 0x0d, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x66, 0x69, 0x65,
- 0x6c, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x6f,
- 0x72, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x6c, 0x69, 0x6e, 0x6b, 0x5f, 0x66,
- 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6c, 0x69, 0x6e,
- 0x6b, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x22, 0xcd, 0x02, 0x0a, 0x0d, 0x45, 0x6c, 0x61, 0x73,
- 0x74, 0x69, 0x63, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x6f, 0x64,
- 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x12,
- 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
- 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70,
- 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70,
- 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x6c, 0x6f, 0x75, 0x64,
- 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6c, 0x6f, 0x75, 0x64,
- 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x61, 0x70, 0x69, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x05, 0x20,
- 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x12, 0x23, 0x0a, 0x0d, 0x73,
- 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x06, 0x20, 0x01,
- 0x28, 0x09, 0x52, 0x0c, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e,
- 0x12, 0x23, 0x0a, 0x0d, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x5f, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72,
- 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x50, 0x61,
- 0x74, 0x74, 0x65, 0x72, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, 0x6a,
- 0x73, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x71, 0x75, 0x65, 0x72, 0x79,
- 0x4a, 0x73, 0x6f, 0x6e, 0x12, 0x27, 0x0a, 0x0f, 0x73, 0x69, 0x6e, 0x63, 0x65, 0x5f, 0x74, 0x69,
- 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x73,
- 0x69, 0x6e, 0x63, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x28, 0x0a,
- 0x10, 0x62, 0x65, 0x73, 0x74, 0x5f, 0x65, 0x66, 0x66, 0x6f, 0x72, 0x74, 0x5f, 0x73, 0x63, 0x61,
- 0x6e, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x62, 0x65, 0x73, 0x74, 0x45, 0x66, 0x66,
- 0x6f, 0x72, 0x74, 0x53, 0x63, 0x61, 0x6e, 0x22, 0xde, 0x01, 0x0a, 0x06, 0x53, 0x65, 0x6e, 0x74,
- 0x72, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x01,
- 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x1f,
- 0x0a, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01,
- 0x28, 0x09, 0x48, 0x00, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12,
- 0x19, 0x0a, 0x07, 0x64, 0x73, 0x6e, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
- 0x48, 0x00, 0x52, 0x06, 0x64, 0x73, 0x6e, 0x4b, 0x65, 0x79, 0x12, 0x19, 0x0a, 0x07, 0x61, 0x70,
- 0x69, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x06, 0x61,
- 0x70, 0x69, 0x4b, 0x65, 0x79, 0x12, 0x37, 0x0a, 0x18, 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72,
- 0x65, 0x5f, 0x73, 0x6b, 0x69, 0x70, 0x5f, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x5f, 0x74, 0x6c,
- 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x15, 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72,
- 0x65, 0x53, 0x6b, 0x69, 0x70, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x54, 0x6c, 0x73, 0x12, 0x1a,
- 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09,
- 0x52, 0x08, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x42, 0x0c, 0x0a, 0x0a, 0x63, 0x72,
- 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x22, 0x07, 0x0a, 0x05, 0x53, 0x74, 0x64, 0x69,
- 0x6e, 0x22, 0x4e, 0x0a, 0x0f, 0x53, 0x6c, 0x61, 0x63, 0x6b, 0x43, 0x6f, 0x6e, 0x74, 0x69, 0x6e,
- 0x75, 0x6f, 0x75, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63,
- 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61,
- 0x63, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64,
- 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x49,
- 0x64, 0x22, 0x26, 0x0a, 0x0e, 0x4a, 0x53, 0x4f, 0x4e, 0x45, 0x6e, 0x75, 0x6d, 0x65, 0x72, 0x61,
- 0x74, 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x61, 0x74, 0x68, 0x73, 0x18, 0x01, 0x20, 0x03,
- 0x28, 0x09, 0x52, 0x05, 0x70, 0x61, 0x74, 0x68, 0x73, 0x2a, 0xc4, 0x09, 0x0a, 0x0a, 0x53, 0x6f,
- 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1d, 0x0a, 0x19, 0x53, 0x4f, 0x55, 0x52,
- 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x41, 0x5a, 0x55, 0x52, 0x45, 0x5f, 0x53, 0x54,
- 0x4f, 0x52, 0x41, 0x47, 0x45, 0x10, 0x00, 0x12, 0x19, 0x0a, 0x15, 0x53, 0x4f, 0x55, 0x52, 0x43,
- 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x42, 0x49, 0x54, 0x42, 0x55, 0x43, 0x4b, 0x45, 0x54,
- 0x10, 0x01, 0x12, 0x18, 0x0a, 0x14, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50,
- 0x45, 0x5f, 0x43, 0x49, 0x52, 0x43, 0x4c, 0x45, 0x43, 0x49, 0x10, 0x02, 0x12, 0x1a, 0x0a, 0x16,
- 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x43, 0x4f, 0x4e, 0x46,
- 0x4c, 0x55, 0x45, 0x4e, 0x43, 0x45, 0x10, 0x03, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x4f, 0x55, 0x52,
- 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x44, 0x4f, 0x43, 0x4b, 0x45, 0x52, 0x10, 0x04,
- 0x12, 0x13, 0x0a, 0x0f, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f,
- 0x45, 0x43, 0x52, 0x10, 0x05, 0x12, 0x13, 0x0a, 0x0f, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f,
- 0x54, 0x59, 0x50, 0x45, 0x5f, 0x47, 0x43, 0x53, 0x10, 0x06, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x4f,
- 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x47, 0x49, 0x54, 0x48, 0x55, 0x42,
- 0x10, 0x07, 0x12, 0x1a, 0x0a, 0x16, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50,
- 0x45, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x5f, 0x47, 0x49, 0x54, 0x10, 0x08, 0x12, 0x16,
- 0x0a, 0x12, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x47, 0x49,
- 0x54, 0x4c, 0x41, 0x42, 0x10, 0x09, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45,
- 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4a, 0x49, 0x52, 0x41, 0x10, 0x0a, 0x12, 0x24, 0x0a, 0x20,
- 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4e, 0x50, 0x4d, 0x5f,
- 0x55, 0x4e, 0x41, 0x55, 0x54, 0x48, 0x44, 0x5f, 0x50, 0x41, 0x43, 0x4b, 0x41, 0x47, 0x45, 0x53,
- 0x10, 0x0b, 0x12, 0x25, 0x0a, 0x21, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50,
- 0x45, 0x5f, 0x50, 0x59, 0x50, 0x49, 0x5f, 0x55, 0x4e, 0x41, 0x55, 0x54, 0x48, 0x44, 0x5f, 0x50,
- 0x41, 0x43, 0x4b, 0x41, 0x47, 0x45, 0x53, 0x10, 0x0c, 0x12, 0x12, 0x0a, 0x0e, 0x53, 0x4f, 0x55,
- 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x33, 0x10, 0x0d, 0x12, 0x15, 0x0a,
- 0x11, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x4c, 0x41,
- 0x43, 0x4b, 0x10, 0x0e, 0x12, 0x1a, 0x0a, 0x16, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54,
- 0x59, 0x50, 0x45, 0x5f, 0x46, 0x49, 0x4c, 0x45, 0x53, 0x59, 0x53, 0x54, 0x45, 0x4d, 0x10, 0x0f,
- 0x12, 0x13, 0x0a, 0x0f, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f,
- 0x47, 0x49, 0x54, 0x10, 0x10, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f,
- 0x54, 0x59, 0x50, 0x45, 0x5f, 0x54, 0x45, 0x53, 0x54, 0x10, 0x11, 0x12, 0x1b, 0x0a, 0x17, 0x53,
- 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x33, 0x5f, 0x55, 0x4e,
- 0x41, 0x55, 0x54, 0x48, 0x45, 0x44, 0x10, 0x12, 0x12, 0x2a, 0x0a, 0x26, 0x53, 0x4f, 0x55, 0x52,
- 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x47, 0x49, 0x54, 0x48, 0x55, 0x42, 0x5f, 0x55,
- 0x4e, 0x41, 0x55, 0x54, 0x48, 0x45, 0x4e, 0x54, 0x49, 0x43, 0x41, 0x54, 0x45, 0x44, 0x5f, 0x4f,
- 0x52, 0x47, 0x10, 0x13, 0x12, 0x19, 0x0a, 0x15, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54,
- 0x59, 0x50, 0x45, 0x5f, 0x42, 0x55, 0x49, 0x4c, 0x44, 0x4b, 0x49, 0x54, 0x45, 0x10, 0x14, 0x12,
- 0x16, 0x0a, 0x12, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x47,
- 0x45, 0x52, 0x52, 0x49, 0x54, 0x10, 0x15, 0x12, 0x17, 0x0a, 0x13, 0x53, 0x4f, 0x55, 0x52, 0x43,
- 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4a, 0x45, 0x4e, 0x4b, 0x49, 0x4e, 0x53, 0x10, 0x16,
- 0x12, 0x15, 0x0a, 0x11, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f,
- 0x54, 0x45, 0x41, 0x4d, 0x53, 0x10, 0x17, 0x12, 0x21, 0x0a, 0x1d, 0x53, 0x4f, 0x55, 0x52, 0x43,
- 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4a, 0x46, 0x52, 0x4f, 0x47, 0x5f, 0x41, 0x52, 0x54,
- 0x49, 0x46, 0x41, 0x43, 0x54, 0x4f, 0x52, 0x59, 0x10, 0x18, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x4f,
- 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x59, 0x53, 0x4c, 0x4f, 0x47,
- 0x10, 0x19, 0x12, 0x27, 0x0a, 0x23, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50,
- 0x45, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x5f, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x4d,
- 0x4f, 0x4e, 0x49, 0x54, 0x4f, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x1a, 0x12, 0x1e, 0x0a, 0x1a, 0x53,
- 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x4c, 0x41, 0x43, 0x4b,
- 0x5f, 0x52, 0x45, 0x41, 0x4c, 0x54, 0x49, 0x4d, 0x45, 0x10, 0x1b, 0x12, 0x1c, 0x0a, 0x18, 0x53,
- 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x47, 0x4f, 0x4f, 0x47, 0x4c,
- 0x45, 0x5f, 0x44, 0x52, 0x49, 0x56, 0x45, 0x10, 0x1c, 0x12, 0x1a, 0x0a, 0x16, 0x53, 0x4f, 0x55,
- 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x48, 0x41, 0x52, 0x45, 0x50, 0x4f,
- 0x49, 0x4e, 0x54, 0x10, 0x1d, 0x12, 0x1c, 0x0a, 0x18, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f,
- 0x54, 0x59, 0x50, 0x45, 0x5f, 0x47, 0x43, 0x53, 0x5f, 0x55, 0x4e, 0x41, 0x55, 0x54, 0x48, 0x45,
- 0x44, 0x10, 0x1e, 0x12, 0x1b, 0x0a, 0x17, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59,
- 0x50, 0x45, 0x5f, 0x41, 0x5a, 0x55, 0x52, 0x45, 0x5f, 0x52, 0x45, 0x50, 0x4f, 0x53, 0x10, 0x1f,
- 0x12, 0x18, 0x0a, 0x14, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f,
- 0x54, 0x52, 0x41, 0x56, 0x49, 0x53, 0x43, 0x49, 0x10, 0x20, 0x12, 0x17, 0x0a, 0x13, 0x53, 0x4f,
- 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x50, 0x4f, 0x53, 0x54, 0x4d, 0x41,
- 0x4e, 0x10, 0x21, 0x12, 0x17, 0x0a, 0x13, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59,
- 0x50, 0x45, 0x5f, 0x57, 0x45, 0x42, 0x48, 0x4f, 0x4f, 0x4b, 0x10, 0x22, 0x12, 0x1d, 0x0a, 0x19,
- 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x4c, 0x41, 0x53,
- 0x54, 0x49, 0x43, 0x53, 0x45, 0x41, 0x52, 0x43, 0x48, 0x10, 0x23, 0x12, 0x1b, 0x0a, 0x17, 0x53,
- 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x48, 0x55, 0x47, 0x47, 0x49,
- 0x4e, 0x47, 0x46, 0x41, 0x43, 0x45, 0x10, 0x24, 0x12, 0x23, 0x0a, 0x1f, 0x53, 0x4f, 0x55, 0x52,
- 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x47, 0x49, 0x54, 0x48, 0x55, 0x42, 0x5f, 0x45,
- 0x58, 0x50, 0x45, 0x52, 0x49, 0x4d, 0x45, 0x4e, 0x54, 0x41, 0x4c, 0x10, 0x25, 0x12, 0x16, 0x0a,
- 0x12, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x45, 0x4e,
- 0x54, 0x52, 0x59, 0x10, 0x26, 0x12, 0x1f, 0x0a, 0x1b, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f,
- 0x54, 0x59, 0x50, 0x45, 0x5f, 0x47, 0x49, 0x54, 0x48, 0x55, 0x42, 0x5f, 0x52, 0x45, 0x41, 0x4c,
- 0x54, 0x49, 0x4d, 0x45, 0x10, 0x27, 0x12, 0x15, 0x0a, 0x11, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45,
- 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x54, 0x44, 0x49, 0x4e, 0x10, 0x28, 0x12, 0x20, 0x0a,
- 0x1c, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x4c, 0x41,
- 0x43, 0x4b, 0x5f, 0x43, 0x4f, 0x4e, 0x54, 0x49, 0x4e, 0x55, 0x4f, 0x55, 0x53, 0x10, 0x29, 0x12,
- 0x1f, 0x0a, 0x1b, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4a,
- 0x53, 0x4f, 0x4e, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x45, 0x52, 0x41, 0x54, 0x4f, 0x52, 0x10, 0x2a,
- 0x2a, 0x47, 0x0a, 0x19, 0x42, 0x69, 0x74, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x49, 0x6e, 0x73,
- 0x74, 0x61, 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0e, 0x0a,
- 0x0a, 0x41, 0x55, 0x54, 0x4f, 0x44, 0x45, 0x54, 0x45, 0x43, 0x54, 0x10, 0x00, 0x12, 0x09, 0x0a,
- 0x05, 0x43, 0x4c, 0x4f, 0x55, 0x44, 0x10, 0x01, 0x12, 0x0f, 0x0a, 0x0b, 0x44, 0x41, 0x54, 0x41,
- 0x5f, 0x43, 0x45, 0x4e, 0x54, 0x45, 0x52, 0x10, 0x02, 0x2a, 0x87, 0x01, 0x0a, 0x14, 0x4a, 0x69,
- 0x72, 0x61, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79,
- 0x70, 0x65, 0x12, 0x25, 0x0a, 0x21, 0x4a, 0x49, 0x52, 0x41, 0x5f, 0x49, 0x4e, 0x53, 0x54, 0x41,
- 0x4c, 0x4c, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x41, 0x55, 0x54,
- 0x4f, 0x44, 0x45, 0x54, 0x45, 0x43, 0x54, 0x10, 0x00, 0x12, 0x20, 0x0a, 0x1c, 0x4a, 0x49, 0x52,
- 0x41, 0x5f, 0x49, 0x4e, 0x53, 0x54, 0x41, 0x4c, 0x4c, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x54,
- 0x59, 0x50, 0x45, 0x5f, 0x43, 0x4c, 0x4f, 0x55, 0x44, 0x10, 0x01, 0x12, 0x26, 0x0a, 0x22, 0x4a,
- 0x49, 0x52, 0x41, 0x5f, 0x49, 0x4e, 0x53, 0x54, 0x41, 0x4c, 0x4c, 0x41, 0x54, 0x49, 0x4f, 0x4e,
- 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x44, 0x41, 0x54, 0x41, 0x5f, 0x43, 0x45, 0x4e, 0x54, 0x45,
- 0x52, 0x10, 0x02, 0x42, 0x3b, 0x5a, 0x39, 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, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x70, 0x62,
- 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+ 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1e, 0x0a, 0x0a, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63,
+ 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70,
+ 0x61, 0x63, 0x65, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69,
+ 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x6c, 0x6c, 0x65,
+ 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x22, 0x0a, 0x0c, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f,
+ 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x65, 0x6e,
+ 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x2f, 0x0a, 0x13, 0x65, 0x78,
+ 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e,
+ 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x12, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65,
+ 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x31, 0x0a, 0x14, 0x65,
+ 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65,
+ 0x6e, 0x74, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x13, 0x65, 0x78, 0x63, 0x6c, 0x75,
+ 0x64, 0x65, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x2f,
+ 0x0a, 0x13, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63,
+ 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x09, 0x52, 0x12, 0x69, 0x6e, 0x63,
+ 0x6c, 0x75, 0x64, 0x65, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12,
+ 0x31, 0x0a, 0x14, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x65, 0x6e, 0x76, 0x69, 0x72,
+ 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x09, 0x52, 0x13, 0x69,
+ 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e,
+ 0x74, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x64, 0x65, 0x74, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x5f, 0x6b,
+ 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x09, 0x52, 0x10, 0x64,
+ 0x65, 0x74, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x4b, 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64, 0x73, 0x12,
+ 0x27, 0x0a, 0x0f, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x70, 0x61, 0x74,
+ 0x68, 0x73, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70,
+ 0x61, 0x63, 0x65, 0x50, 0x61, 0x74, 0x68, 0x73, 0x12, 0x29, 0x0a, 0x10, 0x63, 0x6f, 0x6c, 0x6c,
+ 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x73, 0x18, 0x0c, 0x20, 0x03,
+ 0x28, 0x09, 0x52, 0x0f, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x61,
+ 0x74, 0x68, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65,
+ 0x6e, 0x74, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x73, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x09, 0x52, 0x10,
+ 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x50, 0x61, 0x74, 0x68, 0x73,
+ 0x42, 0x0c, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x22, 0xac,
+ 0x01, 0x0a, 0x07, 0x57, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x12, 0x2e, 0x0a, 0x0e, 0x6c, 0x69,
+ 0x73, 0x74, 0x65, 0x6e, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01,
+ 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x68, 0x01, 0x52, 0x0d, 0x6c, 0x69, 0x73,
+ 0x74, 0x65, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x2d, 0x0a, 0x06, 0x68, 0x65,
+ 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x63, 0x72, 0x65,
+ 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x48,
+ 0x00, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x29, 0x0a, 0x06, 0x76, 0x65, 0x63,
+ 0x74, 0x6f, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x73, 0x6f, 0x75, 0x72,
+ 0x63, 0x65, 0x73, 0x2e, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x48, 0x01, 0x52, 0x06, 0x76, 0x65,
+ 0x63, 0x74, 0x6f, 0x72, 0x42, 0x0c, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69,
+ 0x61, 0x6c, 0x42, 0x09, 0x0a, 0x07, 0x76, 0x61, 0x72, 0x69, 0x61, 0x6e, 0x74, 0x22, 0x4e, 0x0a,
+ 0x06, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x12, 0x23, 0x0a, 0x0d, 0x6c, 0x6f, 0x63, 0x61, 0x74,
+ 0x6f, 0x72, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c,
+ 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x1f, 0x0a, 0x0b,
+ 0x6c, 0x69, 0x6e, 0x6b, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28,
+ 0x09, 0x52, 0x0a, 0x6c, 0x69, 0x6e, 0x6b, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x22, 0xcd, 0x02,
+ 0x0a, 0x0d, 0x45, 0x6c, 0x61, 0x73, 0x74, 0x69, 0x63, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x12,
+ 0x14, 0x0a, 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05,
+ 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d,
+ 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d,
+ 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x03, 0x20,
+ 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x19, 0x0a,
+ 0x08, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x07, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x61, 0x70, 0x69, 0x5f,
+ 0x6b, 0x65, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x70, 0x69, 0x4b, 0x65,
+ 0x79, 0x12, 0x23, 0x0a, 0x0d, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x74, 0x6f, 0x6b,
+ 0x65, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63,
+ 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x23, 0x0a, 0x0d, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x5f,
+ 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x69,
+ 0x6e, 0x64, 0x65, 0x78, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x71,
+ 0x75, 0x65, 0x72, 0x79, 0x5f, 0x6a, 0x73, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x09, 0x71, 0x75, 0x65, 0x72, 0x79, 0x4a, 0x73, 0x6f, 0x6e, 0x12, 0x27, 0x0a, 0x0f, 0x73, 0x69,
+ 0x6e, 0x63, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x09, 0x20,
+ 0x01, 0x28, 0x09, 0x52, 0x0e, 0x73, 0x69, 0x6e, 0x63, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74,
+ 0x61, 0x6d, 0x70, 0x12, 0x28, 0x0a, 0x10, 0x62, 0x65, 0x73, 0x74, 0x5f, 0x65, 0x66, 0x66, 0x6f,
+ 0x72, 0x74, 0x5f, 0x73, 0x63, 0x61, 0x6e, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x62,
+ 0x65, 0x73, 0x74, 0x45, 0x66, 0x66, 0x6f, 0x72, 0x74, 0x53, 0x63, 0x61, 0x6e, 0x22, 0xde, 0x01,
+ 0x0a, 0x06, 0x53, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x70,
+ 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x6e, 0x64, 0x70,
+ 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x1f, 0x0a, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x74, 0x6f, 0x6b,
+ 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68,
+ 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x19, 0x0a, 0x07, 0x64, 0x73, 0x6e, 0x5f, 0x6b, 0x65, 0x79,
+ 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x06, 0x64, 0x73, 0x6e, 0x4b, 0x65, 0x79,
+ 0x12, 0x19, 0x0a, 0x07, 0x61, 0x70, 0x69, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28,
+ 0x09, 0x48, 0x00, 0x52, 0x06, 0x61, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x12, 0x37, 0x0a, 0x18, 0x69,
+ 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x5f, 0x73, 0x6b, 0x69, 0x70, 0x5f, 0x76, 0x65, 0x72,
+ 0x69, 0x66, 0x79, 0x5f, 0x74, 0x6c, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x15, 0x69,
+ 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x53, 0x6b, 0x69, 0x70, 0x56, 0x65, 0x72, 0x69, 0x66,
+ 0x79, 0x54, 0x6c, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73,
+ 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73,
+ 0x42, 0x0c, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x22, 0x07,
+ 0x0a, 0x05, 0x53, 0x74, 0x64, 0x69, 0x6e, 0x22, 0x4e, 0x0a, 0x0f, 0x53, 0x6c, 0x61, 0x63, 0x6b,
+ 0x43, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x6f, 0x75, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61,
+ 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e,
+ 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x6a,
+ 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x72,
+ 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x22, 0x26, 0x0a, 0x0e, 0x4a, 0x53, 0x4f, 0x4e, 0x45,
+ 0x6e, 0x75, 0x6d, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x61, 0x74,
+ 0x68, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x70, 0x61, 0x74, 0x68, 0x73, 0x2a,
+ 0xc4, 0x09, 0x0a, 0x0a, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1d,
+ 0x0a, 0x19, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x41, 0x5a,
+ 0x55, 0x52, 0x45, 0x5f, 0x53, 0x54, 0x4f, 0x52, 0x41, 0x47, 0x45, 0x10, 0x00, 0x12, 0x19, 0x0a,
+ 0x15, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x42, 0x49, 0x54,
+ 0x42, 0x55, 0x43, 0x4b, 0x45, 0x54, 0x10, 0x01, 0x12, 0x18, 0x0a, 0x14, 0x53, 0x4f, 0x55, 0x52,
+ 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x43, 0x49, 0x52, 0x43, 0x4c, 0x45, 0x43, 0x49,
+ 0x10, 0x02, 0x12, 0x1a, 0x0a, 0x16, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50,
+ 0x45, 0x5f, 0x43, 0x4f, 0x4e, 0x46, 0x4c, 0x55, 0x45, 0x4e, 0x43, 0x45, 0x10, 0x03, 0x12, 0x16,
+ 0x0a, 0x12, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x44, 0x4f,
+ 0x43, 0x4b, 0x45, 0x52, 0x10, 0x04, 0x12, 0x13, 0x0a, 0x0f, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45,
+ 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x43, 0x52, 0x10, 0x05, 0x12, 0x13, 0x0a, 0x0f, 0x53,
+ 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x47, 0x43, 0x53, 0x10, 0x06,
+ 0x12, 0x16, 0x0a, 0x12, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f,
+ 0x47, 0x49, 0x54, 0x48, 0x55, 0x42, 0x10, 0x07, 0x12, 0x1a, 0x0a, 0x16, 0x53, 0x4f, 0x55, 0x52,
+ 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x5f, 0x47,
+ 0x49, 0x54, 0x10, 0x08, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54,
+ 0x59, 0x50, 0x45, 0x5f, 0x47, 0x49, 0x54, 0x4c, 0x41, 0x42, 0x10, 0x09, 0x12, 0x14, 0x0a, 0x10,
+ 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4a, 0x49, 0x52, 0x41,
+ 0x10, 0x0a, 0x12, 0x24, 0x0a, 0x20, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50,
+ 0x45, 0x5f, 0x4e, 0x50, 0x4d, 0x5f, 0x55, 0x4e, 0x41, 0x55, 0x54, 0x48, 0x44, 0x5f, 0x50, 0x41,
+ 0x43, 0x4b, 0x41, 0x47, 0x45, 0x53, 0x10, 0x0b, 0x12, 0x25, 0x0a, 0x21, 0x53, 0x4f, 0x55, 0x52,
+ 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x50, 0x59, 0x50, 0x49, 0x5f, 0x55, 0x4e, 0x41,
+ 0x55, 0x54, 0x48, 0x44, 0x5f, 0x50, 0x41, 0x43, 0x4b, 0x41, 0x47, 0x45, 0x53, 0x10, 0x0c, 0x12,
+ 0x12, 0x0a, 0x0e, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53,
+ 0x33, 0x10, 0x0d, 0x12, 0x15, 0x0a, 0x11, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59,
+ 0x50, 0x45, 0x5f, 0x53, 0x4c, 0x41, 0x43, 0x4b, 0x10, 0x0e, 0x12, 0x1a, 0x0a, 0x16, 0x53, 0x4f,
+ 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x49, 0x4c, 0x45, 0x53, 0x59,
+ 0x53, 0x54, 0x45, 0x4d, 0x10, 0x0f, 0x12, 0x13, 0x0a, 0x0f, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45,
+ 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x47, 0x49, 0x54, 0x10, 0x10, 0x12, 0x14, 0x0a, 0x10, 0x53,
+ 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x54, 0x45, 0x53, 0x54, 0x10,
+ 0x11, 0x12, 0x1b, 0x0a, 0x17, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45,
+ 0x5f, 0x53, 0x33, 0x5f, 0x55, 0x4e, 0x41, 0x55, 0x54, 0x48, 0x45, 0x44, 0x10, 0x12, 0x12, 0x2a,
+ 0x0a, 0x26, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x47, 0x49,
+ 0x54, 0x48, 0x55, 0x42, 0x5f, 0x55, 0x4e, 0x41, 0x55, 0x54, 0x48, 0x45, 0x4e, 0x54, 0x49, 0x43,
+ 0x41, 0x54, 0x45, 0x44, 0x5f, 0x4f, 0x52, 0x47, 0x10, 0x13, 0x12, 0x19, 0x0a, 0x15, 0x53, 0x4f,
+ 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x42, 0x55, 0x49, 0x4c, 0x44, 0x4b,
+ 0x49, 0x54, 0x45, 0x10, 0x14, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f,
+ 0x54, 0x59, 0x50, 0x45, 0x5f, 0x47, 0x45, 0x52, 0x52, 0x49, 0x54, 0x10, 0x15, 0x12, 0x17, 0x0a,
+ 0x13, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4a, 0x45, 0x4e,
+ 0x4b, 0x49, 0x4e, 0x53, 0x10, 0x16, 0x12, 0x15, 0x0a, 0x11, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45,
+ 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x54, 0x45, 0x41, 0x4d, 0x53, 0x10, 0x17, 0x12, 0x21, 0x0a,
+ 0x1d, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4a, 0x46, 0x52,
+ 0x4f, 0x47, 0x5f, 0x41, 0x52, 0x54, 0x49, 0x46, 0x41, 0x43, 0x54, 0x4f, 0x52, 0x59, 0x10, 0x18,
+ 0x12, 0x16, 0x0a, 0x12, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f,
+ 0x53, 0x59, 0x53, 0x4c, 0x4f, 0x47, 0x10, 0x19, 0x12, 0x27, 0x0a, 0x23, 0x53, 0x4f, 0x55, 0x52,
+ 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x5f, 0x45,
+ 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x4d, 0x4f, 0x4e, 0x49, 0x54, 0x4f, 0x52, 0x49, 0x4e, 0x47, 0x10,
+ 0x1a, 0x12, 0x1e, 0x0a, 0x1a, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45,
+ 0x5f, 0x53, 0x4c, 0x41, 0x43, 0x4b, 0x5f, 0x52, 0x45, 0x41, 0x4c, 0x54, 0x49, 0x4d, 0x45, 0x10,
+ 0x1b, 0x12, 0x1c, 0x0a, 0x18, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45,
+ 0x5f, 0x47, 0x4f, 0x4f, 0x47, 0x4c, 0x45, 0x5f, 0x44, 0x52, 0x49, 0x56, 0x45, 0x10, 0x1c, 0x12,
+ 0x1a, 0x0a, 0x16, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53,
+ 0x48, 0x41, 0x52, 0x45, 0x50, 0x4f, 0x49, 0x4e, 0x54, 0x10, 0x1d, 0x12, 0x1c, 0x0a, 0x18, 0x53,
+ 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x47, 0x43, 0x53, 0x5f, 0x55,
+ 0x4e, 0x41, 0x55, 0x54, 0x48, 0x45, 0x44, 0x10, 0x1e, 0x12, 0x1b, 0x0a, 0x17, 0x53, 0x4f, 0x55,
+ 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x41, 0x5a, 0x55, 0x52, 0x45, 0x5f, 0x52,
+ 0x45, 0x50, 0x4f, 0x53, 0x10, 0x1f, 0x12, 0x18, 0x0a, 0x14, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45,
+ 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x54, 0x52, 0x41, 0x56, 0x49, 0x53, 0x43, 0x49, 0x10, 0x20,
+ 0x12, 0x17, 0x0a, 0x13, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f,
+ 0x50, 0x4f, 0x53, 0x54, 0x4d, 0x41, 0x4e, 0x10, 0x21, 0x12, 0x17, 0x0a, 0x13, 0x53, 0x4f, 0x55,
+ 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x57, 0x45, 0x42, 0x48, 0x4f, 0x4f, 0x4b,
+ 0x10, 0x22, 0x12, 0x1d, 0x0a, 0x19, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50,
+ 0x45, 0x5f, 0x45, 0x4c, 0x41, 0x53, 0x54, 0x49, 0x43, 0x53, 0x45, 0x41, 0x52, 0x43, 0x48, 0x10,
+ 0x23, 0x12, 0x1b, 0x0a, 0x17, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45,
+ 0x5f, 0x48, 0x55, 0x47, 0x47, 0x49, 0x4e, 0x47, 0x46, 0x41, 0x43, 0x45, 0x10, 0x24, 0x12, 0x23,
+ 0x0a, 0x1f, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x47, 0x49,
+ 0x54, 0x48, 0x55, 0x42, 0x5f, 0x45, 0x58, 0x50, 0x45, 0x52, 0x49, 0x4d, 0x45, 0x4e, 0x54, 0x41,
+ 0x4c, 0x10, 0x25, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59,
+ 0x50, 0x45, 0x5f, 0x53, 0x45, 0x4e, 0x54, 0x52, 0x59, 0x10, 0x26, 0x12, 0x1f, 0x0a, 0x1b, 0x53,
+ 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x47, 0x49, 0x54, 0x48, 0x55,
+ 0x42, 0x5f, 0x52, 0x45, 0x41, 0x4c, 0x54, 0x49, 0x4d, 0x45, 0x10, 0x27, 0x12, 0x15, 0x0a, 0x11,
+ 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x54, 0x44, 0x49,
+ 0x4e, 0x10, 0x28, 0x12, 0x20, 0x0a, 0x1c, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x54, 0x59,
+ 0x50, 0x45, 0x5f, 0x53, 0x4c, 0x41, 0x43, 0x4b, 0x5f, 0x43, 0x4f, 0x4e, 0x54, 0x49, 0x4e, 0x55,
+ 0x4f, 0x55, 0x53, 0x10, 0x29, 0x12, 0x1f, 0x0a, 0x1b, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f,
+ 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4a, 0x53, 0x4f, 0x4e, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x45, 0x52,
+ 0x41, 0x54, 0x4f, 0x52, 0x10, 0x2a, 0x2a, 0x47, 0x0a, 0x19, 0x42, 0x69, 0x74, 0x62, 0x75, 0x63,
+ 0x6b, 0x65, 0x74, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54,
+ 0x79, 0x70, 0x65, 0x12, 0x0e, 0x0a, 0x0a, 0x41, 0x55, 0x54, 0x4f, 0x44, 0x45, 0x54, 0x45, 0x43,
+ 0x54, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x43, 0x4c, 0x4f, 0x55, 0x44, 0x10, 0x01, 0x12, 0x0f,
+ 0x0a, 0x0b, 0x44, 0x41, 0x54, 0x41, 0x5f, 0x43, 0x45, 0x4e, 0x54, 0x45, 0x52, 0x10, 0x02, 0x2a,
+ 0x87, 0x01, 0x0a, 0x14, 0x4a, 0x69, 0x72, 0x61, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x61,
+ 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x25, 0x0a, 0x21, 0x4a, 0x49, 0x52, 0x41,
+ 0x5f, 0x49, 0x4e, 0x53, 0x54, 0x41, 0x4c, 0x4c, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x59,
+ 0x50, 0x45, 0x5f, 0x41, 0x55, 0x54, 0x4f, 0x44, 0x45, 0x54, 0x45, 0x43, 0x54, 0x10, 0x00, 0x12,
+ 0x20, 0x0a, 0x1c, 0x4a, 0x49, 0x52, 0x41, 0x5f, 0x49, 0x4e, 0x53, 0x54, 0x41, 0x4c, 0x4c, 0x41,
+ 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x43, 0x4c, 0x4f, 0x55, 0x44, 0x10,
+ 0x01, 0x12, 0x26, 0x0a, 0x22, 0x4a, 0x49, 0x52, 0x41, 0x5f, 0x49, 0x4e, 0x53, 0x54, 0x41, 0x4c,
+ 0x4c, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x44, 0x41, 0x54, 0x41,
+ 0x5f, 0x43, 0x45, 0x4e, 0x54, 0x45, 0x52, 0x10, 0x02, 0x42, 0x3b, 0x5a, 0x39, 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, 0x73, 0x6f, 0x75,
+ 0x72, 0x63, 0x65, 0x73, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
diff --git a/pkg/pb/sourcespb/sources.pb.validate.go b/pkg/pb/sourcespb/sources.pb.validate.go
index 0f4e08b90..0398bcc21 100644
--- a/pkg/pb/sourcespb/sources.pb.validate.go
+++ b/pkg/pb/sourcespb/sources.pb.validate.go
@@ -2590,6 +2590,8 @@ func (m *GitHub) validate(all bool) error {
// no validation rules for PrintLegacyJson
+ // no validation rules for ScanAllInstallations
+
switch v := m.Credential.(type) {
case *GitHub_GithubApp:
if v == nil {
diff --git a/pkg/sources/github/connector.go b/pkg/sources/github/connector.go
index 126657cf7..494ab5d18 100644
--- a/pkg/sources/github/connector.go
+++ b/pkg/sources/github/connector.go
@@ -24,17 +24,18 @@ const (
type Connector interface {
// APIClient returns a configured GitHub client that can be used for GitHub API operations.
APIClient() *github.Client
+ // APIClientForRepo returns a GitHub API client scoped to the repository URL when needed.
+ APIClientForRepo(repoURL string) (*github.Client, error)
// GraphQLClient returns a client that can be used for GraphQL operations.
GraphQLClient() *githubv4.Client
+ // GraphQLClientForRepo returns a GitHub GraphQL client scoped to the repository URL when needed.
+ GraphQLClientForRepo(ctx context.Context, repoURL string) (*githubv4.Client, error)
// Clone clones a repository using the configured authentication information.
Clone(ctx context.Context, repoURL string, args ...string) (string, *gogit.Repository, error)
}
func newConnector(ctx context.Context, source *Source) (Connector, error) {
- apiEndpoint := source.conn.Endpoint
- if apiEndpoint == "" || endsWithGithub.MatchString(apiEndpoint) {
- apiEndpoint = cloudV3Endpoint
- }
+ apiEndpoint := canonicalAPIEndpoint(source.conn.Endpoint)
switch cred := source.conn.GetCredential().(type) {
case *sourcespb.GitHub_GithubApp:
diff --git a/pkg/sources/github/connector_app.go b/pkg/sources/github/connector_app.go
index 23089b63d..a9b0ea638 100644
--- a/pkg/sources/github/connector_app.go
+++ b/pkg/sources/github/connector_app.go
@@ -2,7 +2,9 @@ package github
import (
"fmt"
+ "net/http"
"strconv"
+ "sync"
"github.com/bradleyfalzon/ghinstallation/v2"
gogit "github.com/go-git/go-git/v5"
@@ -16,16 +18,32 @@ import (
)
type appConnector struct {
- apiClient *github.Client
- graphqlClient *githubv4.Client
installationClient *github.Client
installationID int64
- appsTransport *ghinstallation.AppsTransport
+ appID int64
+ appPrivateKey []byte
apiEndpoint string
+
+ mu sync.RWMutex
+ // clientsByInstallationID is scoped to this connector/source run and is
+ // bounded by the installations touched while scanning.
+ clientsByInstallationID map[int64]*appInstallationClients
+
+ // repoInstallationMap maps repo clone URLs to their owning installation
+ // ID for repos discovered from non-default installations. Clone checks
+ // this map to use the correct installation token.
+ repoInstallationMap map[string]int64
+}
+
+type appInstallationClients struct {
+ apiClient *github.Client
+ graphqlClient *githubv4.Client
}
var _ Connector = (*appConnector)(nil)
+const githubHTTPTimeoutSeconds = 60
+
func NewAppConnector(ctx context.Context, apiEndpoint string, app *credentialspb.GitHubApp) (Connector, error) {
installationID, err := strconv.ParseInt(app.InstallationId, 10, 64)
if err != nil {
@@ -34,69 +52,156 @@ func NewAppConnector(ctx context.Context, apiEndpoint string, app *credentialspb
appID, err := strconv.ParseInt(app.AppId, 10, 64)
if err != nil {
- return nil, fmt.Errorf("could not parse app ID %q: %w", appID, err)
+ return nil, fmt.Errorf("could not parse app ID %q: %w", app.AppId, err)
}
- const httpTimeoutSeconds = 60
- httpClient := common.RetryableHTTPClientTimeout(int64(httpTimeoutSeconds))
-
- installationTransport, err := ghinstallation.NewAppsTransport(
- httpClient.Transport,
- appID,
- []byte(app.PrivateKey))
+ installationTransport, err := newAppsTransport(apiEndpoint, appID, []byte(app.PrivateKey))
if err != nil {
return nil, fmt.Errorf("could not create installation client transport: %w", err)
}
- installationTransport.BaseURL = apiEndpoint
-
- installationHttpClient := common.RetryableHTTPClientTimeout(60)
- installationHttpClient.Transport = installationTransport
- installationClient, err := github.NewClient(installationHttpClient).WithEnterpriseURLs(apiEndpoint, apiEndpoint)
+ installationClient, err := newGitHubClientWithTransport(apiEndpoint, installationTransport)
if err != nil {
return nil, fmt.Errorf("could not create installation client: %w", err)
}
connector := &appConnector{
- installationClient: installationClient,
- installationID: installationID,
- appsTransport: installationTransport,
- apiEndpoint: apiEndpoint,
+ installationClient: installationClient,
+ installationID: installationID,
+ appID: appID,
+ appPrivateKey: []byte(app.PrivateKey),
+ apiEndpoint: apiEndpoint,
+ clientsByInstallationID: make(map[int64]*appInstallationClients),
+ repoInstallationMap: make(map[string]int64),
}
- apiClient, err := connector.APIClientForInstallation(installationID)
- if err != nil {
+ if _, err := connector.APIClientForInstallation(installationID); err != nil {
return nil, fmt.Errorf("could not create API client for configured installation: %w", err)
}
- connector.apiClient = apiClient
- graphqlClient, err := createGraphqlClient(ctx, apiClient.Client(), apiEndpoint)
- if err != nil {
+ if _, err := connector.graphqlClientForInstallation(ctx, installationID); err != nil {
return nil, fmt.Errorf("error creating GraphQL client: %w", err)
}
- connector.graphqlClient = graphqlClient
return connector, nil
}
func (c *appConnector) APIClient() *github.Client {
- return c.apiClient
+ c.mu.RLock()
+ defer c.mu.RUnlock()
+
+ if clients := c.clientsByInstallationID[c.installationID]; clients != nil {
+ return clients.apiClient
+ }
+ return nil
+}
+
+func (c *appConnector) APIClientForRepo(repoURL string) (*github.Client, error) {
+ installID, _ := c.installationIDForRepo(repoURL)
+ return c.APIClientForInstallation(installID)
+}
+
+func (c *appConnector) GraphQLClientForRepo(ctx context.Context, repoURL string) (*githubv4.Client, error) {
+ installID, _ := c.installationIDForRepo(repoURL)
+ return c.graphqlClientForInstallation(ctx, installID)
+}
+
+func (c *appConnector) graphqlClientForInstallation(ctx context.Context, installID int64) (*githubv4.Client, error) {
+ c.mu.RLock()
+ if clients := c.clientsByInstallationID[installID]; clients != nil && clients.graphqlClient != nil {
+ client := clients.graphqlClient
+ c.mu.RUnlock()
+ return client, nil
+ }
+ c.mu.RUnlock()
+
+ apiClient, err := c.APIClientForInstallation(installID)
+ if err != nil {
+ return nil, err
+ }
+ client, err := createGraphqlClient(ctx, apiClient.Client(), c.apiEndpoint)
+ if err != nil {
+ return nil, err
+ }
+
+ c.mu.Lock()
+ defer c.mu.Unlock()
+
+ clients := c.clientsForInstallationLocked(installID)
+ if clients.graphqlClient != nil {
+ return clients.graphqlClient, nil
+ }
+ if clients.apiClient == nil {
+ clients.apiClient = apiClient
+ }
+ clients.graphqlClient = client
+ return client, nil
}
func (c *appConnector) Clone(ctx context.Context, repoURL string, args ...string) (string, *gogit.Repository, error) {
+ installID, _ := c.installationIDForRepo(repoURL)
+
// TODO: Check rate limit for this call.
token, _, err := c.installationClient.Apps.CreateInstallationToken(
ctx,
- c.installationID,
+ installID,
&github.InstallationTokenOptions{})
if err != nil {
- return "", nil, fmt.Errorf("could not create installation token: %w", err)
+ return "", nil, fmt.Errorf("could not create installation token for installation %d: %w", installID, err)
}
return git.CloneRepoUsingToken(ctx, token.GetToken(), repoURL, "", "x-access-token", true, args...)
}
+// installationIDForRepo returns the mapped installation ID for repoURL. When no
+// mapping exists, it falls back to the configured installation and returns false.
+func (c *appConnector) installationIDForRepo(repoURL string) (int64, bool) {
+ c.mu.RLock()
+ defer c.mu.RUnlock()
+
+ if id, ok := c.repoInstallationMap[repoURL]; ok {
+ return id, true
+ }
+ return c.installationID, false
+}
+
+func (c *appConnector) hasRepoInstallation(repoURL string) bool {
+ c.mu.RLock()
+ defer c.mu.RUnlock()
+
+ _, ok := c.repoInstallationMap[repoURL]
+ return ok
+}
+
+// setRepoInstallation records which installation owns a repo and its derived
+// wiki URL so Clone uses the correct installation token for cross-org repos.
+func (c *appConnector) setRepoInstallation(repoURL string, installationID int64) {
+ c.setRepoInstallationForWiki(repoURL, installationID, wikiCloneURLForRepo)
+}
+
+func (c *appConnector) setRepoInstallationForRepoName(repoURL, repoName string, installationID int64) {
+ c.setRepoInstallationForWiki(repoURL, installationID, func(repoURL string) (string, bool) {
+ return wikiCloneURLForRepoName(repoURL, repoName)
+ })
+}
+
+func (c *appConnector) setRepoInstallationForWiki(repoURL string, installationID int64, wikiURLForRepo func(string) (string, bool)) {
+ c.mu.Lock()
+ defer c.mu.Unlock()
+
+ c.repoInstallationMap[repoURL] = installationID
+ if wikiURL, ok := wikiURLForRepo(repoURL); ok {
+ c.repoInstallationMap[wikiURL] = installationID
+ }
+}
+
func (c *appConnector) GraphQLClient() *githubv4.Client {
- return c.graphqlClient
+ c.mu.RLock()
+ defer c.mu.RUnlock()
+
+ if clients := c.clientsByInstallationID[c.installationID]; clients != nil {
+ return clients.graphqlClient
+ }
+ return nil
}
func (c *appConnector) InstallationClient() *github.Client {
@@ -108,15 +213,67 @@ func (c *appConnector) InstallationClient() *github.Client {
// orgs — each org's API calls must use that org's installation token to get
// proper IP allowlist bypass and permission scoping.
func (c *appConnector) APIClientForInstallation(installationID int64) (*github.Client, error) {
- transport := ghinstallation.NewFromAppsTransport(c.appsTransport, installationID)
- transport.BaseURL = c.apiEndpoint
+ c.mu.RLock()
+ if clients := c.clientsByInstallationID[installationID]; clients != nil && clients.apiClient != nil {
+ client := clients.apiClient
+ c.mu.RUnlock()
+ return client, nil
+ }
+ c.mu.RUnlock()
- httpClient := common.RetryableHTTPClientTimeout(60)
- httpClient.Transport = transport
+ client, err := c.createAPIClientForInstallation(installationID)
+ if err != nil {
+ return nil, err
+ }
+
+ c.mu.Lock()
+ defer c.mu.Unlock()
- client, err := github.NewClient(httpClient).WithEnterpriseURLs(c.apiEndpoint, c.apiEndpoint)
+ clients := c.clientsForInstallationLocked(installationID)
+ if clients.apiClient != nil {
+ return clients.apiClient, nil
+ }
+ clients.apiClient = client
+ return client, nil
+}
+
+func (c *appConnector) clientsForInstallationLocked(installationID int64) *appInstallationClients {
+ clients := c.clientsByInstallationID[installationID]
+ if clients == nil {
+ clients = &appInstallationClients{}
+ c.clientsByInstallationID[installationID] = clients
+ }
+ return clients
+}
+
+func (c *appConnector) createAPIClientForInstallation(installationID int64) (*github.Client, error) {
+ appsTransport, err := newAppsTransport(c.apiEndpoint, c.appID, c.appPrivateKey)
+ if err != nil {
+ return nil, fmt.Errorf("could not create app transport for installation %d: %w", installationID, err)
+ }
+
+ transport := ghinstallation.NewFromAppsTransport(appsTransport, installationID)
+ transport.BaseURL = c.apiEndpoint
+
+ client, err := newGitHubClientWithTransport(c.apiEndpoint, transport)
if err != nil {
return nil, fmt.Errorf("could not create API client for installation %d: %w", installationID, err)
}
return client, nil
}
+
+func newAppsTransport(apiEndpoint string, appID int64, privateKey []byte) (*ghinstallation.AppsTransport, error) {
+ httpClient := common.RetryableHTTPClientTimeout(githubHTTPTimeoutSeconds)
+ appsTransport, err := ghinstallation.NewAppsTransport(httpClient.Transport, appID, privateKey)
+ if err != nil {
+ return nil, err
+ }
+ appsTransport.BaseURL = apiEndpoint
+ return appsTransport, nil
+}
+
+func newGitHubClientWithTransport(apiEndpoint string, transport http.RoundTripper) (*github.Client, error) {
+ httpClient := common.RetryableHTTPClientTimeout(githubHTTPTimeoutSeconds)
+ httpClient.Transport = transport
+ return github.NewClient(httpClient).WithEnterpriseURLs(apiEndpoint, apiEndpoint)
+}
diff --git a/pkg/sources/github/connector_app_test.go b/pkg/sources/github/connector_app_test.go
index ca6280db0..9d1cbfa87 100644
--- a/pkg/sources/github/connector_app_test.go
+++ b/pkg/sources/github/connector_app_test.go
@@ -12,8 +12,8 @@ import (
"sync"
"testing"
- "github.com/bradleyfalzon/ghinstallation/v2"
"github.com/google/go-github/v67/github"
+ "github.com/shurcooL/githubv4"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -56,17 +56,11 @@ func TestAPIClientForInstallation(t *testing.T) {
}))
defer server.Close()
- appsTransport, err := ghinstallation.NewAppsTransport(
- http.DefaultTransport,
- 12345,
- privKey,
- )
- require.NoError(t, err)
- appsTransport.BaseURL = server.URL
-
connector := &appConnector{
- appsTransport: appsTransport,
- apiEndpoint: server.URL,
+ appID: 12345,
+ appPrivateKey: privKey,
+ apiEndpoint: server.URL,
+ clientsByInstallationID: make(map[int64]*appInstallationClients),
}
t.Run("creates distinct clients for different installations", func(t *testing.T) {
@@ -81,6 +75,15 @@ func TestAPIClientForInstallation(t *testing.T) {
assert.NotSame(t, client1, client2, "should be different client instances")
})
+ t.Run("reuses clients for the same installation", func(t *testing.T) {
+ client1, err := connector.APIClientForInstallation(333)
+ require.NoError(t, err)
+ client2, err := connector.APIClientForInstallation(333)
+ require.NoError(t, err)
+
+ assert.Same(t, client1, client2)
+ })
+
t.Run("returned client uses the correct installation ID", func(t *testing.T) {
mu.Lock()
tokenRequestPaths = nil
@@ -151,6 +154,16 @@ func TestNewAppConnectorDefaultAPIClientUsesConfiguredInstallation(t *testing.T)
AppId: "12345",
})
require.NoError(t, err)
+ require.NotNil(t, connector.APIClient())
+ require.NotNil(t, connector.GraphQLClient())
+
+ gotAPIClient, err := connector.APIClientForRepo("https://github.com/default-org/repo.git")
+ require.NoError(t, err)
+ assert.Same(t, connector.APIClient(), gotAPIClient)
+
+ gotGraphQLClient, err := connector.GraphQLClientForRepo(trContext.Background(), "https://github.com/default-org/repo.git")
+ require.NoError(t, err)
+ assert.Same(t, connector.GraphQLClient(), gotGraphQLClient)
_, _, err = connector.APIClient().Organizations.ListMembers(trContext.Background(), "test-org", nil)
require.NoError(t, err)
@@ -161,6 +174,168 @@ func TestNewAppConnectorDefaultAPIClientUsesConfiguredInstallation(t *testing.T)
assert.Contains(t, tokenRequestPaths[0], "/app/installations/4242/access_tokens")
}
+func TestAPIClientForInstallationUsesConfiguredClient(t *testing.T) {
+ defaultClient := github.NewClient(nil)
+ connector := &appConnector{
+ installationID: 100,
+ clientsByInstallationID: map[int64]*appInstallationClients{
+ 100: {apiClient: defaultClient},
+ },
+ }
+
+ got, err := connector.APIClientForInstallation(100)
+ require.NoError(t, err)
+ assert.Same(t, defaultClient, got)
+}
+
+func TestCloneUsesRepoInstallationMap(t *testing.T) {
+ connector := &appConnector{
+ installationID: 100,
+ repoInstallationMap: make(map[string]int64),
+ }
+
+ t.Run("uses default installation when no mapping exists", func(t *testing.T) {
+ installationID, mapped := connector.installationIDForRepo("https://github.com/default-org/repo.git")
+ assert.False(t, mapped)
+ assert.Equal(t, int64(100), installationID)
+ })
+
+ t.Run("uses mapped installation for cross-org repos", func(t *testing.T) {
+ connector.setRepoInstallation("https://github.com/other-org/repo.git", 999)
+ installationID, mapped := connector.installationIDForRepo("https://github.com/other-org/repo.git")
+ assert.True(t, mapped)
+ assert.Equal(t, int64(999), installationID)
+ })
+
+ t.Run("uses mapped installation for derived wiki URLs", func(t *testing.T) {
+ connector.setRepoInstallation("https://github.com/wiki-org/repo.git", 888)
+ installationID, mapped := connector.installationIDForRepo("https://github.com/wiki-org/repo.wiki.git")
+ assert.True(t, mapped)
+ assert.Equal(t, int64(888), installationID)
+ })
+}
+
+func TestAPIClientForRepoUsesRepoInstallationMap(t *testing.T) {
+ privKey := generateTestPrivateKey(t)
+
+ var mu sync.Mutex
+ var tokenRequestPaths []string
+
+ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ w.Header().Set("Content-Type", "application/json")
+
+ if r.Method == http.MethodPost && strings.Contains(r.URL.Path, "access_tokens") {
+ mu.Lock()
+ tokenRequestPaths = append(tokenRequestPaths, r.URL.Path)
+ mu.Unlock()
+ _ = json.NewEncoder(w).Encode(map[string]interface{}{
+ "token": "test-token",
+ "expires_at": "2099-01-01T00:00:00Z",
+ })
+ return
+ }
+
+ _ = json.NewEncoder(w).Encode([]map[string]string{{"login": "alice"}})
+ }))
+ defer server.Close()
+
+ connector := &appConnector{
+ installationID: 100,
+ appID: 12345,
+ appPrivateKey: privKey,
+ apiEndpoint: server.URL,
+ clientsByInstallationID: make(map[int64]*appInstallationClients),
+ repoInstallationMap: make(map[string]int64),
+ }
+ connector.setRepoInstallation("https://github.com/other-org/repo.git", 999)
+
+ client, err := connector.APIClientForRepo("https://github.com/other-org/repo.git")
+ require.NoError(t, err)
+ cachedClient, err := connector.APIClientForRepo("https://github.com/other-org/repo.git")
+ require.NoError(t, err)
+ assert.Same(t, client, cachedClient)
+
+ _, _, _ = client.Organizations.ListMembers(trContext.Background(), "test-org", nil)
+
+ mu.Lock()
+ defer mu.Unlock()
+ require.Len(t, tokenRequestPaths, 1)
+ assert.Contains(t, tokenRequestPaths[0], "/app/installations/999/access_tokens")
+}
+
+func TestGraphQLClientForRepoCachesClients(t *testing.T) {
+ privKey := generateTestPrivateKey(t)
+
+ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ w.Header().Set("Content-Type", "application/json")
+ _ = json.NewEncoder(w).Encode(map[string]interface{}{})
+ }))
+ defer server.Close()
+
+ defaultGraphQLClient := &githubv4.Client{}
+ connector := &appConnector{
+ installationID: 100,
+ appID: 12345,
+ appPrivateKey: privKey,
+ apiEndpoint: server.URL,
+ clientsByInstallationID: map[int64]*appInstallationClients{
+ 100: {graphqlClient: defaultGraphQLClient},
+ },
+ repoInstallationMap: make(map[string]int64),
+ }
+ connector.setRepoInstallation("https://github.com/other-org/repo.git", 999)
+
+ ctx := trContext.Background()
+
+ t.Run("returns default client for default installation repos", func(t *testing.T) {
+ got, err := connector.GraphQLClientForRepo(ctx, "https://github.com/default-org/repo.git")
+ require.NoError(t, err)
+ assert.Same(t, defaultGraphQLClient, got)
+ })
+
+ t.Run("caches clients for non-default installations", func(t *testing.T) {
+ client1, err := connector.GraphQLClientForRepo(ctx, "https://github.com/other-org/repo.git")
+ require.NoError(t, err)
+ assert.NotSame(t, defaultGraphQLClient, client1)
+
+ client2, err := connector.GraphQLClientForRepo(ctx, "https://github.com/other-org/repo.git")
+ require.NoError(t, err)
+ assert.Same(t, client1, client2)
+
+ apiClient, err := connector.APIClientForRepo("https://github.com/other-org/repo.git")
+ require.NoError(t, err)
+
+ connector.mu.RLock()
+ cachedClients := connector.clientsByInstallationID[999]
+ connector.mu.RUnlock()
+ require.NotNil(t, cachedClients)
+ assert.Same(t, apiClient, cachedClients.apiClient)
+ assert.Same(t, client1, cachedClients.graphqlClient)
+ })
+}
+
+func TestDefaultConnectorsReturnDefaultClientsForRepo(t *testing.T) {
+ ctx := trContext.Background()
+ apiClient := github.NewClient(nil)
+ graphqlClient := &githubv4.Client{}
+
+ connectors := []Connector{
+ &basicAuthConnector{apiClient: apiClient, graphqlClient: graphqlClient},
+ &tokenConnector{apiClient: apiClient, graphqlClient: graphqlClient},
+ &unauthenticatedConnector{apiClient: apiClient, graphqlClient: graphqlClient},
+ }
+
+ for _, connector := range connectors {
+ gotAPIClient, err := connector.APIClientForRepo("https://github.com/trufflesecurity/trufflehog.git")
+ require.NoError(t, err)
+ assert.Same(t, apiClient, gotAPIClient)
+
+ gotGraphQLClient, err := connector.GraphQLClientForRepo(ctx, "https://github.com/trufflesecurity/trufflehog.git")
+ require.NoError(t, err)
+ assert.Same(t, graphqlClient, gotGraphQLClient)
+ }
+}
+
func TestAddMembersByOrgWithClient(t *testing.T) {
strPtr := func(s string) *string { return &s }
memberPage := []*github.User{
diff --git a/pkg/sources/github/connector_basicauth.go b/pkg/sources/github/connector_basicauth.go
index 94aae56ab..1b5e218a7 100644
--- a/pkg/sources/github/connector_basicauth.go
+++ b/pkg/sources/github/connector_basicauth.go
@@ -54,6 +54,10 @@ func (c *basicAuthConnector) APIClient() *github.Client {
return c.apiClient
}
+func (c *basicAuthConnector) APIClientForRepo(_ string) (*github.Client, error) {
+ return c.apiClient, nil
+}
+
func (c *basicAuthConnector) Clone(ctx context.Context, repoURL string, args ...string) (string, *gogit.Repository, error) {
return git.CloneRepoUsingToken(ctx, c.password, repoURL, c.clonePath, c.username, true, args...)
}
@@ -61,3 +65,7 @@ func (c *basicAuthConnector) Clone(ctx context.Context, repoURL string, args ...
func (c *basicAuthConnector) GraphQLClient() *githubv4.Client {
return c.graphqlClient
}
+
+func (c *basicAuthConnector) GraphQLClientForRepo(_ context.Context, _ string) (*githubv4.Client, error) {
+ return c.graphqlClient, nil
+}
diff --git a/pkg/sources/github/connector_token.go b/pkg/sources/github/connector_token.go
index 9bba8c124..fc878c07e 100644
--- a/pkg/sources/github/connector_token.go
+++ b/pkg/sources/github/connector_token.go
@@ -64,6 +64,10 @@ func (c *tokenConnector) APIClient() *github.Client {
return c.apiClient
}
+func (c *tokenConnector) APIClientForRepo(_ string) (*github.Client, error) {
+ return c.apiClient, nil
+}
+
func (c *tokenConnector) Clone(ctx context.Context, repoURL string, args ...string) (string, *gogit.Repository, error) {
if err := c.setUserIfUnset(ctx); err != nil {
return "", nil, err
@@ -76,6 +80,10 @@ func (c *tokenConnector) GraphQLClient() *githubv4.Client {
return c.graphqlClient
}
+func (c *tokenConnector) GraphQLClientForRepo(_ context.Context, _ string) (*githubv4.Client, error) {
+ return c.graphqlClient, nil
+}
+
func (c *tokenConnector) IsGithubEnterprise() bool {
return c.isGitHubEnterprise
}
diff --git a/pkg/sources/github/connector_unauthenticated.go b/pkg/sources/github/connector_unauthenticated.go
index 8f93baa83..792a0084d 100644
--- a/pkg/sources/github/connector_unauthenticated.go
+++ b/pkg/sources/github/connector_unauthenticated.go
@@ -45,6 +45,10 @@ func (c *unauthenticatedConnector) APIClient() *github.Client {
return c.apiClient
}
+func (c *unauthenticatedConnector) APIClientForRepo(_ string) (*github.Client, error) {
+ return c.apiClient, nil
+}
+
func (c *unauthenticatedConnector) Clone(ctx context.Context, repoURL string, args ...string) (string, *gogit.Repository, error) {
return git.CloneRepoUsingUnauthenticated(ctx, repoURL, c.clonePath, args...)
}
@@ -52,3 +56,7 @@ func (c *unauthenticatedConnector) Clone(ctx context.Context, repoURL string, ar
func (c *unauthenticatedConnector) GraphQLClient() *githubv4.Client {
return c.graphqlClient
}
+
+func (c *unauthenticatedConnector) GraphQLClientForRepo(_ context.Context, _ string) (*githubv4.Client, error) {
+ return c.graphqlClient, nil
+}
diff --git a/pkg/sources/github/github.go b/pkg/sources/github/github.go
index 19086f8bd..8253981cd 100644
--- a/pkg/sources/github/github.go
+++ b/pkg/sources/github/github.go
@@ -9,7 +9,6 @@ import (
"net/url"
"os"
"path/filepath"
- "regexp"
"slices"
"sort"
"strings"
@@ -17,8 +16,10 @@ import (
"sync/atomic"
"time"
+ "github.com/go-git/go-git/v5/plumbing"
"github.com/gobwas/glob"
"github.com/google/go-github/v67/github"
+ "github.com/shurcooL/githubv4"
"golang.org/x/sync/errgroup"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/types/known/anypb"
@@ -64,11 +65,14 @@ type Source struct {
scanOptMu sync.Mutex // protects the scanOptions
scanOptions *git.ScanOptions
- conn *sourcespb.GitHub
- jobPool *errgroup.Group
- resumeInfoMutex sync.Mutex
- resumeInfoSlice []string
- connector Connector
+ conn *sourcespb.GitHub
+ jobPool *errgroup.Group
+ resumeInfoMutex sync.Mutex
+ resumeInfoSlice []string
+ connector Connector
+ appInstallationsMu sync.Mutex
+ appInstallations []*github.Installation
+ appInstallationsLoaded bool
includePRComments bool
includeIssueComments bool
@@ -127,8 +131,6 @@ var _ sources.Source = (*Source)(nil)
var _ sources.SourceUnitUnmarshaller = (*Source)(nil)
var _ sources.SourceUnitEnumChunker = (*Source)(nil)
-var endsWithGithub = regexp.MustCompile(`github\.com/?$`)
-
// Type returns the type of source.
// It is used for matching source types in configuration and job input.
func (s *Source) Type() sourcespb.SourceType {
@@ -239,6 +241,7 @@ func (s *Source) Init(aCtx context.Context, name string, jobID sources.JobID, so
// configuration uses the inverse logic of the `useAuthInUrl` flag.
s.useAuthInUrl = !s.conn.RemoveAuthInUrl
+ s.resetAppInstallations()
connector, err := newConnector(aCtx, s)
if err != nil {
@@ -279,6 +282,17 @@ func (s *Source) Init(aCtx context.Context, name string, jobID sources.JobID, so
return fmt.Errorf("cannot specify head or base with multiple repositories")
}
+ if connector, ok := s.connector.(*appConnector); ok && s.conn.ScanAllInstallations {
+ if _, err := s.getAppInstallations(aCtx, connector); err != nil {
+ return err
+ }
+ if len(s.repos) > 0 {
+ if err := s.mapExplicitReposToInstallations(aCtx, connector); err != nil {
+ return err
+ }
+ }
+ }
+
cfg := &git.Config{
SourceName: s.name,
JobID: s.jobID,
@@ -331,8 +345,10 @@ func (s *Source) Validate(ctx context.Context) []error {
func (s *Source) visibilityOf(ctx context.Context, repoURL string) source_metadatapb.Visibility {
// It isn't possible to get the visibility of a wiki.
// We must use the visibility of the corresponding repository.
- if strings.HasSuffix(repoURL, ".wiki.git") {
- repoURL = strings.TrimSuffix(repoURL, ".wiki.git") + ".git"
+ if _, ok := s.repoInfoCache.get(repoURL); !ok {
+ if parentRepoURL, isWiki := repoCloneURLForWikiCloneURL(repoURL); isWiki {
+ repoURL = parentRepoURL
+ }
}
repoInfo, ok := s.repoInfoCache.get(repoURL)
@@ -364,17 +380,22 @@ func (s *Source) Chunks(ctx context.Context, chunksChan chan *sources.Chunk, tar
// We don't care about handling enumerated values as they happen during
// the normal Chunks flow because we enumerate and scan in two steps.
+ var enumerationErrs []error
noopReporter := sources.VisitorReporter{
VisitUnit: func(context.Context, sources.SourceUnit) error {
return nil
},
+ VisitErr: func(ctx context.Context, err error) error {
+ enumerationErrs = append(enumerationErrs, err)
+ return ctx.Err()
+ },
}
err := s.Enumerate(ctx, noopReporter)
if err != nil {
- return fmt.Errorf("error enumerating: %w", err)
+ return errors.Join(fmt.Errorf("error enumerating: %w", err), errors.Join(enumerationErrs...))
}
- return s.scan(ctx, chunksReporter)
+ return errors.Join(append(enumerationErrs, s.scan(ctx, chunksReporter))...)
}
// Enumerate enumerates the GitHub source based on authentication method and
@@ -509,7 +530,12 @@ func (s *Source) ensureRepoInfoCache(ctx context.Context, repo string, reporter
} else {
// Cache repository info.
for {
- ghRepo, _, err := s.connector.APIClient().Repositories.Get(ctx, urlParts[1], urlParts[2])
+ apiClient, err := s.connector.APIClientForRepo(repo)
+ if err != nil {
+ return repo, fmt.Errorf("failed to create API client for repository: %w", err)
+ }
+
+ ghRepo, _, err := apiClient.Repositories.Get(ctx, urlParts[1], urlParts[2])
if s.handleRateLimit(ctx, err, reporter) {
continue
}
@@ -634,8 +660,14 @@ func (s *Source) enumerateWithToken(ctx context.Context, isGithubEnterprise bool
func (s *Source) enumerateWithApp(ctx context.Context, connector *appConnector, reporter sources.UnitReporter) error {
// If no repos were provided, enumerate them.
if len(s.repos) == 0 {
- if err := s.getReposByApp(ctx, reporter); err != nil {
- return err
+ if s.conn.ScanAllInstallations {
+ if err := s.enumerateAllInstallationRepos(ctx, connector, reporter); err != nil {
+ return err
+ }
+ } else {
+ if err := s.getReposByApp(ctx, reporter); err != nil {
+ return err
+ }
}
// Check if we need to find user repos.
@@ -663,6 +695,444 @@ func (s *Source) enumerateWithApp(ctx context.Context, connector *appConnector,
return nil
}
+func (s *Source) resetAppInstallations() {
+ s.appInstallationsMu.Lock()
+ defer s.appInstallationsMu.Unlock()
+
+ s.appInstallations = nil
+ s.appInstallationsLoaded = false
+}
+
+func (s *Source) getAppInstallations(ctx context.Context, connector *appConnector) ([]*github.Installation, error) {
+ s.appInstallationsMu.Lock()
+ defer s.appInstallationsMu.Unlock()
+
+ if s.appInstallationsLoaded {
+ return s.appInstallations, nil
+ }
+
+ installs, err := s.listAppInstallations(ctx, connector, defaultPagination)
+ if err != nil {
+ return nil, err
+ }
+ s.appInstallations = installs
+ s.appInstallationsLoaded = true
+ return s.appInstallations, nil
+}
+
+func (s *Source) listAppInstallations(
+ ctx context.Context,
+ connector *appConnector,
+ perPage int,
+) ([]*github.Installation, error) {
+ installationClient := connector.InstallationClient()
+ opts := &github.ListOptions{PerPage: perPage}
+
+ var allInstalls []*github.Installation
+ for {
+ installs, res, err := installationClient.Apps.ListInstallations(ctx, opts)
+ if s.handleRateLimit(ctx, err) {
+ continue
+ }
+ if err != nil {
+ return nil, fmt.Errorf("could not list installations: %w", err)
+ }
+ allInstalls = append(allInstalls, installs...)
+ if res == nil || res.NextPage == 0 {
+ break
+ }
+ opts.Page = res.NextPage
+ }
+
+ return allInstalls, nil
+}
+
+func (s *Source) listAppInstallationRepoPage(
+ ctx context.Context,
+ client *github.Client,
+ opts *github.ListOptions,
+ handleRateLimit func(error) bool,
+) ([]*github.Repository, *github.Response, error) {
+ for {
+ result, res, err := client.Apps.ListRepos(ctx, opts)
+ if handleRateLimit(err) {
+ continue
+ }
+ if result == nil {
+ return nil, res, err
+ }
+ if result.Repositories == nil {
+ return []*github.Repository{}, res, err
+ }
+ return result.Repositories, res, err
+ }
+}
+
+// enumerateAllInstallationRepos discovers repos from every installation of the
+// GitHub App. For each installation, it creates a per-installation API client
+// and records the installation ID for each repo so Clone uses the correct token.
+// Per-installation failures are reported through the unit reporter and don't
+// abort enumeration of the remaining installations.
+func (s *Source) enumerateAllInstallationRepos(ctx context.Context, connector *appConnector, reporter sources.UnitReporter) error {
+ installs, err := s.getAppInstallations(ctx, connector)
+ if err != nil {
+ return err
+ }
+
+ for _, install := range installs {
+ installID := install.GetID()
+ account := install.GetAccount().GetLogin()
+ installCtx := context.WithValues(ctx, "org", account, "installation_id", installID)
+ installCtx.Logger().Info("Enumerating repos from GitHub App installation")
+
+ client, err := connector.APIClientForInstallation(installID)
+ if err != nil {
+ installCtx.Logger().Error(err, "could not create API client for installation")
+ if err := reporter.UnitErr(installCtx, fmt.Errorf("could not create API client for installation %d: %w", installID, err)); err != nil {
+ return err
+ }
+ continue
+ }
+
+ listRepos := func(ctx context.Context, _ string, opts repoListOptions) ([]*github.Repository, *github.Response, error) {
+ repos, resp, err := s.listAppInstallationRepoPage(ctx, client, opts.getListOptions(), func(err error) bool {
+ return s.handleRateLimitWithUnitReporter(ctx, reporter, err)
+ })
+ for _, r := range repos {
+ connector.setRepoInstallationForRepoName(r.GetCloneURL(), r.GetName(), installID)
+ }
+ return repos, resp, err
+ }
+
+ if err := s.processRepos(installCtx, account, reporter, listRepos, &appListOptions{
+ ListOptions: github.ListOptions{PerPage: defaultPagination},
+ }); err != nil {
+ installCtx.Logger().Error(err, "error enumerating repos for installation")
+ if err := reporter.UnitErr(installCtx, fmt.Errorf("error enumerating repos for installation %d: %w", installID, err)); err != nil {
+ return err
+ }
+ continue
+ }
+ }
+
+ return nil
+}
+
+func (s *Source) mapExplicitReposToInstallations(ctx context.Context, connector *appConnector) error {
+ return s.mapReposToInstallations(ctx, connector, s.repos)
+}
+
+type repoMappingRequest struct {
+ original string
+ normalized string
+ lookupURLs []string
+ lookupKeys []string
+}
+
+func (s *Source) mapReposToInstallations(ctx context.Context, connector *appConnector, repos []string) error {
+ if len(repos) == 0 {
+ return nil
+ }
+
+ wantedRepos := make(map[string]repoMappingRequest, len(repos))
+ for _, repo := range repos {
+ normalized, err := s.normalizeRepo(repo)
+ if err != nil {
+ return fmt.Errorf("could not normalize configured repo %q: %w", repo, err)
+ }
+ if connector.hasRepoInstallation(repo) || connector.hasRepoInstallation(normalized) {
+ continue
+ }
+ request := repoMappingRequest{
+ original: repo,
+ normalized: normalized,
+ lookupURLs: repoURLsForInstallationLookup(normalized),
+ }
+ for _, lookupURL := range request.lookupURLs {
+ key, err := repoHostOwnerNameKey(lookupURL)
+ if err != nil {
+ return fmt.Errorf("could not parse configured repo %q: %w", repo, err)
+ }
+ request.lookupKeys = append(request.lookupKeys, key)
+ }
+ // During installation repo listing, only allow exact matches. If no
+ // exact repo exists, mapRemainingReposByMetadata tries wiki-parent
+ // fallbacks afterward.
+ wantedRepos[request.lookupKeys[0]] = request
+ }
+ if len(wantedRepos) == 0 {
+ return nil
+ }
+
+ installs, err := s.getAppInstallations(ctx, connector)
+ if err != nil {
+ return err
+ }
+
+ var errs error
+ clients := make(map[int64]*github.Client, len(installs))
+ installedRepoKeys := make(map[int64]map[string]struct{}, len(installs))
+ for _, install := range installs {
+ installID := install.GetID()
+ client, err := connector.APIClientForInstallation(installID)
+ if err != nil {
+ errs = errors.Join(errs, fmt.Errorf("could not create API client for installation %d: %w", installID, err))
+ continue
+ }
+ clients[installID] = client
+
+ opts := &github.ListOptions{PerPage: defaultPagination}
+ for {
+ repos, res, err := s.listAppInstallationRepoPage(ctx, client, opts, func(err error) bool {
+ return s.handleRateLimit(ctx, err)
+ })
+ if err != nil {
+ errs = errors.Join(errs, fmt.Errorf("could not list repos for installation %d: %w", installID, err))
+ break
+ }
+
+ if repos != nil {
+ if installedRepoKeys[installID] == nil {
+ installedRepoKeys[installID] = make(map[string]struct{}, len(repos))
+ }
+ for _, repo := range repos {
+ key, err := repoHostOwnerNameKey(repo.GetCloneURL())
+ if err == nil {
+ installedRepoKeys[installID][key] = struct{}{}
+ }
+ }
+ s.recordInstallationRepoMatches(connector, installID, repos, wantedRepos)
+ if len(wantedRepos) == 0 {
+ if errs != nil {
+ ctx.Logger().Error(errs, "some installations could not be fully enumerated while mapping repos")
+ }
+ return nil
+ }
+ }
+
+ if res == nil || res.NextPage == 0 {
+ break
+ }
+ opts.Page = res.NextPage
+ }
+ }
+
+ if len(wantedRepos) > 0 {
+ errs = errors.Join(errs, s.mapRemainingReposByMetadata(ctx, connector, installs, clients, installedRepoKeys, wantedRepos))
+ if len(wantedRepos) == 0 {
+ if errs != nil {
+ ctx.Logger().Error(errs, "some installations could not be fully enumerated while mapping repos")
+ }
+ return nil
+ }
+ }
+
+ if len(wantedRepos) > 0 {
+ unmatched := make([]string, 0, len(wantedRepos))
+ for _, requested := range wantedRepos {
+ unmatched = append(unmatched, requested.original)
+ }
+ sort.Strings(unmatched)
+ errs = errors.Join(errs, fmt.Errorf("configured repos were not found in any GitHub App installation: %s", strings.Join(unmatched, ", ")))
+ }
+
+ return errs
+}
+
+func (s *Source) recordInstallationRepoMatches(connector *appConnector, installationID int64, repos []*github.Repository, wantedRepos map[string]repoMappingRequest) {
+ for _, repo := range repos {
+ cloneURL := repo.GetCloneURL()
+ key, err := repoHostOwnerNameKey(cloneURL)
+ if err != nil {
+ continue
+ }
+ requested, ok := wantedRepos[key]
+ if !ok {
+ continue
+ }
+ deleteRepoMappingRequest(wantedRepos, requested)
+ s.recordRepoInstallation(connector, installationID, repo, requested)
+ }
+}
+
+func deleteRepoMappingRequest(wantedRepos map[string]repoMappingRequest, requested repoMappingRequest) {
+ if len(requested.lookupKeys) > 0 {
+ delete(wantedRepos, requested.lookupKeys[0])
+ }
+}
+
+func (s *Source) mapRemainingReposByMetadata(
+ ctx context.Context,
+ connector *appConnector,
+ installs []*github.Installation,
+ clients map[int64]*github.Client,
+ installedRepoKeys map[int64]map[string]struct{},
+ wantedRepos map[string]repoMappingRequest,
+) error {
+ var errs error
+ for _, install := range installs {
+ if len(wantedRepos) == 0 {
+ return errs
+ }
+
+ installID := install.GetID()
+ client, ok := clients[installID]
+ if !ok {
+ continue
+ }
+
+ for _, requested := range wantedRepos {
+ for i, lookupURL := range requested.lookupURLs {
+ _, parts, err := getRepoURLParts(lookupURL)
+ if err != nil {
+ errs = errors.Join(errs, fmt.Errorf("could not parse configured repo %q: %w", requested.original, err))
+ break
+ }
+
+ var repo *github.Repository
+ for {
+ repo, _, err = client.Repositories.Get(ctx, parts[1], parts[2])
+ if s.handleRateLimit(ctx, err) {
+ continue
+ }
+ break
+ }
+ if err != nil {
+ if isGitHub404Error(err) {
+ continue
+ }
+ errs = errors.Join(errs, fmt.Errorf("could not fetch repo %q for installation %d: %w", requested.original, installID, err))
+ break
+ }
+ canonicalKey, err := repoHostOwnerNameKey(repo.GetCloneURL())
+ if err != nil {
+ errs = errors.Join(errs, fmt.Errorf("could not parse fetched repo %q for installation %d: %w", repo.GetCloneURL(), installID, err))
+ continue
+ }
+ if _, ok := installedRepoKeys[installID][canonicalKey]; !ok {
+ continue
+ }
+ if !sameRepoHost(requested.normalized, repo.GetCloneURL()) {
+ if i == 0 {
+ break
+ }
+ continue
+ }
+
+ deleteRepoMappingRequest(wantedRepos, requested)
+ s.recordRepoInstallation(connector, installID, repo, requested)
+ if len(wantedRepos) == 0 {
+ return errs
+ }
+ break
+ }
+ }
+ }
+ return errs
+}
+
+func (s *Source) recordRepoInstallation(connector *appConnector, installationID int64, repo *github.Repository, requested repoMappingRequest) {
+ cloneURL := repo.GetCloneURL()
+ connector.setRepoInstallationForRepoName(cloneURL, repo.GetName(), installationID)
+ if requested.normalized != cloneURL && sameRepoHost(requested.normalized, cloneURL) {
+ connector.setRepoInstallation(requested.normalized, installationID)
+ }
+ if requested.original != requested.normalized && requested.original != cloneURL && sameRepoHost(requested.original, cloneURL) {
+ connector.setRepoInstallation(requested.original, installationID)
+ }
+
+ s.cacheRepoInfo(repo)
+ if info, ok := s.repoInfoCache.get(cloneURL); ok {
+ if requested.normalized != cloneURL && sameRepoHost(requested.normalized, cloneURL) {
+ s.repoInfoCache.put(requested.normalized, info)
+ }
+ if requested.original != requested.normalized && requested.original != cloneURL && sameRepoHost(requested.original, cloneURL) {
+ s.repoInfoCache.put(requested.original, info)
+ }
+ }
+}
+
+func repoHostOwnerNameKey(repoURL string) (string, error) {
+ _, parts, err := getRepoURLParts(repoURL)
+ if err != nil {
+ return "", err
+ }
+ if len(parts) != 3 {
+ return "", fmt.Errorf("expected repository URL, got %q", repoURL)
+ }
+ return strings.ToLower(parts[0] + "/" + parts[1] + "/" + parts[2]), nil
+}
+
+func sameRepoHost(repoURL, otherRepoURL string) bool {
+ _, parts, err := getRepoURLParts(repoURL)
+ if err != nil {
+ return false
+ }
+ _, otherParts, err := getRepoURLParts(otherRepoURL)
+ if err != nil {
+ return false
+ }
+ return strings.EqualFold(parts[0], otherParts[0])
+}
+
+func (s *Source) repoURLFromTargetMetadata(meta *source_metadatapb.Github) (string, error) {
+ linkRepo, err := s.repoURLFromTargetLink(meta.GetLink())
+ if err != nil {
+ return "", err
+ }
+
+ if repo := meta.GetRepository(); repo != "" {
+ // Target metadata may only include a bare repo name. In that case the
+ // owner and host from the link are the authoritative repository identity.
+ if !strings.Contains(repo, "/") && !strings.Contains(repo, ":") {
+ return linkRepo, nil
+ }
+ normalized, err := s.normalizeRepo(repo)
+ if err != nil {
+ return "", fmt.Errorf("could not normalize target repository %q: %w", repo, err)
+ }
+ linkKey, err := repoHostOwnerNameKey(linkRepo)
+ if err != nil {
+ return "", err
+ }
+ repoKey, err := repoHostOwnerNameKey(normalized)
+ if err != nil {
+ return "", fmt.Errorf("could not parse target repository %q: %w", repo, err)
+ }
+ if repoKey != linkKey && isWikiLink(meta.GetLink()) {
+ if parentRepoURL, isWiki := repoCloneURLForWikiCloneURL(normalized); isWiki {
+ repoKey, err = repoHostOwnerNameKey(parentRepoURL)
+ if err != nil {
+ return "", fmt.Errorf("could not parse target repository %q: %w", repo, err)
+ }
+ }
+ }
+ if repoKey != linkKey {
+ return "", fmt.Errorf("target repository %q does not match link repository %q", normalized, linkRepo)
+ }
+ }
+
+ return linkRepo, nil
+}
+
+func (s *Source) repoURLFromTargetLink(link string) (string, error) {
+ u, err := url.Parse(link)
+ if err != nil {
+ return "", fmt.Errorf("unable to parse GitHub URL: %w", err)
+ }
+
+ segments := strings.Split(strings.Trim(u.Path, "/"), "/")
+ if len(segments) < 2 {
+ return "", fmt.Errorf("invalid GitHub URL")
+ }
+
+ repoURL := (&url.URL{
+ Scheme: u.Scheme,
+ Host: u.Host,
+ }).JoinPath(segments[0], segments[1]+".git").String()
+ return s.normalizeRepo(repoURL)
+}
+
func (s *Source) scan(ctx context.Context, reporter sources.ChunkReporter) error {
var scannedCount uint64 = 1
@@ -725,20 +1195,22 @@ func (s *Source) scanRepo(ctx context.Context, repoURL string, reporter sources.
// Scan the wiki, if enabled, and the repo has one.
if s.conn.IncludeWikis && repoInfo.hasWiki && s.wikiIsReachable(ctx, repoURL) {
- wikiURL := strings.TrimSuffix(repoURL, ".git") + ".wiki.git"
- wikiCtx := context.WithValue(ctx, "repo", wikiURL)
+ wikiURL, ok := wikiCloneURLForRepoInfo(repoURL, repoInfo)
+ if ok {
+ wikiCtx := context.WithValue(ctx, "repo", wikiURL)
- _, err := s.cloneAndScanRepo(wikiCtx, wikiURL, repoInfo, reporter)
- if err != nil {
- // Ignore "Repository not found" errors.
- // It's common for GitHub's API to say a repo has a wiki when it doesn't.
- if !strings.Contains(err.Error(), "not found") {
- if err := reporter.ChunkErr(ctx, fmt.Errorf("error scanning wiki: %w", err)); err != nil {
- return err
+ _, err := s.cloneAndScanRepo(wikiCtx, wikiURL, repoInfo, reporter)
+ if err != nil {
+ // Ignore "Repository not found" errors.
+ // It's common for GitHub's API to say a repo has a wiki when it doesn't.
+ if !strings.Contains(err.Error(), "not found") {
+ if err := reporter.ChunkErr(ctx, fmt.Errorf("error scanning wiki: %w", err)); err != nil {
+ return err
+ }
}
- }
- // Don't return, it still might be possible to scan comments.
+ // Don't return, it still might be possible to scan comments.
+ }
}
}
@@ -875,9 +1347,25 @@ func (s *Source) handleRateLimit(ctx context.Context, errIn error, reporters ...
}
githubNumRateLimitEncountered.WithLabelValues(s.name).Inc()
- time.Sleep(retryAfter)
- githubSecondsSpentRateLimited.WithLabelValues(s.name).Add(retryAfter.Seconds())
- return true
+ slept, canceled := sleepWithContext(ctx, retryAfter)
+ githubSecondsSpentRateLimited.WithLabelValues(s.name).Add(slept.Seconds())
+ return !canceled
+}
+
+func sleepWithContext(ctx context.Context, duration time.Duration) (time.Duration, bool) {
+ start := time.Now()
+ if duration <= 0 {
+ return time.Since(start), false
+ }
+
+ timer := time.NewTimer(duration)
+ defer timer.Stop()
+ select {
+ case <-timer.C:
+ return time.Since(start), false
+ case <-ctx.Done():
+ return time.Since(start), true
+ }
}
// handleRateLimitWithUnitReporter is a wrapper around handleRateLimit that includes unit reporting
@@ -939,35 +1427,36 @@ func (s *Source) addUserGistsToCache(ctx context.Context, user string, reporter
}
func (s *Source) addMembersByApp(ctx context.Context, connector *appConnector, reporter sources.UnitReporter) error {
- installationClient := connector.InstallationClient()
- opts := &github.ListOptions{
- PerPage: membersAppPagination,
- }
-
// TODO: Check rate limit for this call.
- installs, _, err := installationClient.Apps.ListInstallations(ctx, opts)
+ installs, err := s.getAppInstallations(ctx, connector)
if err != nil {
return fmt.Errorf("could not enumerate installed orgs: %w", err)
}
for _, install := range installs {
- if install.Account.GetType() != "Organization" {
+ if install.GetAccount().GetType() != "Organization" {
continue
}
- org := install.Account.GetLogin()
- logger := ctx.Logger().WithValues("org", org, "installation_id", install.GetID())
+ org := install.GetAccount().GetLogin()
+ installCtx := context.WithValues(ctx, "org", org, "installation_id", install.GetID())
// Create a per-installation API client so that the token is scoped to
// this org. GitHub App installation tokens only bypass IP allowlists for
// their own org; using a cross-org token causes 403s.
client, err := connector.APIClientForInstallation(install.GetID())
if err != nil {
- logger.Error(err, "could not create API client for installation")
+ installCtx.Logger().Error(err, "could not create API client for installation")
+ if err := reporter.UnitErr(installCtx, fmt.Errorf("could not create API client for installation %d: %w", install.GetID(), err)); err != nil {
+ return err
+ }
continue
}
- if err := s.addMembersByOrgWithClient(ctx, client, org, reporter); err != nil {
- logger.Error(err, "Unable to add members for org")
+ if err := s.addMembersByOrgWithClient(installCtx, client, org, reporter); err != nil {
+ installCtx.Logger().Error(err, "Unable to add members for org")
+ if err := reporter.UnitErr(installCtx, fmt.Errorf("could not add members for org %q (installation %d): %w", org, install.GetID(), err)); err != nil {
+ return err
+ }
continue
}
}
@@ -1121,15 +1610,24 @@ func (s *Source) scanComments(ctx context.Context, repoPath string, repoInfo rep
cutoffTime = &t
}
+ apiClient, err := s.connector.APIClientForRepo(repoPath)
+ if err != nil {
+ return err
+ }
+
if s.includeGistComments && isGistUrl(urlParts) && !s.ignoreGists {
- return s.processGistComments(ctx, urlString, urlParts, repoInfo, reporter, cutoffTime)
+ return s.processGistComments(ctx, apiClient, urlString, urlParts, repoInfo, reporter, cutoffTime)
} else if s.includeIssueComments || s.includePRComments {
// if we need to use graphql api for repo issues, prs and comments
if feature.UseGithubGraphQLAPI.Load() {
- return s.processRepoIssueandPRsWithCommentsGraphql(ctx, repoInfo, reporter, cutoffTime)
+ graphqlClient, err := s.connector.GraphQLClientForRepo(ctx, repoPath)
+ if err != nil {
+ return err
+ }
+ return s.processRepoIssueandPRsWithCommentsGraphql(ctx, graphqlClient, repoInfo, reporter, cutoffTime)
}
- return s.processIssueandPRsWithCommentsREST(ctx, repoInfo, reporter, cutoffTime)
+ return s.processIssueandPRsWithCommentsREST(ctx, apiClient, repoInfo, reporter, cutoffTime)
}
return nil
@@ -1196,7 +1694,7 @@ func getRepoURLParts(repoURLString string) (string, []string, error) {
const initialPage = 1 // page to start listing from
-func (s *Source) processGistComments(ctx context.Context, gistURL string, urlParts []string, repoInfo repoInfo, reporter sources.ChunkReporter, cutoffTime *time.Time) error {
+func (s *Source) processGistComments(ctx context.Context, apiClient *github.Client, gistURL string, urlParts []string, repoInfo repoInfo, reporter sources.ChunkReporter, cutoffTime *time.Time) error {
ctx.Logger().V(2).Info("Scanning GitHub Gist comments")
// GitHub Gist URL.
@@ -1207,7 +1705,7 @@ func (s *Source) processGistComments(ctx context.Context, gistURL string, urlPar
Page: initialPage,
}
for {
- comments, _, err := s.connector.APIClient().Gists.ListComments(ctx, gistID, options)
+ comments, _, err := apiClient.Gists.ListComments(ctx, gistID, options)
if s.handleRateLimitWithChunkReporter(ctx, reporter, err) {
continue
}
@@ -1305,25 +1803,25 @@ var (
)
func (s *Source) processIssueandPRsWithCommentsREST(
- ctx context.Context, repoInfo repoInfo,
+ ctx context.Context, apiClient *github.Client, repoInfo repoInfo,
reporter sources.ChunkReporter, cutoffTime *time.Time,
) error {
if s.includeIssueComments {
ctx.Logger().V(2).Info("Scanning issues")
- if err := s.processIssues(ctx, repoInfo, reporter); err != nil {
+ if err := s.processIssues(ctx, apiClient, repoInfo, reporter); err != nil {
return err
}
- if err := s.processIssueComments(ctx, repoInfo, reporter, cutoffTime); err != nil {
+ if err := s.processIssueComments(ctx, apiClient, repoInfo, reporter, cutoffTime); err != nil {
return err
}
}
if s.includePRComments {
ctx.Logger().V(2).Info("Scanning pull requests")
- if err := s.processPRs(ctx, repoInfo, reporter); err != nil {
+ if err := s.processPRs(ctx, apiClient, repoInfo, reporter); err != nil {
return err
}
- if err := s.processPRComments(ctx, repoInfo, reporter, cutoffTime); err != nil {
+ if err := s.processPRComments(ctx, apiClient, repoInfo, reporter, cutoffTime); err != nil {
return err
}
}
@@ -1332,23 +1830,23 @@ func (s *Source) processIssueandPRsWithCommentsREST(
}
func (s *Source) processRepoIssueandPRsWithCommentsGraphql(
- ctx context.Context, repoInfo repoInfo,
+ ctx context.Context, graphqlClient *githubv4.Client, repoInfo repoInfo,
reporter sources.ChunkReporter, cutoffTime *time.Time,
) error {
if s.includeIssueComments {
ctx.Logger().V(2).Info("Scanning issues")
- if err := s.processIssuesWithComments(ctx, repoInfo, reporter, cutoffTime); err != nil {
+ if err := s.processIssuesWithComments(ctx, graphqlClient, repoInfo, reporter, cutoffTime); err != nil {
return err
}
}
if s.includePRComments {
ctx.Logger().V(2).Info("Scanning pull requests")
- if err := s.processPRWithComments(ctx, repoInfo, reporter, cutoffTime); err != nil {
+ if err := s.processPRWithComments(ctx, graphqlClient, repoInfo, reporter, cutoffTime); err != nil {
return err
}
- if err := s.processReviewThreads(ctx, repoInfo, reporter, cutoffTime); err != nil {
+ if err := s.processReviewThreads(ctx, graphqlClient, repoInfo, reporter, cutoffTime); err != nil {
return err
}
}
@@ -1356,7 +1854,7 @@ func (s *Source) processRepoIssueandPRsWithCommentsGraphql(
return nil
}
-func (s *Source) processIssues(ctx context.Context, repoInfo repoInfo, reporter sources.ChunkReporter) error {
+func (s *Source) processIssues(ctx context.Context, apiClient *github.Client, repoInfo repoInfo, reporter sources.ChunkReporter) error {
bodyTextsOpts := &github.IssueListByRepoOptions{
Sort: sortType,
Direction: directionType,
@@ -1368,7 +1866,7 @@ func (s *Source) processIssues(ctx context.Context, repoInfo repoInfo, reporter
}
for {
- issues, _, err := s.connector.APIClient().Issues.ListByRepo(ctx, repoInfo.owner, repoInfo.name, bodyTextsOpts)
+ issues, _, err := apiClient.Issues.ListByRepo(ctx, repoInfo.owner, repoInfo.name, bodyTextsOpts)
if s.handleRateLimitWithChunkReporter(ctx, reporter, err) {
continue
}
@@ -1426,7 +1924,7 @@ func (s *Source) chunkIssues(ctx context.Context, repoInfo repoInfo, issues []*g
return nil
}
-func (s *Source) processIssueComments(ctx context.Context, repoInfo repoInfo, reporter sources.ChunkReporter, cutoffTime *time.Time) error {
+func (s *Source) processIssueComments(ctx context.Context, apiClient *github.Client, repoInfo repoInfo, reporter sources.ChunkReporter, cutoffTime *time.Time) error {
issueOpts := &github.IssueListCommentsOptions{
Sort: &sortType,
Direction: &directionType,
@@ -1437,7 +1935,7 @@ func (s *Source) processIssueComments(ctx context.Context, repoInfo repoInfo, re
}
for {
- issueComments, _, err := s.connector.APIClient().Issues.ListComments(ctx, repoInfo.owner, repoInfo.name, allComments, issueOpts)
+ issueComments, _, err := apiClient.Issues.ListComments(ctx, repoInfo.owner, repoInfo.name, allComments, issueOpts)
if s.handleRateLimitWithChunkReporter(ctx, reporter, err) {
continue
}
@@ -1493,7 +1991,7 @@ func (s *Source) chunkIssueComments(ctx context.Context, repoInfo repoInfo, comm
return nil
}
-func (s *Source) processPRs(ctx context.Context, repoInfo repoInfo, reporter sources.ChunkReporter) error {
+func (s *Source) processPRs(ctx context.Context, apiClient *github.Client, repoInfo repoInfo, reporter sources.ChunkReporter) error {
prOpts := &github.PullRequestListOptions{
Sort: sortType,
Direction: directionType,
@@ -1505,7 +2003,7 @@ func (s *Source) processPRs(ctx context.Context, repoInfo repoInfo, reporter sou
}
for {
- prs, _, err := s.connector.APIClient().PullRequests.List(ctx, repoInfo.owner, repoInfo.name, prOpts)
+ prs, _, err := apiClient.PullRequests.List(ctx, repoInfo.owner, repoInfo.name, prOpts)
if s.handleRateLimitWithChunkReporter(ctx, reporter, err) {
continue
}
@@ -1526,7 +2024,7 @@ func (s *Source) processPRs(ctx context.Context, repoInfo repoInfo, reporter sou
return nil
}
-func (s *Source) processPRComments(ctx context.Context, repoInfo repoInfo, reporter sources.ChunkReporter, cutoffTime *time.Time) error {
+func (s *Source) processPRComments(ctx context.Context, apiClient *github.Client, repoInfo repoInfo, reporter sources.ChunkReporter, cutoffTime *time.Time) error {
prOpts := &github.PullRequestListCommentsOptions{
Sort: sortType,
Direction: directionType,
@@ -1537,7 +2035,7 @@ func (s *Source) processPRComments(ctx context.Context, repoInfo repoInfo, repor
}
for {
- prComments, _, err := s.connector.APIClient().PullRequests.ListComments(ctx, repoInfo.owner, repoInfo.name, allComments, prOpts)
+ prComments, _, err := apiClient.PullRequests.ListComments(ctx, repoInfo.owner, repoInfo.name, allComments, prOpts)
if s.handleRateLimitWithChunkReporter(ctx, reporter, err) {
continue
}
@@ -1668,15 +2166,43 @@ func (s *Source) scanTarget(ctx context.Context, target sources.ChunkingTarget,
return fmt.Errorf("invalid GitHub URL")
}
+ repoURL, err := s.repoURLFromTargetMetadata(meta)
+ if err != nil {
+ return err
+ }
+ targetIsWiki := isWikiLink(meta.GetLink())
+ if targetIsWiki {
+ repoURL, err = repoCloneURLForTargetEndpoint(s.conn.GetEndpoint(), repoURL)
+ if err != nil {
+ return err
+ }
+ }
+ if connector, ok := s.connector.(*appConnector); ok && s.conn.ScanAllInstallations {
+ if err := s.mapReposToInstallations(ctx, connector, []string{repoURL}); err != nil {
+ return err
+ }
+ }
+ if targetIsWiki {
+ wikiURL, ok := wikiCloneURLForRepo(repoURL)
+ if !ok {
+ return fmt.Errorf("could not derive wiki clone URL from target repository %q", repoURL)
+ }
+ return s.scanWikiTarget(ctx, wikiURL, meta, &chunkSkel, reporter)
+ }
+ apiClient, err := s.connector.APIClientForRepo(repoURL)
+ if err != nil {
+ return err
+ }
+
if meta.GetFile() == "" && meta.GetCommit() != "" {
ctx := context.WithValues(ctx, "commit_hash", meta.GetCommit())
ctx.Logger().V(2).Info("secret metadata has no file; scanning commit metadata instead")
- return s.scanCommitMetadata(ctx, segments[1], segments[2], meta, &chunkSkel, reporter)
+ return s.scanCommitMetadata(ctx, apiClient, segments[1], segments[2], meta, &chunkSkel, reporter)
}
// else try downloading the file content to scan
- readCloser, resp, err := s.connector.APIClient().Repositories.DownloadContents(
+ readCloser, resp, err := apiClient.Repositories.DownloadContents(
ctx,
segments[1],
segments[2],
@@ -1698,9 +2224,53 @@ func (s *Source) scanTarget(ctx context.Context, target sources.ChunkingTarget,
return handlers.HandleFile(fileCtx, readCloser, &chunkSkel, reporter)
}
-func (s *Source) scanCommitMetadata(ctx context.Context, owner, repo string, meta *source_metadatapb.Github, chunkSkel *sources.Chunk, reporter sources.ChunkReporter) error {
+func (s *Source) scanWikiTarget(ctx context.Context, wikiURL string, meta *source_metadatapb.Github, chunkSkel *sources.Chunk, reporter sources.ChunkReporter) error {
+ if meta.GetCommit() == "" {
+ return fmt.Errorf("wiki target has no commit")
+ }
+
+ path, repo, err := s.cloneRepo(ctx, wikiURL)
+ if err != nil {
+ return fmt.Errorf("could not clone wiki for targeted scan: %w", err)
+ }
+ if !s.conn.GetPrintLegacyJson() {
+ if strings.HasPrefix(path, filepath.Join(os.TempDir(), "trufflehog")) || (!s.conn.NoCleanup && s.conn.GetClonePath() != "") {
+ defer func() { _ = os.RemoveAll(path) }()
+ }
+ }
+
+ commit, err := repo.CommitObject(plumbing.NewHash(meta.GetCommit()))
+ if err != nil {
+ return fmt.Errorf("could not fetch wiki commit for targeted scan: %w", err)
+ }
+
+ if meta.GetFile() == "" {
+ var sb strings.Builder
+ sb.WriteString(commit.Author.Email)
+ sb.WriteString("\n")
+ sb.WriteString(commit.Committer.Email)
+ sb.WriteString("\n")
+ sb.WriteString(commit.Message)
+ return handlers.HandleFile(ctx, io.NopCloser(strings.NewReader(sb.String())), chunkSkel, reporter)
+ }
+
+ file, err := commit.File(meta.GetFile())
+ if err != nil {
+ return fmt.Errorf("could not find wiki file for targeted scan: %w", err)
+ }
+ readCloser, err := file.Reader()
+ if err != nil {
+ return fmt.Errorf("could not read wiki file for targeted scan: %w", err)
+ }
+ defer func() { _ = readCloser.Close() }()
+
+ fileCtx := context.WithValues(ctx, "path", meta.GetFile())
+ return handlers.HandleFile(fileCtx, readCloser, chunkSkel, reporter)
+}
+
+func (s *Source) scanCommitMetadata(ctx context.Context, apiClient *github.Client, owner, repo string, meta *source_metadatapb.Github, chunkSkel *sources.Chunk, reporter sources.ChunkReporter) error {
// fetch the commit
- commit, resp, err := s.connector.APIClient().Repositories.GetCommit(ctx, owner, repo, meta.GetCommit(), nil)
+ commit, resp, err := apiClient.Repositories.GetCommit(ctx, owner, repo, meta.GetCommit(), nil)
if resp != nil && resp.Body != nil {
defer func() { _ = resp.Body.Close() }()
}
@@ -1727,8 +2297,15 @@ func (s *Source) scanCommitMetadata(ctx context.Context, owner, repo string, met
}
func (s *Source) ChunkUnit(ctx context.Context, unit sources.SourceUnit, reporter sources.ChunkReporter) error {
- repoURL, _ := unit.SourceUnitID()
+ repoURL, kind := unit.SourceUnitID()
ctx = context.WithValue(ctx, "repo", repoURL)
+
+ if connector, ok := s.connector.(*appConnector); ok && s.conn.ScanAllInstallations && kind == "repo" {
+ if err := s.mapReposToInstallations(ctx, connector, []string{repoURL}); err != nil {
+ return err
+ }
+ }
+
// ChunkUnit is not guaranteed to be called from Enumerate, so we must
// check and fetch the repoInfoCache for this repo.
repoURL, err := s.ensureRepoInfoCache(ctx, repoURL, &chunkErrorReporter{reporter: reporter})
diff --git a/pkg/sources/github/github_integration_test.go b/pkg/sources/github/github_integration_test.go
index 527a92c5b..865387aef 100644
--- a/pkg/sources/github/github_integration_test.go
+++ b/pkg/sources/github/github_integration_test.go
@@ -676,7 +676,7 @@ func basicCheckFunc(minOrg, minRepo int, wantChunk *sources.Chunk, s *Source) so
if diff := pretty.Compare(chunk.SourceMetadata.GetGithub().Repository, wantChunk.SourceMetadata.GetGithub().Repository); diff == "" {
return nil
}
- return sources.MatchError
+ return sources.ErrMatch
}
return nil
}
diff --git a/pkg/sources/github/github_test.go b/pkg/sources/github/github_test.go
index 58ce2dc42..16b9ffeac 100644
--- a/pkg/sources/github/github_test.go
+++ b/pkg/sources/github/github_test.go
@@ -9,6 +9,7 @@ import (
"errors"
"fmt"
"net/http"
+ "net/http/httptest"
"net/url"
"reflect"
"slices"
@@ -28,6 +29,7 @@ import (
"github.com/trufflesecurity/trufflehog/v3/pkg/cache/simple"
"github.com/trufflesecurity/trufflehog/v3/pkg/context"
"github.com/trufflesecurity/trufflehog/v3/pkg/pb/credentialspb"
+ "github.com/trufflesecurity/trufflehog/v3/pkg/pb/source_metadatapb"
"github.com/trufflesecurity/trufflehog/v3/pkg/pb/sourcespb"
"github.com/trufflesecurity/trufflehog/v3/pkg/sources"
)
@@ -478,12 +480,17 @@ func TestNormalizeRepo(t *testing.T) {
assert.NoError(t, err)
assert.Contains(t, result, "github.com/org/repo")
- // Test case 5: Org/repo format (should convert to full URL)
+ // Test case 5: SCP-style SSH URL
+ result, err = source.normalizeRepo("[email protected]:org/repo.git")
+ assert.NoError(t, err)
+ assert.Equal(t, "https://github.com/org/repo.git", result)
+
+ // Test case 6: Org/repo format (should convert to full URL)
result, err = source.normalizeRepo("org/repo")
assert.NoError(t, err)
assert.Contains(t, result, "github.com/org/repo")
- // Test case 6: Invalid format (no protocol, no slash)
+ // Test case 7: Invalid format (no protocol, no slash)
_, err = source.normalizeRepo("invalid")
assert.Error(t, err)
assert.Contains(t, err.Error(), "no repositories found")
@@ -505,6 +512,11 @@ func TestNormalizeRepo_Enterprise(t *testing.T) {
endpoint: "https://example.com/api/v3",
wantResult: "https://example.com/org/repo.git",
},
+ {
+ name: "host with path without scheme",
+ endpoint: "example.com/api/v3",
+ wantResult: "https://example.com/org/repo.git",
+ },
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@@ -522,6 +534,7 @@ func TestNormalizeRepo_Enterprise(t *testing.T) {
}
func TestHandleRateLimit(t *testing.T) {
+ resetRateLimitForTest(t)
s := initTestSource(&sourcespb.GitHub{Credential: &sourcespb.GitHub_Unauthenticated{}})
ctx := context.Background()
assert.False(t, s.handleRateLimit(ctx, nil))
@@ -558,6 +571,36 @@ func TestHandleRateLimit(t *testing.T) {
assert.True(t, s.handleRateLimit(ctx, err))
}
+func TestHandleRateLimitStopsSleepingWhenContextCancelled(t *testing.T) {
+ resetRateLimitForTest(t)
+ s := &Source{name: "test - github"}
+ retryAfter := time.Hour
+ err := &github.AbuseRateLimitError{
+ RetryAfter: &retryAfter,
+ Message: "secondary rate limit",
+ }
+ ctx, cancel := context.WithCancel(context.Background())
+ cancel()
+
+ start := time.Now()
+ assert.False(t, s.handleRateLimit(ctx, err))
+ assert.Less(t, time.Since(start), 200*time.Millisecond)
+}
+
+func resetRateLimitForTest(t *testing.T) {
+ t.Helper()
+ rateLimitMu.Lock()
+ previous := rateLimitResumeTime
+ rateLimitResumeTime = time.Time{}
+ rateLimitMu.Unlock()
+
+ t.Cleanup(func() {
+ rateLimitMu.Lock()
+ rateLimitResumeTime = previous
+ rateLimitMu.Unlock()
+ })
+}
+
func TestEnumerateUnauthenticated(t *testing.T) {
defer gock.Off()
@@ -891,6 +934,862 @@ func TestEnumerateWithApp(t *testing.T) {
assert.True(t, gock.IsDone())
}
+func TestEnumerateWithAppScanAllInstallationsIncludesConfiguredInstallation(t *testing.T) {
+ privateKey := createPrivateKey()
+
+ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ w.Header().Set("Content-Type", "application/json")
+
+ switch {
+ case r.Method == http.MethodPost && strings.Contains(r.URL.Path, "/app/installations/") && strings.HasSuffix(r.URL.Path, "/access_tokens"):
+ parts := strings.Split(r.URL.Path, "/")
+ installID := parts[len(parts)-2]
+ _, _ = fmt.Fprintf(w, `{"token":"token-%s","expires_at":"2099-01-01T00:00:00Z"}`, installID)
+ case r.Method == http.MethodGet && strings.HasSuffix(r.URL.Path, "/app/installations"):
+ _, _ = w.Write([]byte(`[
+ {"id":1337,"account":{"login":"default-org","type":"Organization"}},
+ {"id":2448,"account":{"login":"other-org","type":"Organization"}}
+ ]`))
+ case r.Method == http.MethodGet && strings.HasSuffix(r.URL.Path, "/installation/repositories"):
+ auth := r.Header.Get("Authorization")
+ switch {
+ case strings.Contains(auth, "token-1337"):
+ _, _ = w.Write([]byte(`{"total_count":1,"repositories":[
+ {"name":"repo","full_name":"default-org/repo","clone_url":"https://github.com/default-org/repo.git","owner":{"login":"default-org","type":"Organization"},"size":1}
+ ]}`))
+ case strings.Contains(auth, "token-2448"):
+ _, _ = w.Write([]byte(`{"total_count":1,"repositories":[
+ {"name":"repo","full_name":"other-org/repo","clone_url":"https://github.com/other-org/repo.git","owner":{"login":"other-org","type":"Organization"},"size":1}
+ ]}`))
+ default:
+ http.Error(w, "unexpected installation token", http.StatusUnauthorized)
+ }
+ default:
+ http.NotFound(w, r)
+ }
+ }))
+ defer server.Close()
+
+ s, conn := createTestSource(&sourcespb.GitHub{
+ Endpoint: server.URL,
+ ScanAllInstallations: true,
+ Credential: &sourcespb.GitHub_GithubApp{
+ GithubApp: &credentialspb.GitHubApp{
+ PrivateKey: privateKey,
+ InstallationId: "1337",
+ AppId: "4141",
+ },
+ },
+ })
+ require.NoError(t, s.Init(context.Background(), "test - github", 0, 1337, false, conn, 1))
+
+ connector := s.connector.(*appConnector)
+ err := s.enumerateWithApp(context.Background(), connector, noopReporter())
+ require.NoError(t, err)
+
+ assert.Equal(t, int64(1337), connector.repoInstallationMap["https://github.com/default-org/repo.git"])
+ assert.Equal(t, int64(2448), connector.repoInstallationMap["https://github.com/other-org/repo.git"])
+ assert.True(t, s.filteredRepoCache.Exists("default-org/repo"))
+ assert.True(t, s.filteredRepoCache.Exists("other-org/repo"))
+}
+
+func TestEnumerateWithAppScanAllInstallationsMapsExplicitReposBeforeMetadataFetch(t *testing.T) {
+ privateKey := createPrivateKey()
+
+ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ w.Header().Set("Content-Type", "application/json")
+
+ switch {
+ case r.Method == http.MethodPost && strings.Contains(r.URL.Path, "/app/installations/") && strings.HasSuffix(r.URL.Path, "/access_tokens"):
+ parts := strings.Split(r.URL.Path, "/")
+ installID := parts[len(parts)-2]
+ _, _ = fmt.Fprintf(w, `{"token":"token-%s","expires_at":"2099-01-01T00:00:00Z"}`, installID)
+ case r.Method == http.MethodGet && strings.HasSuffix(r.URL.Path, "/app/installations"):
+ _, _ = w.Write([]byte(`[
+ {"id":1337,"account":{"login":"default-org","type":"Organization"}},
+ {"id":2448,"account":{"login":"other-org","type":"Organization"}}
+ ]`))
+ case r.Method == http.MethodGet && strings.HasSuffix(r.URL.Path, "/installation/repositories"):
+ auth := r.Header.Get("Authorization")
+ switch {
+ case strings.Contains(auth, "token-1337"):
+ _, _ = w.Write([]byte(`{"total_count":1,"repositories":[
+ {"name":"repo","full_name":"default-org/repo","clone_url":"https://github.com/default-org/repo.git","owner":{"login":"default-org","type":"Organization"},"size":1}
+ ]}`))
+ case strings.Contains(auth, "token-2448"):
+ _, _ = w.Write([]byte(`{"total_count":1,"repositories":[
+ {"name":"repo","full_name":"other-org/repo","clone_url":"https://github.com/other-org/repo.git","owner":{"login":"other-org","type":"Organization"},"size":1}
+ ]}`))
+ default:
+ http.Error(w, "unexpected installation token", http.StatusUnauthorized)
+ }
+ case r.Method == http.MethodGet && strings.HasSuffix(r.URL.Path, "/repos/other-org/repo"):
+ if !strings.Contains(r.Header.Get("Authorization"), "token-2448") {
+ http.Error(w, "wrong installation token", http.StatusForbidden)
+ return
+ }
+ _, _ = w.Write([]byte(`{"name":"repo","full_name":"other-org/repo","clone_url":"https://github.com/other-org/repo.git","owner":{"login":"other-org","type":"Organization"},"size":1}`))
+ default:
+ http.NotFound(w, r)
+ }
+ }))
+ defer server.Close()
+
+ s, conn := createTestSource(&sourcespb.GitHub{
+ Endpoint: server.URL,
+ Repositories: []string{"https://github.com/other-org/repo.git"},
+ ScanAllInstallations: true,
+ Credential: &sourcespb.GitHub_GithubApp{
+ GithubApp: &credentialspb.GitHubApp{
+ PrivateKey: privateKey,
+ InstallationId: "1337",
+ AppId: "4141",
+ },
+ },
+ })
+ require.NoError(t, s.Init(context.Background(), "test - github", 0, 1337, false, conn, 1))
+
+ err := s.Enumerate(context.Background(), noopReporter())
+ require.NoError(t, err)
+
+ connector := s.connector.(*appConnector)
+ assert.Equal(t, int64(2448), connector.repoInstallationMap["https://github.com/other-org/repo.git"])
+ info, ok := s.repoInfoCache.get("https://github.com/other-org/repo.git")
+ require.True(t, ok)
+ assert.Equal(t, "other-org/repo", info.fullName)
+}
+
+func TestMapExplicitReposToInstallationsErrorsForUnmatchedRepos(t *testing.T) {
+ privateKey := createPrivateKey()
+
+ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ w.Header().Set("Content-Type", "application/json")
+
+ switch {
+ case r.Method == http.MethodPost && strings.Contains(r.URL.Path, "/app/installations/") && strings.HasSuffix(r.URL.Path, "/access_tokens"):
+ parts := strings.Split(r.URL.Path, "/")
+ installID := parts[len(parts)-2]
+ _, _ = fmt.Fprintf(w, `{"token":"token-%s","expires_at":"2099-01-01T00:00:00Z"}`, installID)
+ case r.Method == http.MethodGet && strings.HasSuffix(r.URL.Path, "/app/installations"):
+ _, _ = w.Write([]byte(`[{"id":2448,"account":{"login":"other-org","type":"Organization"}}]`))
+ case r.Method == http.MethodGet && strings.HasSuffix(r.URL.Path, "/installation/repositories"):
+ _, _ = w.Write([]byte(`{"total_count":1,"repositories":[
+ {"name":"different","full_name":"other-org/different","clone_url":"https://github.com/other-org/different.git","owner":{"login":"other-org","type":"Organization"},"size":1}
+ ]}`))
+ default:
+ http.NotFound(w, r)
+ }
+ }))
+ defer server.Close()
+
+ s, conn := createTestSource(&sourcespb.GitHub{
+ Endpoint: server.URL,
+ Repositories: []string{"https://github.com/other-org/missing.git"},
+ ScanAllInstallations: true,
+ Credential: &sourcespb.GitHub_GithubApp{
+ GithubApp: &credentialspb.GitHubApp{
+ PrivateKey: privateKey,
+ InstallationId: "1337",
+ AppId: "4141",
+ },
+ },
+ })
+ err := s.Init(context.Background(), "test - github", 0, 1337, false, conn, 1)
+ require.Error(t, err)
+ assert.Contains(t, err.Error(), "configured repos were not found in any GitHub App installation")
+ assert.Contains(t, err.Error(), "https://github.com/other-org/missing.git")
+}
+
+func TestScanAllInstallationsInitErrorsWhenInstallationsCannotBeListed(t *testing.T) {
+ privateKey := createPrivateKey()
+
+ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ w.Header().Set("Content-Type", "application/json")
+
+ switch {
+ case r.Method == http.MethodGet && strings.HasSuffix(r.URL.Path, "/app/installations"):
+ http.Error(w, "installation list failed", http.StatusInternalServerError)
+ default:
+ http.NotFound(w, r)
+ }
+ }))
+ defer server.Close()
+
+ s, conn := createTestSource(&sourcespb.GitHub{
+ Endpoint: server.URL,
+ ScanAllInstallations: true,
+ Credential: &sourcespb.GitHub_GithubApp{
+ GithubApp: &credentialspb.GitHubApp{
+ PrivateKey: privateKey,
+ InstallationId: "1337",
+ AppId: "4141",
+ },
+ },
+ })
+
+ err := s.Init(context.Background(), "test - github", 0, 1337, false, conn, 1)
+ require.Error(t, err)
+ assert.Contains(t, err.Error(), "could not list installations")
+}
+
+func TestMapExplicitReposToInstallationsStopsAfterReposFound(t *testing.T) {
+ privateKey := createPrivateKey()
+ var listInstallationsCalls, unrelatedRepoListCalls int
+
+ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ w.Header().Set("Content-Type", "application/json")
+
+ switch {
+ case r.Method == http.MethodPost && strings.Contains(r.URL.Path, "/app/installations/") && strings.HasSuffix(r.URL.Path, "/access_tokens"):
+ parts := strings.Split(r.URL.Path, "/")
+ installID := parts[len(parts)-2]
+ _, _ = fmt.Fprintf(w, `{"token":"token-%s","expires_at":"2099-01-01T00:00:00Z"}`, installID)
+ case r.Method == http.MethodGet && strings.HasSuffix(r.URL.Path, "/app/installations"):
+ listInstallationsCalls++
+ _, _ = w.Write([]byte(`[
+ {"id":1337,"account":{"login":"default-org","type":"Organization"}},
+ {"id":2448,"account":{"login":"other-org","type":"Organization"}},
+ {"id":3559,"account":{"login":"unrelated-org","type":"Organization"}}
+ ]`))
+ case r.Method == http.MethodGet && strings.HasSuffix(r.URL.Path, "/installation/repositories"):
+ auth := r.Header.Get("Authorization")
+ switch {
+ case strings.Contains(auth, "token-1337"):
+ _, _ = w.Write([]byte(`{"total_count":0,"repositories":[]}`))
+ case strings.Contains(auth, "token-2448"):
+ _, _ = w.Write([]byte(`{"total_count":1,"repositories":[
+ {"name":"repo","full_name":"other-org/repo","clone_url":"https://github.com/other-org/repo.git","owner":{"login":"other-org","type":"Organization"},"size":1}
+ ]}`))
+ case strings.Contains(auth, "token-3559"):
+ unrelatedRepoListCalls++
+ http.Error(w, "unrelated installation failed", http.StatusInternalServerError)
+ default:
+ http.Error(w, "unexpected installation token", http.StatusUnauthorized)
+ }
+ default:
+ http.NotFound(w, r)
+ }
+ }))
+ defer server.Close()
+
+ s, conn := createTestSource(&sourcespb.GitHub{
+ Endpoint: server.URL,
+ Repositories: []string{"https://github.com/other-org/repo.git"},
+ ScanAllInstallations: true,
+ Credential: &sourcespb.GitHub_GithubApp{
+ GithubApp: &credentialspb.GitHubApp{
+ PrivateKey: privateKey,
+ InstallationId: "1337",
+ AppId: "4141",
+ },
+ },
+ })
+ require.NoError(t, s.Init(context.Background(), "test - github", 0, 1337, false, conn, 1))
+
+ connector := s.connector.(*appConnector)
+ require.NoError(t, s.mapExplicitReposToInstallations(context.Background(), connector))
+ require.NoError(t, s.mapExplicitReposToInstallations(context.Background(), connector))
+
+ installationID, mapped := connector.installationIDForRepo("https://github.com/other-org/repo.git")
+ assert.True(t, mapped)
+ assert.Equal(t, int64(2448), installationID)
+ assert.Equal(t, 1, listInstallationsCalls)
+ assert.Equal(t, 0, unrelatedRepoListCalls)
+}
+
+func TestScanAllInstallationsReusesInstallationsLoadedDuringInit(t *testing.T) {
+ privateKey := createPrivateKey()
+ var listInstallationsCalls int
+
+ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ w.Header().Set("Content-Type", "application/json")
+
+ switch {
+ case r.Method == http.MethodPost && strings.Contains(r.URL.Path, "/app/installations/") && strings.HasSuffix(r.URL.Path, "/access_tokens"):
+ parts := strings.Split(r.URL.Path, "/")
+ installID := parts[len(parts)-2]
+ _, _ = fmt.Fprintf(w, `{"token":"token-%s","expires_at":"2099-01-01T00:00:00Z"}`, installID)
+ case r.Method == http.MethodGet && strings.HasSuffix(r.URL.Path, "/app/installations"):
+ listInstallationsCalls++
+ _, _ = w.Write([]byte(`[
+ {"id":1337,"account":{"login":"default-org","type":"Organization"}},
+ {"id":2448,"account":{"login":"other-org","type":"Organization"}}
+ ]`))
+ case r.Method == http.MethodGet && strings.HasSuffix(r.URL.Path, "/installation/repositories"):
+ if strings.Contains(r.Header.Get("Authorization"), "token-2448") {
+ _, _ = w.Write([]byte(`{"total_count":1,"repositories":[
+ {"name":"repo","full_name":"other-org/repo","clone_url":"https://github.com/other-org/repo.git","owner":{"login":"other-org","type":"Organization"},"size":1}
+ ]}`))
+ return
+ }
+ _, _ = w.Write([]byte(`{"total_count":0,"repositories":[]}`))
+ case r.Method == http.MethodGet && strings.Contains(r.URL.Path, "/orgs/") && strings.HasSuffix(r.URL.Path, "/members"):
+ _, _ = w.Write([]byte(`[]`))
+ default:
+ http.NotFound(w, r)
+ }
+ }))
+ defer server.Close()
+
+ s, conn := createTestSource(&sourcespb.GitHub{
+ Endpoint: server.URL,
+ Repositories: []string{"https://github.com/other-org/repo.git"},
+ ScanAllInstallations: true,
+ Credential: &sourcespb.GitHub_GithubApp{
+ GithubApp: &credentialspb.GitHubApp{
+ PrivateKey: privateKey,
+ InstallationId: "1337",
+ AppId: "4141",
+ },
+ },
+ })
+ require.NoError(t, s.Init(context.Background(), "test - github", 0, 1337, false, conn, 1))
+
+ connector := s.connector.(*appConnector)
+ require.NoError(t, s.enumerateAllInstallationRepos(context.Background(), connector, noopReporter()))
+ require.NoError(t, s.addMembersByApp(context.Background(), connector, noopReporter()))
+ assert.Equal(t, 1, listInstallationsCalls)
+}
+
+func TestMapExplicitReposToInstallationsMatchesSSHRepoURL(t *testing.T) {
+ privateKey := createPrivateKey()
+ const sshRepoURL = "ssh://[email protected]/other-org/repo.git"
+
+ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ w.Header().Set("Content-Type", "application/json")
+
+ switch {
+ case r.Method == http.MethodPost && strings.Contains(r.URL.Path, "/app/installations/") && strings.HasSuffix(r.URL.Path, "/access_tokens"):
+ _, _ = w.Write([]byte(`{"token":"token-2448","expires_at":"2099-01-01T00:00:00Z"}`))
+ case r.Method == http.MethodGet && strings.HasSuffix(r.URL.Path, "/app/installations"):
+ _, _ = w.Write([]byte(`[{"id":2448,"account":{"login":"other-org","type":"Organization"}}]`))
+ case r.Method == http.MethodGet && strings.HasSuffix(r.URL.Path, "/installation/repositories"):
+ _, _ = w.Write([]byte(`{"total_count":1,"repositories":[
+ {"name":"repo","full_name":"other-org/repo","clone_url":"https://github.com/other-org/repo.git","owner":{"login":"other-org","type":"Organization"},"size":1}
+ ]}`))
+ case r.Method == http.MethodGet && strings.HasSuffix(r.URL.Path, "/repos/other-org/repo"):
+ _, _ = w.Write([]byte(`{"name":"repo","full_name":"other-org/repo","clone_url":"https://github.com/other-org/repo.git","owner":{"login":"other-org","type":"Organization"},"size":1}`))
+ default:
+ http.NotFound(w, r)
+ }
+ }))
+ defer server.Close()
+
+ s, conn := createTestSource(&sourcespb.GitHub{
+ Endpoint: server.URL,
+ Repositories: []string{sshRepoURL},
+ ScanAllInstallations: true,
+ Credential: &sourcespb.GitHub_GithubApp{
+ GithubApp: &credentialspb.GitHubApp{
+ PrivateKey: privateKey,
+ InstallationId: "1337",
+ AppId: "4141",
+ },
+ },
+ })
+ require.NoError(t, s.Init(context.Background(), "test - github", 0, 1337, false, conn, 1))
+
+ connector := s.connector.(*appConnector)
+ installationID, mapped := connector.installationIDForRepo(sshRepoURL)
+ assert.True(t, mapped)
+ assert.Equal(t, int64(2448), installationID)
+}
+
+func TestMapExplicitReposToInstallationsMatchesSCPStyleSSHRepoURL(t *testing.T) {
+ privateKey := createPrivateKey()
+ const sshRepoURL = "[email protected]:other-org/repo.git"
+
+ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ w.Header().Set("Content-Type", "application/json")
+
+ switch {
+ case r.Method == http.MethodPost && strings.Contains(r.URL.Path, "/app/installations/") && strings.HasSuffix(r.URL.Path, "/access_tokens"):
+ _, _ = w.Write([]byte(`{"token":"token-2448","expires_at":"2099-01-01T00:00:00Z"}`))
+ case r.Method == http.MethodGet && strings.HasSuffix(r.URL.Path, "/app/installations"):
+ _, _ = w.Write([]byte(`[{"id":2448,"account":{"login":"other-org","type":"Organization"}}]`))
+ case r.Method == http.MethodGet && strings.HasSuffix(r.URL.Path, "/installation/repositories"):
+ _, _ = w.Write([]byte(`{"total_count":1,"repositories":[
+ {"name":"repo","full_name":"other-org/repo","clone_url":"https://github.com/other-org/repo.git","owner":{"login":"other-org","type":"Organization"},"size":1}
+ ]}`))
+ case r.Method == http.MethodGet && strings.HasSuffix(r.URL.Path, "/repos/other-org/repo"):
+ _, _ = w.Write([]byte(`{"name":"repo","full_name":"other-org/repo","clone_url":"https://github.com/other-org/repo.git","owner":{"login":"other-org","type":"Organization"},"size":1}`))
+ default:
+ http.NotFound(w, r)
+ }
+ }))
+ defer server.Close()
+
+ s, conn := createTestSource(&sourcespb.GitHub{
+ Endpoint: server.URL,
+ Repositories: []string{sshRepoURL},
+ ScanAllInstallations: true,
+ Credential: &sourcespb.GitHub_GithubApp{
+ GithubApp: &credentialspb.GitHubApp{
+ PrivateKey: privateKey,
+ InstallationId: "1337",
+ AppId: "4141",
+ },
+ },
+ })
+ require.NoError(t, s.Init(context.Background(), "test - github", 0, 1337, false, conn, 1))
+
+ connector := s.connector.(*appConnector)
+ installationID, mapped := connector.installationIDForRepo(sshRepoURL)
+ assert.True(t, mapped)
+ assert.Equal(t, int64(2448), installationID)
+}
+
+func TestMapExplicitReposToInstallationsRejectsHostMismatch(t *testing.T) {
+ privateKey := createPrivateKey()
+ const attackerRepoURL = "https://attacker.example/other-org/repo.git"
+
+ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ w.Header().Set("Content-Type", "application/json")
+
+ switch {
+ case r.Method == http.MethodPost && strings.Contains(r.URL.Path, "/app/installations/") && strings.HasSuffix(r.URL.Path, "/access_tokens"):
+ _, _ = w.Write([]byte(`{"token":"token-2448","expires_at":"2099-01-01T00:00:00Z"}`))
+ case r.Method == http.MethodGet && strings.HasSuffix(r.URL.Path, "/app/installations"):
+ _, _ = w.Write([]byte(`[{"id":2448,"account":{"login":"other-org","type":"Organization"}}]`))
+ case r.Method == http.MethodGet && strings.HasSuffix(r.URL.Path, "/installation/repositories"):
+ _, _ = w.Write([]byte(`{"total_count":1,"repositories":[
+ {"name":"repo","full_name":"other-org/repo","clone_url":"https://github.com/other-org/repo.git","owner":{"login":"other-org","type":"Organization"},"size":1}
+ ]}`))
+ case r.Method == http.MethodGet && strings.HasSuffix(r.URL.Path, "/repos/other-org/repo"):
+ _, _ = w.Write([]byte(`{"name":"repo","full_name":"other-org/repo","clone_url":"https://github.com/other-org/repo.git","owner":{"login":"other-org","type":"Organization"},"size":1}`))
+ default:
+ http.NotFound(w, r)
+ }
+ }))
+ defer server.Close()
+
+ s, conn := createTestSource(&sourcespb.GitHub{
+ Endpoint: server.URL,
+ Repositories: []string{attackerRepoURL},
+ ScanAllInstallations: true,
+ Credential: &sourcespb.GitHub_GithubApp{
+ GithubApp: &credentialspb.GitHubApp{
+ PrivateKey: privateKey,
+ InstallationId: "1337",
+ AppId: "4141",
+ },
+ },
+ })
+ err := s.Init(context.Background(), "test - github", 0, 1337, false, conn, 1)
+ require.Error(t, err)
+ assert.Contains(t, err.Error(), "configured repos were not found")
+}
+
+func TestMapExplicitReposToInstallationsRejectsRepoMissingFromInstallationList(t *testing.T) {
+ privateKey := createPrivateKey()
+ const repoURL = "https://github.com/other-org/repo.git"
+
+ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ w.Header().Set("Content-Type", "application/json")
+
+ switch {
+ case r.Method == http.MethodPost && strings.Contains(r.URL.Path, "/app/installations/") && strings.HasSuffix(r.URL.Path, "/access_tokens"):
+ _, _ = w.Write([]byte(`{"token":"token-2448","expires_at":"2099-01-01T00:00:00Z"}`))
+ case r.Method == http.MethodGet && strings.HasSuffix(r.URL.Path, "/app/installations"):
+ _, _ = w.Write([]byte(`[{"id":2448,"account":{"login":"other-org","type":"Organization"}}]`))
+ case r.Method == http.MethodGet && strings.HasSuffix(r.URL.Path, "/installation/repositories"):
+ _, _ = w.Write([]byte(`{"total_count":0,"repositories":[]}`))
+ case r.Method == http.MethodGet && strings.HasSuffix(r.URL.Path, "/repos/other-org/repo"):
+ _, _ = w.Write([]byte(`{"name":"repo","full_name":"other-org/repo","clone_url":"https://github.com/other-org/repo.git","owner":{"login":"other-org","type":"Organization"},"size":1}`))
+ default:
+ http.NotFound(w, r)
+ }
+ }))
+ defer server.Close()
+
+ s, conn := createTestSource(&sourcespb.GitHub{
+ Endpoint: server.URL,
+ Repositories: []string{repoURL},
+ ScanAllInstallations: true,
+ Credential: &sourcespb.GitHub_GithubApp{
+ GithubApp: &credentialspb.GitHubApp{
+ PrivateKey: privateKey,
+ InstallationId: "1337",
+ AppId: "4141",
+ },
+ },
+ })
+ err := s.Init(context.Background(), "test - github", 0, 1337, false, conn, 1)
+ require.Error(t, err)
+ assert.Contains(t, err.Error(), "configured repos were not found")
+}
+
+func TestMapExplicitReposToInstallationsMapsWikiRepoURL(t *testing.T) {
+ privateKey := createPrivateKey()
+ const wikiRepoURL = "https://github.com/other-org/repo.wiki.git"
+
+ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ w.Header().Set("Content-Type", "application/json")
+
+ switch {
+ case r.Method == http.MethodPost && strings.Contains(r.URL.Path, "/app/installations/") && strings.HasSuffix(r.URL.Path, "/access_tokens"):
+ _, _ = w.Write([]byte(`{"token":"token-2448","expires_at":"2099-01-01T00:00:00Z"}`))
+ case r.Method == http.MethodGet && strings.HasSuffix(r.URL.Path, "/app/installations"):
+ _, _ = w.Write([]byte(`[{"id":2448,"account":{"login":"other-org","type":"Organization"}}]`))
+ case r.Method == http.MethodGet && strings.HasSuffix(r.URL.Path, "/installation/repositories"):
+ _, _ = w.Write([]byte(`{"total_count":1,"repositories":[
+ {"name":"repo","full_name":"other-org/repo","clone_url":"https://github.com/other-org/repo.git","owner":{"login":"other-org","type":"Organization"},"size":1}
+ ]}`))
+ case r.Method == http.MethodGet && strings.HasSuffix(r.URL.Path, "/repos/other-org/repo"):
+ _, _ = w.Write([]byte(`{"name":"repo","full_name":"other-org/repo","clone_url":"https://github.com/other-org/repo.git","owner":{"login":"other-org","type":"Organization"},"size":1}`))
+ default:
+ http.NotFound(w, r)
+ }
+ }))
+ defer server.Close()
+
+ s, conn := createTestSource(&sourcespb.GitHub{
+ Endpoint: server.URL,
+ Repositories: []string{wikiRepoURL},
+ ScanAllInstallations: true,
+ Credential: &sourcespb.GitHub_GithubApp{
+ GithubApp: &credentialspb.GitHubApp{
+ PrivateKey: privateKey,
+ InstallationId: "1337",
+ AppId: "4141",
+ },
+ },
+ })
+ require.NoError(t, s.Init(context.Background(), "test - github", 0, 1337, false, conn, 1))
+
+ connector := s.connector.(*appConnector)
+ installationID, mapped := connector.installationIDForRepo("https://github.com/other-org/repo.git")
+ assert.True(t, mapped)
+ assert.Equal(t, int64(2448), installationID)
+ installationID, mapped = connector.installationIDForRepo(wikiRepoURL)
+ assert.True(t, mapped)
+ assert.Equal(t, int64(2448), installationID)
+}
+
+func TestMapExplicitReposToInstallationsPrefersRealWikiSuffixedRepo(t *testing.T) {
+ privateKey := createPrivateKey()
+ const parentRepoURL = "https://github.com/other-org/repo.git"
+ const wikiSuffixedRepoURL = "https://github.com/other-org/repo.wiki.git"
+ const wikiOfWikiSuffixedRepoURL = "https://github.com/other-org/repo.wiki.wiki.git"
+
+ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ w.Header().Set("Content-Type", "application/json")
+
+ switch {
+ case r.Method == http.MethodPost && strings.Contains(r.URL.Path, "/app/installations/") && strings.HasSuffix(r.URL.Path, "/access_tokens"):
+ _, _ = w.Write([]byte(`{"token":"token-2448","expires_at":"2099-01-01T00:00:00Z"}`))
+ case r.Method == http.MethodGet && strings.HasSuffix(r.URL.Path, "/app/installations"):
+ _, _ = w.Write([]byte(`[{"id":2448,"account":{"login":"other-org","type":"Organization"}}]`))
+ case r.Method == http.MethodGet && strings.HasSuffix(r.URL.Path, "/installation/repositories"):
+ _, _ = w.Write([]byte(`{"total_count":2,"repositories":[
+ {"name":"repo.wiki","full_name":"other-org/repo.wiki","clone_url":"https://github.com/other-org/repo.wiki.git","owner":{"login":"other-org","type":"Organization"},"size":1,"has_wiki":true},
+ {"name":"repo","full_name":"other-org/repo","clone_url":"https://github.com/other-org/repo.git","owner":{"login":"other-org","type":"Organization"},"size":1}
+ ]}`))
+ default:
+ http.NotFound(w, r)
+ }
+ }))
+ defer server.Close()
+
+ s, conn := createTestSource(&sourcespb.GitHub{
+ Endpoint: server.URL,
+ Repositories: []string{parentRepoURL, wikiSuffixedRepoURL},
+ ScanAllInstallations: true,
+ Credential: &sourcespb.GitHub_GithubApp{
+ GithubApp: &credentialspb.GitHubApp{
+ PrivateKey: privateKey,
+ InstallationId: "1337",
+ AppId: "4141",
+ },
+ },
+ })
+ require.NoError(t, s.Init(context.Background(), "test - github", 0, 1337, false, conn, 1))
+
+ connector := s.connector.(*appConnector)
+ installationID, mapped := connector.installationIDForRepo(parentRepoURL)
+ assert.True(t, mapped)
+ assert.Equal(t, int64(2448), installationID)
+
+ installationID, mapped = connector.installationIDForRepo(wikiSuffixedRepoURL)
+ assert.True(t, mapped)
+ assert.Equal(t, int64(2448), installationID)
+
+ installationID, mapped = connector.installationIDForRepo(wikiOfWikiSuffixedRepoURL)
+ assert.True(t, mapped)
+ assert.Equal(t, int64(2448), installationID)
+}
+
+func TestMapExplicitReposToInstallationsMapsRedirectedRepoFromMetadata(t *testing.T) {
+ privateKey := createPrivateKey()
+ const oldRepoURL = "https://github.com/old-org/repo.git"
+ const canonicalRepoURL = "https://github.com/new-org/repo.git"
+
+ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ w.Header().Set("Content-Type", "application/json")
+
+ switch {
+ case r.Method == http.MethodPost && strings.Contains(r.URL.Path, "/app/installations/") && strings.HasSuffix(r.URL.Path, "/access_tokens"):
+ _, _ = w.Write([]byte(`{"token":"token-2448","expires_at":"2099-01-01T00:00:00Z"}`))
+ case r.Method == http.MethodGet && strings.HasSuffix(r.URL.Path, "/app/installations"):
+ _, _ = w.Write([]byte(`[{"id":2448,"account":{"login":"new-org","type":"Organization"}}]`))
+ case r.Method == http.MethodGet && strings.HasSuffix(r.URL.Path, "/installation/repositories"):
+ _, _ = w.Write([]byte(`{"total_count":1,"repositories":[
+ {"name":"repo","full_name":"new-org/repo","clone_url":"https://github.com/new-org/repo.git","owner":{"login":"new-org","type":"Organization"},"size":1}
+ ]}`))
+ case r.Method == http.MethodGet && strings.HasSuffix(r.URL.Path, "/repos/old-org/repo"):
+ if !strings.Contains(r.Header.Get("Authorization"), "token-2448") {
+ http.Error(w, "wrong installation token", http.StatusForbidden)
+ return
+ }
+ _, _ = w.Write([]byte(`{"name":"repo","full_name":"new-org/repo","clone_url":"https://github.com/new-org/repo.git","owner":{"login":"new-org","type":"Organization"},"size":1}`))
+ default:
+ http.NotFound(w, r)
+ }
+ }))
+ defer server.Close()
+
+ s, conn := createTestSource(&sourcespb.GitHub{
+ Endpoint: server.URL,
+ Repositories: []string{oldRepoURL},
+ ScanAllInstallations: true,
+ Credential: &sourcespb.GitHub_GithubApp{
+ GithubApp: &credentialspb.GitHubApp{
+ PrivateKey: privateKey,
+ InstallationId: "1337",
+ AppId: "4141",
+ },
+ },
+ })
+ require.NoError(t, s.Init(context.Background(), "test - github", 0, 1337, false, conn, 1))
+
+ connector := s.connector.(*appConnector)
+
+ installationID, mapped := connector.installationIDForRepo(oldRepoURL)
+ assert.True(t, mapped)
+ assert.Equal(t, int64(2448), installationID)
+ installationID, mapped = connector.installationIDForRepo(canonicalRepoURL)
+ assert.True(t, mapped)
+ assert.Equal(t, int64(2448), installationID)
+ info, ok := s.repoInfoCache.get(oldRepoURL)
+ require.True(t, ok)
+ assert.Equal(t, "new-org/repo", info.fullName)
+}
+
+func TestRepoURLFromTargetMetadataErrorsOnRepositoryLinkMismatch(t *testing.T) {
+ s := &Source{}
+ _, err := s.repoURLFromTargetMetadata(&source_metadatapb.Github{
+ Repository: "https://github.com/other-org/repo.git",
+ Link: "https://github.com/different-org/repo/blob/abcd1234/path/to/file.go#L1",
+ })
+ require.Error(t, err)
+ assert.Contains(t, err.Error(), "does not match link repository")
+}
+
+func TestRepoURLFromTargetMetadataErrorsOnHostMismatch(t *testing.T) {
+ s := &Source{}
+ _, err := s.repoURLFromTargetMetadata(&source_metadatapb.Github{
+ Repository: "https://github.company/other-org/repo.git",
+ Link: "https://github.com/other-org/repo/blob/abcd1234/path/to/file.go#L1",
+ })
+ require.Error(t, err)
+ assert.Contains(t, err.Error(), "does not match link repository")
+}
+
+func TestRepoURLFromTargetMetadataAllowsBareRepositoryName(t *testing.T) {
+ s := &Source{}
+ repoURL, err := s.repoURLFromTargetMetadata(&source_metadatapb.Github{
+ Repository: "repo",
+ Link: "https://github.com/other-org/repo/blob/abcd1234/path/to/file.go#L1",
+ })
+ require.NoError(t, err)
+ assert.Equal(t, "https://github.com/other-org/repo.git", repoURL)
+}
+
+func TestRepoURLFromTargetMetadataAllowsWikiRepositoryWithWikiLink(t *testing.T) {
+ s := &Source{}
+ repoURL, err := s.repoURLFromTargetMetadata(&source_metadatapb.Github{
+ Repository: "https://github.com/other-org/repo.wiki.git",
+ Link: "https://github.com/other-org/repo/wiki/path/to/file.go",
+ })
+ require.NoError(t, err)
+ assert.Equal(t, "https://github.com/other-org/repo.git", repoURL)
+}
+
+func TestScanAllInstallationsMapsUnitBeforeMetadataFetch(t *testing.T) {
+ privateKey := createPrivateKey()
+
+ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ w.Header().Set("Content-Type", "application/json")
+
+ switch {
+ case r.Method == http.MethodPost && strings.Contains(r.URL.Path, "/app/installations/") && strings.HasSuffix(r.URL.Path, "/access_tokens"):
+ parts := strings.Split(r.URL.Path, "/")
+ installID := parts[len(parts)-2]
+ _, _ = fmt.Fprintf(w, `{"token":"token-%s","expires_at":"2099-01-01T00:00:00Z"}`, installID)
+ case r.Method == http.MethodGet && strings.HasSuffix(r.URL.Path, "/app/installations"):
+ _, _ = w.Write([]byte(`[
+ {"id":1337,"account":{"login":"default-org","type":"Organization"}},
+ {"id":2448,"account":{"login":"other-org","type":"Organization"}}
+ ]`))
+ case r.Method == http.MethodGet && strings.HasSuffix(r.URL.Path, "/installation/repositories"):
+ auth := r.Header.Get("Authorization")
+ switch {
+ case strings.Contains(auth, "token-1337"):
+ _, _ = w.Write([]byte(`{"total_count":1,"repositories":[]}`))
+ case strings.Contains(auth, "token-2448"):
+ _, _ = w.Write([]byte(`{"total_count":1,"repositories":[
+ {"name":"repo","full_name":"other-org/repo","clone_url":"https://github.com/other-org/repo.git","owner":{"login":"other-org","type":"Organization"},"size":1}
+ ]}`))
+ default:
+ http.Error(w, "unexpected installation token", http.StatusUnauthorized)
+ }
+ case r.Method == http.MethodGet && strings.HasSuffix(r.URL.Path, "/repos/other-org/repo"):
+ if !strings.Contains(r.Header.Get("Authorization"), "token-2448") {
+ http.Error(w, "wrong installation token", http.StatusForbidden)
+ return
+ }
+ _, _ = w.Write([]byte(`{"name":"repo","full_name":"other-org/repo","clone_url":"https://github.com/other-org/repo.git","owner":{"login":"other-org","type":"Organization"},"size":1}`))
+ default:
+ http.NotFound(w, r)
+ }
+ }))
+ defer server.Close()
+
+ s, conn := createTestSource(&sourcespb.GitHub{
+ Endpoint: server.URL,
+ ScanAllInstallations: true,
+ Credential: &sourcespb.GitHub_GithubApp{
+ GithubApp: &credentialspb.GitHubApp{
+ PrivateKey: privateKey,
+ InstallationId: "1337",
+ AppId: "4141",
+ },
+ },
+ })
+ require.NoError(t, s.Init(context.Background(), "test - github", 0, 1337, false, conn, 1))
+
+ connector := s.connector.(*appConnector)
+ err := s.mapReposToInstallations(context.Background(), connector, []string{"https://github.com/other-org/repo.git"})
+ require.NoError(t, err)
+
+ repoURL, err := s.ensureRepoInfoCache(context.Background(), "https://github.com/other-org/repo.git", &unitErrorReporter{noopReporter()})
+ require.NoError(t, err)
+ require.Equal(t, "https://github.com/other-org/repo.git", repoURL)
+
+ installationID, mapped := connector.installationIDForRepo("https://github.com/other-org/repo.git")
+ assert.True(t, mapped)
+ assert.Equal(t, int64(2448), installationID)
+}
+
+func TestEnumerateAllInstallationReposReportsInstallationErrors(t *testing.T) {
+ privateKey := createPrivateKey()
+
+ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ w.Header().Set("Content-Type", "application/json")
+
+ switch {
+ case r.Method == http.MethodPost && strings.Contains(r.URL.Path, "/app/installations/") && strings.HasSuffix(r.URL.Path, "/access_tokens"):
+ parts := strings.Split(r.URL.Path, "/")
+ installID := parts[len(parts)-2]
+ _, _ = fmt.Fprintf(w, `{"token":"token-%s","expires_at":"2099-01-01T00:00:00Z"}`, installID)
+ case r.Method == http.MethodGet && strings.HasSuffix(r.URL.Path, "/app/installations"):
+ _, _ = w.Write([]byte(`[{"id":1337,"account":{"login":"default-org","type":"Organization"}},{"id":2448,"account":{"login":"other-org","type":"Organization"}}]`))
+ case r.Method == http.MethodGet && strings.HasSuffix(r.URL.Path, "/installation/repositories"):
+ // Fail the first installation's repo listing; succeed for the second.
+ if strings.Contains(r.Header.Get("Authorization"), "token-1337") {
+ http.Error(w, "repo list failed", http.StatusInternalServerError)
+ return
+ }
+ _, _ = w.Write([]byte(`{"total_count":1,"repositories":[{"id":1,"name":"repo-b","full_name":"other-org/repo-b","clone_url":"https://github.com/other-org/repo-b.git","size":1}]}`))
+ default:
+ http.NotFound(w, r)
+ }
+ }))
+ defer server.Close()
+
+ s, conn := createTestSource(&sourcespb.GitHub{
+ Endpoint: server.URL,
+ ScanAllInstallations: true,
+ Credential: &sourcespb.GitHub_GithubApp{
+ GithubApp: &credentialspb.GitHubApp{
+ PrivateKey: privateKey,
+ InstallationId: "1337",
+ AppId: "4141",
+ },
+ },
+ })
+ require.NoError(t, s.Init(context.Background(), "test - github", 0, 1337, false, conn, 1))
+
+ var reportedErrs []error
+ var reportedUnits []sources.SourceUnit
+ reporter := sources.VisitorReporter{
+ VisitUnit: func(_ context.Context, unit sources.SourceUnit) error {
+ reportedUnits = append(reportedUnits, unit)
+ return nil
+ },
+ VisitErr: func(_ context.Context, err error) error {
+ reportedErrs = append(reportedErrs, err)
+ return nil
+ },
+ }
+
+ err := s.enumerateAllInstallationRepos(context.Background(), s.connector.(*appConnector), reporter)
+
+ // A single installation failure is reported but doesn't abort the scan;
+ // the other installation's repos are still enumerated.
+ require.NoError(t, err)
+ require.Len(t, reportedErrs, 1)
+ assert.Contains(t, reportedErrs[0].Error(), "error enumerating repos for installation 1337")
+ require.Len(t, reportedUnits, 1)
+ unitID, _ := reportedUnits[0].SourceUnitID()
+ assert.Equal(t, "https://github.com/other-org/repo-b.git", unitID)
+}
+
+func TestChunksReturnsScanAllInstallationEnumerationErrors(t *testing.T) {
+ privateKey := createPrivateKey()
+
+ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ w.Header().Set("Content-Type", "application/json")
+
+ switch {
+ case r.Method == http.MethodPost && strings.Contains(r.URL.Path, "/app/installations/") && strings.HasSuffix(r.URL.Path, "/access_tokens"):
+ parts := strings.Split(r.URL.Path, "/")
+ installID := parts[len(parts)-2]
+ _, _ = fmt.Fprintf(w, `{"token":"token-%s","expires_at":"2099-01-01T00:00:00Z"}`, installID)
+ case r.Method == http.MethodGet && strings.HasSuffix(r.URL.Path, "/app/installations"):
+ _, _ = w.Write([]byte(`[{"id":1337,"account":{"login":"default-org","type":"Organization"}},{"id":2448,"account":{"login":"other-org","type":"Organization"}}]`))
+ case r.Method == http.MethodGet && strings.HasSuffix(r.URL.Path, "/installation/repositories"):
+ if strings.Contains(r.Header.Get("Authorization"), "token-1337") {
+ http.Error(w, "repo list failed", http.StatusInternalServerError)
+ return
+ }
+ _, _ = w.Write([]byte(`{"total_count":0,"repositories":[]}`))
+ default:
+ http.NotFound(w, r)
+ }
+ }))
+ defer server.Close()
+
+ s, conn := createTestSource(&sourcespb.GitHub{
+ Endpoint: server.URL,
+ ScanAllInstallations: true,
+ Credential: &sourcespb.GitHub_GithubApp{
+ GithubApp: &credentialspb.GitHubApp{
+ PrivateKey: privateKey,
+ InstallationId: "1337",
+ AppId: "4141",
+ },
+ },
+ })
+ require.NoError(t, s.Init(context.Background(), "test - github", 0, 1337, false, conn, 1))
+
+ chunks := make(chan *sources.Chunk, 1)
+ err := s.Chunks(context.Background(), chunks)
+
+ require.Error(t, err)
+ assert.Contains(t, err.Error(), "error enumerating repos for installation 1337")
+}
+
// This only tests the resume info slice portion of setProgressCompleteWithRepo.
func Test_setProgressCompleteWithRepo_resumeInfo(t *testing.T) {
tests := []struct {
@@ -1105,6 +2004,74 @@ func TestGetRepoURLPartsWithTrailingHyphen(t *testing.T) {
}
}
+func TestGithubWebHost(t *testing.T) {
+ tests := []struct {
+ name string
+ endpoint string
+ want string
+ }{
+ {
+ name: "empty endpoint defaults to github",
+ endpoint: "",
+ want: "github.com",
+ },
+ {
+ name: "cloud api endpoint",
+ endpoint: "https://api.github.com",
+ want: "github.com",
+ },
+ {
+ name: "cloud api endpoint without scheme",
+ endpoint: "api.github.com",
+ want: "github.com",
+ },
+ {
+ name: "enterprise endpoint",
+ endpoint: "https://github.example.com/api/v3",
+ want: "github.example.com",
+ },
+ {
+ name: "enterprise endpoint without scheme",
+ endpoint: "github.example.com/api/v3",
+ want: "github.example.com",
+ },
+ {
+ name: "host ending with github.com substring is enterprise",
+ endpoint: "https://legithub.com/api/v3",
+ want: "legithub.com",
+ },
+ }
+
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ assert.Equal(t, tt.want, githubWebHost(tt.endpoint))
+ })
+ }
+}
+
+func TestWikiIsReachableSkipsHeadForPrivateRepos(t *testing.T) {
+ var called bool
+ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ called = true
+ http.Redirect(w, r, "/login", http.StatusFound)
+ }))
+ defer server.Close()
+
+ repoURL := "https://github.example.com/owner/repo.git"
+ s := &Source{
+ conn: &sourcespb.GitHub{Endpoint: server.URL},
+ repoInfoCache: newRepoInfoCache(),
+ }
+ s.repoInfoCache.put(repoURL, repoInfo{
+ owner: "owner",
+ name: "repo",
+ visibility: source_metadatapb.Visibility_private,
+ })
+
+ assert.True(t, s.wikiIsReachable(context.Background(), repoURL))
+ assert.False(t, called)
+}
+
func TestGetGistID(t *testing.T) {
tests := []struct {
trimmedURL []string
@@ -1146,6 +2113,62 @@ func Test_ScanMultipleTargets_MultipleErrors(t *testing.T) {
}
}
+func TestScanAllInstallationsTargetMappingErrorIsTargetedScanError(t *testing.T) {
+ s := &Source{
+ conn: &sourcespb.GitHub{ScanAllInstallations: true},
+ connector: &appConnector{
+ clientsByInstallationID: make(map[int64]*appInstallationClients),
+ repoInstallationMap: make(map[string]int64),
+ },
+ }
+ ctx := context.Background()
+ chunksChan := make(chan *sources.Chunk)
+
+ targets := []sources.ChunkingTarget{
+ {
+ SecretID: 1,
+ QueryCriteria: &source_metadatapb.MetaData{
+ Data: &source_metadatapb.MetaData_Github{
+ Github: &source_metadatapb.Github{Link: "https://github.com/only-owner"},
+ },
+ },
+ },
+ {SecretID: 2},
+ }
+
+ err := s.Chunks(ctx, chunksChan, targets...)
+ unwrappable, ok := err.(interface{ Unwrap() []error })
+ if assert.True(t, ok, "returned error was not unwrappable") {
+ got := unwrappable.Unwrap()
+ require.Len(t, got, 2)
+ for _, targetErr := range got {
+ assert.IsType(t, &sources.TargetedScanError{}, targetErr)
+ }
+ }
+}
+
+func TestScanTargetRejectsWikiLinkHostMismatch(t *testing.T) {
+ s := &Source{
+ conn: &sourcespb.GitHub{Endpoint: cloudV3Endpoint},
+ }
+ target := sources.ChunkingTarget{
+ QueryCriteria: &source_metadatapb.MetaData{
+ Data: &source_metadatapb.MetaData_Github{
+ Github: &source_metadatapb.Github{
+ Link: "https://attacker.example/owner/repo/wiki/path/to/file",
+ Commit: "abc123",
+ File: "path/to/file",
+ },
+ },
+ },
+ }
+
+ err := s.scanTarget(context.Background(), target, sources.ChanReporter{Ch: make(chan *sources.Chunk, 1)})
+
+ require.Error(t, err)
+ assert.Contains(t, err.Error(), "does not match GitHub endpoint host")
+}
+
func TestRepositoryFiltering(t *testing.T) {
// Test that the filteredRepoCache correctly filters repositories
source := &Source{}
diff --git a/pkg/sources/github/graphql.go b/pkg/sources/github/graphql.go
index b82a93fe1..4efb21c17 100644
--- a/pkg/sources/github/graphql.go
+++ b/pkg/sources/github/graphql.go
@@ -17,7 +17,7 @@ import (
// processIssuesWithComments process github repo issues with comments using graphql API
func (s *Source) processIssuesWithComments(
- ctx context.Context, repoInfo repoInfo,
+ ctx context.Context, graphqlClient *githubv4.Client, repoInfo repoInfo,
reporter sources.ChunkReporter, cutoffTime *time.Time,
) error {
vars := map[string]any{
@@ -34,7 +34,7 @@ func (s *Source) processIssuesWithComments(
// loop will continue as long as there are issues in the repository
for {
var query issuesWithComments
- err := s.connector.GraphQLClient().Query(ctx, &query, vars)
+ err := graphqlClient.Query(ctx, &query, vars)
if s.handleGraphqlRateLimitWithChunkReporter(ctx, reporter, &query.RateLimit, err) {
continue
}
@@ -75,7 +75,7 @@ func (s *Source) processIssuesWithComments(
// request this issue more comments
var commentsQuery singleIssueComments
- err := s.connector.GraphQLClient().Query(ctx, &commentsQuery, commentVars)
+ err := graphqlClient.Query(ctx, &commentsQuery, commentVars)
if s.handleGraphqlRateLimitWithChunkReporter(ctx, reporter, &commentsQuery.RateLimit, err) {
continue
}
@@ -111,7 +111,7 @@ func (s *Source) processIssuesWithComments(
}
// processPRWithComments process github repo pull requests with inline comments
-func (s *Source) processPRWithComments(ctx context.Context, repoInfo repoInfo, reporter sources.ChunkReporter, cutoffTime *time.Time) error {
+func (s *Source) processPRWithComments(ctx context.Context, graphqlClient *githubv4.Client, repoInfo repoInfo, reporter sources.ChunkReporter, cutoffTime *time.Time) error {
vars := map[string]any{
owner: githubv4.String(repoInfo.owner),
repository: githubv4.String(repoInfo.name),
@@ -126,7 +126,7 @@ func (s *Source) processPRWithComments(ctx context.Context, repoInfo repoInfo, r
// continue loop as long as there are pull requests remaining
for {
var query pullRequestWithComments
- err := s.connector.GraphQLClient().Query(ctx, &query, vars)
+ err := graphqlClient.Query(ctx, &query, vars)
if s.handleGraphqlRateLimitWithChunkReporter(ctx, reporter, &query.RateLimit, err) {
continue
}
@@ -166,7 +166,7 @@ func (s *Source) processPRWithComments(ctx context.Context, repoInfo repoInfo, r
commentsPagination: pr.Comments.PageInfo.EndCursor,
}
- err := s.connector.GraphQLClient().Query(ctx, &commentQuery, singlePRVars)
+ err := graphqlClient.Query(ctx, &commentQuery, singlePRVars)
if s.handleGraphqlRateLimitWithChunkReporter(ctx, reporter, &commentQuery.RateLimit, err) {
continue
}
@@ -202,7 +202,7 @@ func (s *Source) processPRWithComments(ctx context.Context, repoInfo repoInfo, r
}
// processReviewThreads process github repo pull request review threads
-func (s *Source) processReviewThreads(ctx context.Context, repoInfo repoInfo, reporter sources.ChunkReporter, cutoffTime *time.Time) error {
+func (s *Source) processReviewThreads(ctx context.Context, graphqlClient *githubv4.Client, repoInfo repoInfo, reporter sources.ChunkReporter, cutoffTime *time.Time) error {
vars := map[string]any{
owner: githubv4.String(repoInfo.owner),
repository: githubv4.String(repoInfo.name),
@@ -217,7 +217,7 @@ func (s *Source) processReviewThreads(ctx context.Context, repoInfo repoInfo, re
// continue as long as pull requests have threads
for {
var query prWithReviewThreadIDs
- err := s.connector.GraphQLClient().Query(ctx, &query, vars)
+ err := graphqlClient.Query(ctx, &query, vars)
if s.handleGraphqlRateLimitWithChunkReporter(ctx, reporter, &query.RateLimit, err) {
continue
}
@@ -249,7 +249,7 @@ func (s *Source) processReviewThreads(ctx context.Context, repoInfo repoInfo, re
for _, batch := range chunkIDs(threadIDs, 100) {
ctx.Logger().V(5).Info("Processing Thread comments in Batches", "batch_length", len(batch))
// fetch comments for the batch of threads
- if err := s.fetchThreadComments(ctx, batch, repoInfo, reporter, cutoffTime); err != nil {
+ if err := s.fetchThreadComments(ctx, graphqlClient, batch, repoInfo, reporter, cutoffTime); err != nil {
return fmt.Errorf("error fetching thread review comments: %w", err)
}
}
@@ -259,7 +259,7 @@ func (s *Source) processReviewThreads(ctx context.Context, repoInfo repoInfo, re
}
// fetchThreadComments process github repo pull request threads and their comments
-func (s *Source) fetchThreadComments(ctx context.Context, threadIDs []string, repoInfo repoInfo, reporter sources.ChunkReporter, cutoffTime *time.Time) error {
+func (s *Source) fetchThreadComments(ctx context.Context, graphqlClient *githubv4.Client, threadIDs []string, repoInfo repoInfo, reporter sources.ChunkReporter, cutoffTime *time.Time) error {
// Process in batches of 100
var query multiReviewThreadComments
vars := map[string]any{
@@ -268,7 +268,7 @@ func (s *Source) fetchThreadComments(ctx context.Context, threadIDs []string, re
commentsPagination: (*githubv4.String)(nil),
}
- if err := s.connector.GraphQLClient().Query(ctx, &query, vars); err != nil {
+ if err := graphqlClient.Query(ctx, &query, vars); err != nil {
return fmt.Errorf("multi-thread query failed: %w", err)
}
@@ -288,7 +288,7 @@ func (s *Source) fetchThreadComments(ctx context.Context, threadIDs []string, re
commentsPagination: (*githubv4.String)(nil),
}
- err := s.connector.GraphQLClient().Query(ctx, &query, reviewThreadVars)
+ err := graphqlClient.Query(ctx, &query, reviewThreadVars)
if s.handleGraphqlRateLimitWithChunkReporter(ctx, reporter, &query.RateLimit, err) {
continue
}
@@ -348,8 +348,8 @@ func (s *Source) handleGraphQLRateLimit(ctx context.Context, rl *rateLimit, errI
// if resume time is not empty and is after current time, than put the request to sleep till that.
if !resumeTime.IsZero() && time.Now().Before(resumeTime) {
retryAfter := time.Until(resumeTime)
- time.Sleep(retryAfter)
- return true
+ _, canceled := sleepWithContext(ctx, retryAfter)
+ return !canceled
}
var retryAfter time.Duration
@@ -393,10 +393,10 @@ func (s *Source) handleGraphQLRateLimit(ctx context.Context, rl *rateLimit, errI
}
githubNumRateLimitEncountered.WithLabelValues(s.name).Inc()
- time.Sleep(retryAfter)
- githubSecondsSpentRateLimited.WithLabelValues(s.name).Add(retryAfter.Seconds())
+ slept, canceled := sleepWithContext(ctx, retryAfter)
+ githubSecondsSpentRateLimited.WithLabelValues(s.name).Add(slept.Seconds())
- return true
+ return !canceled
}
func (s *Source) chunkGraphqlIssues(ctx context.Context, repoInfo repoInfo, issues []issue, reporter sources.ChunkReporter) error {
diff --git a/pkg/sources/github/repo.go b/pkg/sources/github/repo.go
index ad20fc794..43b0ec4b7 100644
--- a/pkg/sources/github/repo.go
+++ b/pkg/sources/github/repo.go
@@ -6,17 +6,18 @@ import (
"io"
"net/http"
"net/url"
- "regexp"
"strings"
"sync"
gogit "github.com/go-git/go-git/v5"
"github.com/google/go-github/v67/github"
+ "github.com/trufflesecurity/trufflehog/v3/pkg/common"
"github.com/trufflesecurity/trufflehog/v3/pkg/context"
"github.com/trufflesecurity/trufflehog/v3/pkg/giturl"
"github.com/trufflesecurity/trufflehog/v3/pkg/pb/source_metadatapb"
"github.com/trufflesecurity/trufflehog/v3/pkg/sources"
+ sourcegit "github.com/trufflesecurity/trufflehog/v3/pkg/sources/git"
)
// repoInfoCache is a thread-safe cache to store information about repositories.
@@ -338,13 +339,25 @@ func (s *Source) cacheGistInfo(g *github.Gist) {
// Unfortunately, this isn't 100% accurate. Some repositories have `has_wiki: true` and don't redirect their wiki page,
// but still don't have a cloneable wiki.
func (s *Source) wikiIsReachable(ctx context.Context, repoURL string) bool {
- wikiURL := strings.TrimSuffix(repoURL, ".git") + "/wiki"
+ var wikiURL string
+ if repoInfo, ok := s.repoInfoCache.get(repoURL); ok {
+ if repoInfo.visibility == source_metadatapb.Visibility_private {
+ return true
+ }
+ wikiURL = wikiWebURLForRepoInfo(s.conn.GetEndpoint(), repoInfo)
+ } else {
+ var err error
+ wikiURL, err = wikiWebURLForRepoCloneURL(repoURL)
+ if err != nil {
+ return false
+ }
+ }
req, err := http.NewRequestWithContext(ctx, http.MethodHead, wikiURL, nil)
if err != nil {
return false
}
- res, err := s.connector.APIClient().Client().Do(req)
+ res, err := common.RetryableHTTPClientTimeout(githubHTTPTimeoutSeconds).Do(req)
if err != nil {
return false
}
@@ -359,22 +372,30 @@ func (s *Source) wikiIsReachable(ctx context.Context, repoURL string) bool {
func (s *Source) normalizeRepo(repo string) (string, error) {
// If it's a full URL (has protocol), normalize it
- if regexp.MustCompile(`^[a-z]+://`).MatchString(repo) {
-
+ if hasURLScheme(repo) {
return giturl.NormalizeGithubRepo(repo)
}
+ if isSCPStyleRepoURL(repo) {
+ repoURL, err := sourcegit.GitURLParse(repo)
+ if err == nil && repoURL.Host != "" && repoURL.Path != "" {
+ u := &url.URL{
+ Scheme: "https",
+ Host: repoURL.Host,
+ Path: repoURL.Path,
+ }
+ return giturl.NormalizeGithubRepo(u.String())
+ }
+ }
// If it's a repository name (contains / but not http), convert to full URL first
- if strings.Contains(repo, "/") && !regexp.MustCompile(`^[a-z]+://`).MatchString(repo) {
+ if strings.Contains(repo, "/") && !hasURLScheme(repo) {
fullURL := "https://github.com/" + repo
// If using GitHub Enterprise, adjust the URL accordingly
- if s.conn != nil && s.conn.Endpoint != "" && !endsWithGithub.MatchString(s.conn.Endpoint) {
- u, err := url.Parse(s.conn.Endpoint)
+ if s.conn != nil && s.conn.Endpoint != "" && !isGitHubCloudEndpoint(s.conn.Endpoint) {
+ u, err := endpointBaseURL(s.conn.Endpoint)
if err != nil {
return "", fmt.Errorf("invalid enterprise endpoint: %w", err)
}
- // we want to remove any path components from the endpoint and just use the host
- u.Path = "/" + repo
- fullURL = u.String()
+ fullURL = u.JoinPath(strings.Split(repo, "/")...).String()
}
return giturl.NormalizeGithubRepo(fullURL)
}
diff --git a/pkg/sources/github/urls.go b/pkg/sources/github/urls.go
new file mode 100644
index 000000000..7b8ee7029
--- /dev/null
+++ b/pkg/sources/github/urls.go
@@ -0,0 +1,204 @@
+package github
+
+import (
+ "fmt"
+ "net/url"
+ "strings"
+)
+
+func wikiCloneURLForRepo(repoURL string) (string, bool) {
+ if !strings.HasSuffix(repoURL, ".git") || strings.HasSuffix(repoURL, ".wiki.git") {
+ return "", false
+ }
+ return strings.TrimSuffix(repoURL, ".git") + ".wiki.git", true
+}
+
+func wikiCloneURLForRepoInfo(repoURL string, info repoInfo) (string, bool) {
+ return wikiCloneURLForRepoName(repoURL, info.name)
+}
+
+func wikiCloneURLForRepoName(repoURL, name string) (string, bool) {
+ _, parts, err := getRepoURLParts(repoURL)
+ if err != nil || len(parts) != 3 || !strings.EqualFold(parts[2], name) || !strings.HasSuffix(repoURL, ".git") {
+ return "", false
+ }
+ return strings.TrimSuffix(repoURL, ".git") + ".wiki.git", true
+}
+
+func repoCloneURLForWikiCloneURL(repoURL string) (string, bool) {
+ if strings.HasSuffix(repoURL, ".wiki.git") {
+ return strings.TrimSuffix(repoURL, ".wiki.git") + ".git", true
+ }
+ return "", false
+}
+
+func repoURLsForInstallationLookup(repoURL string) []string {
+ repoURLs := []string{repoURL}
+ // Installation APIs return repository clone URLs, not wiki clone URLs. Keep
+ // the exact URL first so real repositories named "*.wiki" win before the
+ // wiki-parent fallback is attempted.
+ if parentRepoURL, ok := repoCloneURLForWikiCloneURL(repoURL); ok {
+ repoURLs = append(repoURLs, parentRepoURL)
+ }
+ return repoURLs
+}
+
+func wikiWebURLForRepoInfo(endpoint string, info repoInfo) string {
+ return (&url.URL{
+ Scheme: "https",
+ Host: githubWebHost(endpoint),
+ }).JoinPath(info.owner, info.name, "wiki").String()
+}
+
+func wikiWebURLForRepoCloneURL(repoURL string) (string, error) {
+ u, err := url.Parse(repoURL)
+ if err != nil {
+ return "", fmt.Errorf("could not parse repo URL %q: %w", repoURL, err)
+ }
+ u.Path = strings.TrimSuffix(strings.TrimRight(u.Path, "/"), ".git")
+ return u.JoinPath("wiki").String(), nil
+}
+
+func canonicalAPIEndpoint(endpoint string) string {
+ if isGitHubCloudEndpoint(endpoint) {
+ return cloudV3Endpoint
+ }
+ if !hasURLScheme(endpoint) {
+ return "https://" + strings.TrimLeft(endpoint, "/")
+ }
+ return endpoint
+}
+
+func hasURLScheme(rawURL string) bool {
+ if !strings.Contains(rawURL, "://") {
+ return false
+ }
+ u, err := url.Parse(rawURL)
+ return err == nil && u.IsAbs() && u.Scheme != ""
+}
+
+func isSCPStyleRepoURL(repoURL string) bool {
+ return !hasURLScheme(repoURL) && strings.Contains(repoURL, "@") && strings.Contains(repoURL, ":")
+}
+
+func isGitHubCloudEndpoint(endpoint string) bool {
+ host, ok := endpointHost(endpoint)
+ if !ok {
+ return endpoint == ""
+ }
+ host = strings.TrimSuffix(strings.ToLower(host), ".")
+ if strings.HasPrefix(host, "[") {
+ // IPv6 endpoints are always Enterprise hosts.
+ return false
+ }
+ if hostWithoutPort, port, ok := strings.Cut(host, ":"); ok {
+ host = hostWithoutPort
+ if port != "" && port != "443" {
+ return false
+ }
+ }
+ return host == "github.com" || strings.HasSuffix(host, ".github.com")
+}
+
+func endpointHost(endpoint string) (string, bool) {
+ endpoint = strings.TrimSpace(endpoint)
+ if endpoint == "" {
+ return "", false
+ }
+
+ u, err := url.Parse(endpoint)
+ if err == nil && u.Host != "" {
+ return u.Host, true
+ }
+
+ if strings.Contains(endpoint, "://") {
+ return "", false
+ }
+ host, _, _ := strings.Cut(strings.Trim(endpoint, "/"), "/")
+ return host, host != ""
+}
+
+func endpointBaseURL(endpoint string) (*url.URL, error) {
+ host, ok := endpointHost(endpoint)
+ if !ok {
+ return nil, fmt.Errorf("invalid endpoint: %q", endpoint)
+ }
+
+ scheme := "https"
+ if hasURLScheme(endpoint) {
+ u, err := url.Parse(endpoint)
+ if err != nil {
+ return nil, fmt.Errorf("invalid endpoint: %q", endpoint)
+ }
+ scheme = u.Scheme
+ }
+ return &url.URL{Scheme: scheme, Host: host}, nil
+}
+
+func repoCloneURLForTargetEndpoint(endpoint, repoURL string) (string, error) {
+ u, err := url.Parse(repoURL)
+ if err != nil {
+ return "", fmt.Errorf("could not parse target repository URL %q: %w", repoURL, err)
+ }
+ if u.Host == "" {
+ return "", fmt.Errorf("target repository URL %q has no host", repoURL)
+ }
+ if u.Scheme != "http" && u.Scheme != "https" {
+ return "", fmt.Errorf("target repository URL %q has unsupported scheme %q", repoURL, u.Scheme)
+ }
+
+ endpointScheme := "https"
+ if hasURLScheme(endpoint) {
+ endpointURL, err := url.Parse(endpoint)
+ if err != nil {
+ return "", fmt.Errorf("invalid endpoint: %q", endpoint)
+ }
+ if endpointURL.Scheme != "http" && endpointURL.Scheme != "https" {
+ return "", fmt.Errorf("endpoint %q has unsupported scheme %q", endpoint, endpointURL.Scheme)
+ }
+ endpointScheme = endpointURL.Scheme
+ }
+
+ expectedHost := stripDefaultPort(githubWebHost(endpoint), endpointScheme)
+ actualHost := stripDefaultPort(u.Host, u.Scheme)
+ if !strings.EqualFold(actualHost, expectedHost) {
+ return "", fmt.Errorf("target repository host %q does not match GitHub endpoint host %q", u.Host, expectedHost)
+ }
+
+ u.Scheme = endpointScheme
+ return u.String(), nil
+}
+
+func stripDefaultPort(host, scheme string) string {
+ if strings.HasPrefix(host, "[") {
+ return host
+ }
+ hostWithoutPort, port, ok := strings.Cut(host, ":")
+ if !ok {
+ return host
+ }
+ if (scheme == "https" && port == "443") || (scheme == "http" && port == "80") {
+ return hostWithoutPort
+ }
+ return host
+}
+
+func isWikiLink(link string) bool {
+ u, err := url.Parse(link)
+ if err != nil {
+ return false
+ }
+ segments := strings.Split(strings.Trim(u.Path, "/"), "/")
+ return len(segments) >= 3 && segments[2] == "wiki"
+}
+
+func githubWebHost(endpoint string) string {
+ if isGitHubCloudEndpoint(endpoint) {
+ return "github.com"
+ }
+ host, ok := endpointHost(endpoint)
+ if !ok {
+ return "github.com"
+ }
+ return host
+}
diff --git a/pkg/sources/github/urls_test.go b/pkg/sources/github/urls_test.go
new file mode 100644
index 000000000..85bc50ee1
--- /dev/null
+++ b/pkg/sources/github/urls_test.go
@@ -0,0 +1,173 @@
+package github
+
+import (
+ "testing"
+
+ "github.com/stretchr/testify/assert"
+ "github.com/stretchr/testify/require"
+)
+
+func TestWikiCloneURLForRepo(t *testing.T) {
+ got, ok := wikiCloneURLForRepo("https://github.com/owner/repo.git")
+ require.True(t, ok)
+ assert.Equal(t, "https://github.com/owner/repo.wiki.git", got)
+
+ _, ok = wikiCloneURLForRepo("https://github.com/owner/repo.wiki.git")
+ assert.False(t, ok)
+
+ _, ok = wikiCloneURLForRepo("https://github.com/owner/repo")
+ assert.False(t, ok)
+}
+
+func TestRepoCloneURLForWikiCloneURL(t *testing.T) {
+ got, ok := repoCloneURLForWikiCloneURL("https://github.com/owner/repo.wiki.git")
+ require.True(t, ok)
+ assert.Equal(t, "https://github.com/owner/repo.git", got)
+
+ _, ok = repoCloneURLForWikiCloneURL("https://github.com/owner/repo.git")
+ assert.False(t, ok)
+}
+
+func TestRepoURLsForInstallationLookup(t *testing.T) {
+ assert.Equal(
+ t,
+ []string{"https://github.com/owner/repo.git"},
+ repoURLsForInstallationLookup("https://github.com/owner/repo.git"),
+ )
+ assert.Equal(
+ t,
+ []string{"https://github.com/owner/repo.wiki.git", "https://github.com/owner/repo.git"},
+ repoURLsForInstallationLookup("https://github.com/owner/repo.wiki.git"),
+ )
+}
+
+func TestWikiCloneURLForRepoInfo(t *testing.T) {
+ got, ok := wikiCloneURLForRepoInfo("https://github.com/owner/repo.wiki.git", repoInfo{name: "repo.wiki"})
+ require.True(t, ok)
+ assert.Equal(t, "https://github.com/owner/repo.wiki.wiki.git", got)
+
+ _, ok = wikiCloneURLForRepoInfo("https://github.com/owner/repo.wiki.git", repoInfo{name: "repo"})
+ assert.False(t, ok)
+}
+
+func TestWikiWebURLForRepoInfo(t *testing.T) {
+ info := repoInfo{owner: "owner", name: "repo"}
+
+ assert.Equal(t, "https://github.com/owner/repo/wiki", wikiWebURLForRepoInfo("", info))
+ assert.Equal(
+ t,
+ "https://github.company.local/owner/repo/wiki",
+ wikiWebURLForRepoInfo("https://github.company.local/api/v3", info),
+ )
+}
+
+func TestWikiWebURLForRepoCloneURL(t *testing.T) {
+ got, err := wikiWebURLForRepoCloneURL("https://github.com/owner/repo.git")
+ require.NoError(t, err)
+ assert.Equal(t, "https://github.com/owner/repo/wiki", got)
+
+ got, err = wikiWebURLForRepoCloneURL("https://github.com/owner/repo")
+ require.NoError(t, err)
+ assert.Equal(t, "https://github.com/owner/repo/wiki", got)
+}
+
+func TestHasURLScheme(t *testing.T) {
+ assert.True(t, hasURLScheme("https://user:[email protected]/owner/repo.git"))
+ assert.True(t, hasURLScheme("ssh://[email protected]/owner/repo.git"))
+ assert.False(t, hasURLScheme("[email protected]:owner/repo.git"))
+ assert.False(t, hasURLScheme("owner/repo"))
+}
+
+func TestIsSCPStyleRepoURL(t *testing.T) {
+ assert.True(t, isSCPStyleRepoURL("[email protected]:owner/repo.git"))
+ assert.False(t, isSCPStyleRepoURL("ssh://[email protected]/owner/repo.git"))
+ assert.False(t, isSCPStyleRepoURL("https://user:[email protected]/owner/repo.git"))
+ assert.False(t, isSCPStyleRepoURL("owner/repo"))
+}
+
+func TestEndpointHost(t *testing.T) {
+ tests := []struct {
+ name string
+ endpoint string
+ want string
+ wantOK bool
+ }{
+ {name: "empty", endpoint: "", wantOK: false},
+ {name: "cloud URL", endpoint: "https://api.github.com", want: "api.github.com", wantOK: true},
+ {name: "cloud host", endpoint: "api.github.com", want: "api.github.com", wantOK: true},
+ {name: "enterprise URL with path", endpoint: "https://github.example.com/api/v3", want: "github.example.com", wantOK: true},
+ {name: "enterprise host with path", endpoint: "github.example.com/api/v3", want: "github.example.com", wantOK: true},
+ {name: "host with port", endpoint: "https://github.example.com:8443/api/v3", want: "github.example.com:8443", wantOK: true},
+ }
+
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ got, ok := endpointHost(tt.endpoint)
+ assert.Equal(t, tt.wantOK, ok)
+ assert.Equal(t, tt.want, got)
+ })
+ }
+}
+
+func TestIsGitHubCloudEndpoint(t *testing.T) {
+ assert.True(t, isGitHubCloudEndpoint(""))
+ assert.True(t, isGitHubCloudEndpoint("github.com"))
+ assert.True(t, isGitHubCloudEndpoint("https://api.github.com"))
+ assert.True(t, isGitHubCloudEndpoint("api.github.com"))
+ assert.True(t, isGitHubCloudEndpoint("https://github.com:443"))
+ assert.False(t, isGitHubCloudEndpoint("https://legithub.com/api/v3"))
+ assert.False(t, isGitHubCloudEndpoint("https://github.example.com/api/v3"))
+ assert.False(t, isGitHubCloudEndpoint("https://enterprise.example.com/api/github.com"))
+ assert.False(t, isGitHubCloudEndpoint("https://github.com:8443/api/v3"))
+}
+
+func TestEndpointBaseURL(t *testing.T) {
+ got, err := endpointBaseURL("https://github.example.com/api/v3")
+ require.NoError(t, err)
+ assert.Equal(t, "https://github.example.com", got.String())
+
+ got, err = endpointBaseURL("github.example.com/api/v3")
+ require.NoError(t, err)
+ assert.Equal(t, "https://github.example.com", got.String())
+
+ got, err = endpointBaseURL("ghe.example:8443/api/v3")
+ require.NoError(t, err)
+ assert.Equal(t, "https://ghe.example:8443", got.String())
+}
+
+func TestCanonicalAPIEndpoint(t *testing.T) {
+ assert.Equal(t, cloudV3Endpoint, canonicalAPIEndpoint(""))
+ assert.Equal(t, cloudV3Endpoint, canonicalAPIEndpoint("github.com"))
+ assert.Equal(t, cloudV3Endpoint, canonicalAPIEndpoint("https://api.github.com"))
+ assert.Equal(t, "https://github.example.com/api/v3", canonicalAPIEndpoint("github.example.com/api/v3"))
+ assert.Equal(t, "https://github.example.com/api/v3", canonicalAPIEndpoint("https://github.example.com/api/v3"))
+ assert.Equal(t, "https://github.com:8443/api/v3", canonicalAPIEndpoint("github.com:8443/api/v3"))
+}
+
+func TestRepoCloneURLForTargetEndpoint(t *testing.T) {
+ got, err := repoCloneURLForTargetEndpoint("", "http://github.com/owner/repo.git")
+ require.NoError(t, err)
+ assert.Equal(t, "https://github.com/owner/repo.git", got)
+
+ got, err = repoCloneURLForTargetEndpoint(cloudV3Endpoint, "https://github.com:443/owner/repo.git")
+ require.NoError(t, err)
+ assert.Equal(t, "https://github.com:443/owner/repo.git", got)
+
+ got, err = repoCloneURLForTargetEndpoint("http://github.company/api/v3", "https://github.company/owner/repo.git")
+ require.NoError(t, err)
+ assert.Equal(t, "http://github.company/owner/repo.git", got)
+
+ _, err = repoCloneURLForTargetEndpoint(cloudV3Endpoint, "https://attacker.example/owner/repo.git")
+ require.Error(t, err)
+ assert.Contains(t, err.Error(), "does not match GitHub endpoint host")
+
+ _, err = repoCloneURLForTargetEndpoint(cloudV3Endpoint, "ssh://[email protected]/owner/repo.git")
+ require.Error(t, err)
+ assert.Contains(t, err.Error(), "unsupported scheme")
+}
+
+func TestIsWikiLink(t *testing.T) {
+ assert.True(t, isWikiLink("https://github.com/owner/repo/wiki/path/to/file"))
+ assert.False(t, isWikiLink("https://github.com/owner/repo/blob/main/path/to/file"))
+ assert.False(t, isWikiLink("not a url"))
+}
diff --git a/pkg/sources/test_helpers.go b/pkg/sources/test_helpers.go
index e1df37480..965f46ae6 100644
--- a/pkg/sources/test_helpers.go
+++ b/pkg/sources/test_helpers.go
@@ -8,7 +8,8 @@ import (
type ChunkFunc func(chunk *Chunk) error
-var errMatch = errors.New("chunk doesn't match")
+// ErrMatch indicates a chunk did not match and the helper should keep waiting.
+var ErrMatch = errors.New("chunk doesn't match")
func HandleTestChannel(chunksCh chan *Chunk, cf ChunkFunc) error {
for {
@@ -16,7 +17,7 @@ func HandleTestChannel(chunksCh chan *Chunk, cf ChunkFunc) error {
case gotChunk := <-chunksCh:
err := cf(gotChunk)
if err != nil {
- if errors.Is(err, errMatch) {
+ if errors.Is(err, ErrMatch) {
continue
}
return err
diff --git a/proto/sources.proto b/proto/sources.proto
index 9ecf24bee..b4a1f954f 100644
--- a/proto/sources.proto
+++ b/proto/sources.proto
@@ -281,6 +281,8 @@ message GitHub {
bool no_cleanup = 23;
bool ignore_gists = 24;
bool print_legacy_json = 25;
+ // When using GitHub App credentials, enumerate repositories from every app installation.
+ bool scan_all_installations = 26;
}
message GitHubExperimental {