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 #127) #133

Closed
wants to merge 1 commit into from

Conversation

mergify[bot]
Copy link

@mergify mergify bot commented Dec 5, 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 webhook 
webhook: go1.22.9
	path	github.com/harvester/harvester-network-controller/cmd/webhook
	mod	github.com/harvester/harvester-network-controller	(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 #127 done by Mergify.

… package path inside the binary

Signed-off-by: Guilherme Macedo <[email protected]>
(cherry picked from commit 637d6de)
@ihcsim
Copy link

ihcsim commented Dec 5, 2024

Superseded by #128.

@ihcsim ihcsim closed this Dec 5, 2024
@ihcsim ihcsim deleted the mergify/bp/v0.5.x/pr-127 branch December 5, 2024 17:13
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