Closed L3n41c closed 1 year ago
I’ve extracted the protoc
upgrade in a dedicated PR: #213.
~~I’ve rebased this PR on top of #213, which allowed me to undo the hack I had to apply on top of the upstream CycloneDX .proto
file to make it accepted by the deprecated gogo/protobuf
compiler.
In order to review only the SBOM related changes, you should have a look at https://github.com/DataDog/agent-payload/pull/212/commits/ba624131723304931147cef0f0aba359a4b3f549.~~
Reviewers: please see the review guidelines.
Define the SBOM message to be sent by the agent to the
sbom
EVP track.This payload is further described in the “Container images vulnerabilities” RFC.
This PR is built on top of #213.Generating the upstream CycloneDX
.proto
file with the current versions ofprotoc
andgogo/protobuf
doesn’t work..proto
file isn’t considered valid.protoc
complains about theoptional
keyword for ex..proto
file is “fixed”, the generated code doesn’t work because the use of “well-know” types likegoogle.protobuf.Timestamp
generates use of external GO modules (github.com/golang/protobuf/ptypes/timestamp
) that don’t implement the interface expected by the generated code.Upgrading the version of the ProtocolBuffer compiler for all the messages doesn’t work because it adds some
state
,sizeCache
andunknownFields
google.golang.org/protobuf/runtime/protoimpl
unexported fields which are making the generatedstruct
unsuitable for:map[…]…
;go vet
complains each time a generated struct is copied (either passed by value as a function argument or as a function return value) because one of theprotoimpl
unexported field contains async.Mutex
which cannot be copied.That’s why I had to use different version of
protoc
depending on the message.