anchore / syft

CLI tool and library for generating a Software Bill of Materials from container images and filesystems
Apache License 2.0
6.26k stars 576 forks source link

go binary cataloger use richer commit version #894

Open jonasagx opened 2 years ago

jonasagx commented 2 years ago

What would you like to be added: we could toy with changing the version to be in the format of v0.0.0-- if we could derive the date correctly from the build info (which I'm not certain is possible). This would make it consistent to go module version formatting.

Why is this needed: Main module could offer better version info in a similar go.mod version format.

Additional context: Idea came up while adding support to go1.18 debug BuildInfo

luhring commented 2 years ago

I think we might not need to pursue our own solution to creating a version for the main module. This Go proposal was just accepted, so hopefully we can find the version value we need directly in Go binaries in the future.

fg-j commented 2 years ago

Hi there! Paketo buildpacks maintainer, here. We're seeing our end-users have issues with the current empty-string format for the main module version because it breaks their SBOM-merging. Would love to see a fix that places some reasonable default in that empty field.

ryanmoran commented 2 years ago

Related: https://github.com/anchore/syft/issues/959

jonasagx commented 2 years ago

As pointed out by the author of https://github.com/paketo-buildpacks/go-build/issues/302 this issue affects binaries compiled by a go compiler version < 1.18.

I agree that a reasonable default should exist for compatibility with older binaries, but there are open questions:

luhring commented 2 years ago

Hi @fg-j and @ryanmoran — thanks for the feedback! To consolidate communication, we'll track the "missing version field" problem in #959. Thanks for raising this! 🙏