Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the build consistent across archs for Go to correctly report the package path inside the binary (backport #163) #167

Merged
merged 1 commit into from
Dec 18, 2024

Conversation

mergify[bot]
Copy link

@mergify mergify bot commented Dec 18, 2024

Problem:

The build process is passing directly the main.go file for the build. According to Go's spec, this results in Go not properly identifying the package and module path and then marking the compiled binary as command-line-arguments.

Before:

> go version -m main
main: go1.22.9
	path	command-line-arguments

Now:

> go version -m node-disk-manager 
node-disk-manager: go1.22.9
	path	github.com/harvester/node-disk-manager/cmd/node-disk-manager
	mod	github.com/harvester/node-disk-manager	(devel)	

Although this is a minor thing and that doesn't affect the binary itself, it actually blocks security scanners, for example Trivy, from correctly matching the binary (and its path/module origin) with a VEX entry.

This was identified internally when a false-positive vulnerability that was supposed to be suppressed was still being reported in the scanning reports.

Solution:

Only pass the directory that contains the Go file to build, not the file itself.

Related Issue:
N/A

Test plan:

See above.


This is an automatic backport of pull request #163 done by Mergify.

… package path inside the binary

Signed-off-by: Guilherme Macedo <[email protected]>
(cherry picked from commit 4a9d4cd)
@Vicente-Cheng Vicente-Cheng merged commit df3e0d0 into v0.7.x Dec 18, 2024
6 checks passed
@Vicente-Cheng Vicente-Cheng deleted the mergify/bp/v0.7.x/pr-163 branch December 25, 2024 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants