From 4f7bcb50262477d27132ef2e9cc5424c2edaf1b2 Mon Sep 17 00:00:00 2001 From: Pierre Guilleminot Date: Wed, 7 Feb 2024 14:45:48 +0100 Subject: [PATCH 1/2] SBOM: add a HOST_IMAGE SBOMSourceType --- proto/sbom/sbom.proto | 1 + sbom/sbom.pb.go | 35 ++++++++++++++++++++--------------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/proto/sbom/sbom.proto b/proto/sbom/sbom.proto index 7af1d9e7..7f00829e 100644 --- a/proto/sbom/sbom.proto +++ b/proto/sbom/sbom.proto @@ -42,6 +42,7 @@ enum SBOMSourceType { CONTAINER_FILE_SYSTEM = 2; HOST_FILE_SYSTEM = 3; CI_PIPELINE = 4; + HOST_IMAGE = 5; // SBOM sourced from an Host OS image (ie AWS AMIs, GCP OS images etc.) } enum SBOMStatus { diff --git a/sbom/sbom.pb.go b/sbom/sbom.pb.go index 3da1db74..12648e84 100644 --- a/sbom/sbom.pb.go +++ b/sbom/sbom.pb.go @@ -31,6 +31,7 @@ const ( SBOMSourceType_CONTAINER_FILE_SYSTEM SBOMSourceType = 2 SBOMSourceType_HOST_FILE_SYSTEM SBOMSourceType = 3 SBOMSourceType_CI_PIPELINE SBOMSourceType = 4 + SBOMSourceType_HOST_IMAGE SBOMSourceType = 5 // SBOM sourced from an Host OS image (ie AWS AMIs, GCP OS images etc.) ) // Enum value maps for SBOMSourceType. @@ -41,6 +42,7 @@ var ( 2: "CONTAINER_FILE_SYSTEM", 3: "HOST_FILE_SYSTEM", 4: "CI_PIPELINE", + 5: "HOST_IMAGE", } SBOMSourceType_value = map[string]int32{ "UNSPECIFIED": 0, @@ -48,6 +50,7 @@ var ( "CONTAINER_FILE_SYSTEM": 2, "HOST_FILE_SYSTEM": 3, "CI_PIPELINE": 4, + "HOST_IMAGE": 5, } ) @@ -222,6 +225,7 @@ type SBOMEntity struct { Heartbeat bool `protobuf:"varint,8,opt,name=heartbeat,proto3" json:"heartbeat,omitempty"` // Whether the SBOM is identical to the previously sent one Hash string `protobuf:"bytes,9,opt,name=hash,proto3" json:"hash,omitempty"` // Hash of the SBOM // Types that are assignable to Sbom: + // // *SBOMEntity_Cyclonedx // *SBOMEntity_Error Sbom isSBOMEntity_Sbom `protobuf_oneof:"sbom"` @@ -437,21 +441,22 @@ var file_proto_sbom_sbom_proto_rawDesc = []byte{ 0x73, 0x42, 0x06, 0x0a, 0x04, 0x73, 0x62, 0x6f, 0x6d, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x42, 0x15, 0x0a, 0x13, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x2a, 0x7f, 0x0a, 0x0e, 0x53, 0x42, 0x4f, 0x4d, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, - 0x70, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, - 0x44, 0x10, 0x00, 0x12, 0x1a, 0x0a, 0x16, 0x43, 0x4f, 0x4e, 0x54, 0x41, 0x49, 0x4e, 0x45, 0x52, - 0x5f, 0x49, 0x4d, 0x41, 0x47, 0x45, 0x5f, 0x4c, 0x41, 0x59, 0x45, 0x52, 0x53, 0x10, 0x01, 0x12, - 0x19, 0x0a, 0x15, 0x43, 0x4f, 0x4e, 0x54, 0x41, 0x49, 0x4e, 0x45, 0x52, 0x5f, 0x46, 0x49, 0x4c, - 0x45, 0x5f, 0x53, 0x59, 0x53, 0x54, 0x45, 0x4d, 0x10, 0x02, 0x12, 0x14, 0x0a, 0x10, 0x48, 0x4f, - 0x53, 0x54, 0x5f, 0x46, 0x49, 0x4c, 0x45, 0x5f, 0x53, 0x59, 0x53, 0x54, 0x45, 0x4d, 0x10, 0x03, - 0x12, 0x0f, 0x0a, 0x0b, 0x43, 0x49, 0x5f, 0x50, 0x49, 0x50, 0x45, 0x4c, 0x49, 0x4e, 0x45, 0x10, - 0x04, 0x2a, 0x32, 0x0a, 0x0a, 0x53, 0x42, 0x4f, 0x4d, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, - 0x0b, 0x0a, 0x07, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, - 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x50, 0x45, 0x4e, 0x44, - 0x49, 0x4e, 0x47, 0x10, 0x02, 0x42, 0x2a, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x44, 0x61, 0x74, 0x61, 0x44, 0x6f, 0x67, 0x2f, 0x61, 0x67, 0x65, 0x6e, - 0x74, 0x2d, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2f, 0x76, 0x35, 0x2f, 0x73, 0x62, 0x6f, - 0x6d, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x2a, 0x8f, 0x01, 0x0a, 0x0e, 0x53, 0x42, 0x4f, 0x4d, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, + 0x79, 0x70, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, + 0x45, 0x44, 0x10, 0x00, 0x12, 0x1a, 0x0a, 0x16, 0x43, 0x4f, 0x4e, 0x54, 0x41, 0x49, 0x4e, 0x45, + 0x52, 0x5f, 0x49, 0x4d, 0x41, 0x47, 0x45, 0x5f, 0x4c, 0x41, 0x59, 0x45, 0x52, 0x53, 0x10, 0x01, + 0x12, 0x19, 0x0a, 0x15, 0x43, 0x4f, 0x4e, 0x54, 0x41, 0x49, 0x4e, 0x45, 0x52, 0x5f, 0x46, 0x49, + 0x4c, 0x45, 0x5f, 0x53, 0x59, 0x53, 0x54, 0x45, 0x4d, 0x10, 0x02, 0x12, 0x14, 0x0a, 0x10, 0x48, + 0x4f, 0x53, 0x54, 0x5f, 0x46, 0x49, 0x4c, 0x45, 0x5f, 0x53, 0x59, 0x53, 0x54, 0x45, 0x4d, 0x10, + 0x03, 0x12, 0x0f, 0x0a, 0x0b, 0x43, 0x49, 0x5f, 0x50, 0x49, 0x50, 0x45, 0x4c, 0x49, 0x4e, 0x45, + 0x10, 0x04, 0x12, 0x0e, 0x0a, 0x0a, 0x48, 0x4f, 0x53, 0x54, 0x5f, 0x49, 0x4d, 0x41, 0x47, 0x45, + 0x10, 0x05, 0x2a, 0x32, 0x0a, 0x0a, 0x53, 0x42, 0x4f, 0x4d, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x10, 0x00, 0x12, 0x0a, 0x0a, + 0x06, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x50, 0x45, 0x4e, + 0x44, 0x49, 0x4e, 0x47, 0x10, 0x02, 0x42, 0x2a, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x44, 0x61, 0x74, 0x61, 0x44, 0x6f, 0x67, 0x2f, 0x61, 0x67, 0x65, + 0x6e, 0x74, 0x2d, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2f, 0x76, 0x35, 0x2f, 0x73, 0x62, + 0x6f, 0x6d, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( From 1eab073e64cb9a70639d0a531d1e4960829dcde2 Mon Sep 17 00:00:00 2001 From: Pierre Guilleminot Date: Thu, 8 Feb 2024 09:58:27 +0100 Subject: [PATCH 2/2] Pin protoc-gen-go-vtproto to v0.5.0 --- Rakefile | 2 +- sbom/sbom.pb.go | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Rakefile b/Rakefile index c4fb473d..52a0ba9b 100644 --- a/Rakefile +++ b/Rakefile @@ -101,7 +101,7 @@ BASH PATH=#{protoc_gen_go_dir}/bin #{protoc_binary_2} --proto_path=$GOPATH/src:. --go_out=$GOPATH/src proto/sbom/sbom.proto # Install protoc-gen-go-vtproto - GOPATH=#{protoc_gen_go_dir} go install github.com/planetscale/vtprotobuf/cmd/protoc-gen-go-vtproto@latest + GOPATH=#{protoc_gen_go_dir} go install github.com/planetscale/vtprotobuf/cmd/protoc-gen-go-vtproto@v0.5.0 echo "Generating CWS Activity Dumps v1" PATH=#{protoc_gen_go_dir}/bin #{protoc_binary_2} --proto_path=$GOPATH/src:. \ diff --git a/sbom/sbom.pb.go b/sbom/sbom.pb.go index 12648e84..4e3a59bd 100644 --- a/sbom/sbom.pb.go +++ b/sbom/sbom.pb.go @@ -225,7 +225,6 @@ type SBOMEntity struct { Heartbeat bool `protobuf:"varint,8,opt,name=heartbeat,proto3" json:"heartbeat,omitempty"` // Whether the SBOM is identical to the previously sent one Hash string `protobuf:"bytes,9,opt,name=hash,proto3" json:"hash,omitempty"` // Hash of the SBOM // Types that are assignable to Sbom: - // // *SBOMEntity_Cyclonedx // *SBOMEntity_Error Sbom isSBOMEntity_Sbom `protobuf_oneof:"sbom"`