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

Makefile: Run release build as regular user #751

Merged
merged 1 commit into from
Jun 22, 2022

Conversation

gandro
Copy link
Member

@gandro gandro commented Jun 22, 2022

This fixes an issue where make release would fail to build the release
binaries, because go build would fail with error obtaining VCS status: exit status 128.

This happens because go build in Go v1.18 and newer is invoking git
as part of the build process. However, due to CVE-2022-24765,
git v2.35.2 now requires that the current git directory for most
commands is owned by the user with which the git process is running.

Because our containerized build was running as root inside of the
container, git rightfully refused to work on a tree owned by a non-root
user. This commit fixes this issue by creating a release user with the
same UID/GID of the current user (assumed to be the user owning the
working directory), and running make with the permissions of that user
instead of running as root.

Signed-off-by: Sebastian Wicki sebastian@isovalent.com

This fixes an issue where `make release` would fail to build the release
binaries, because `go build` would fail with `error obtaining VCS
status: exit status 128`.

This happens because `go build` in Go v1.18 and newer is invoking `git`
as part of the build process. However, due to
[CVE-2022-24765](https://github.blog/2022-04-12-git-security-vulnerability-announced/),
git v2.35.2 now requires that the current git directory for most
commands is owned by the user with which the `git` process is running.

Because our containerized build was running as `root` inside of the
container, git rightfully refused to work on a tree owned by a non-root
user. This commit fixes this issue by creating a release user with the
same UID/GID of the current user (assumed to be the user owning the
working directory), and running `make` with the permissions of that user
instead of running as root.

Signed-off-by: Sebastian Wicki <sebastian@isovalent.com>
@gandro gandro added the release-note/misc This PR makes changes that have no direct user impact. label Jun 22, 2022
@gandro gandro requested review from a team, glibsm and kaworu and removed request for a team and glibsm June 22, 2022 15:55
Makefile Show resolved Hide resolved
@gandro gandro merged commit 691d440 into master Jun 22, 2022
@gandro gandro deleted the pr/gandro/fix-make-release-for-cve-2022-24765 branch June 22, 2022 16:15
tklauser added a commit to cilium/cilium-cli that referenced this pull request Jun 22, 2022
Instead of adding the checkout directory to git's safe directories as
done in commit 023ccfb ("make: allow running `git status` during
release build"), change the release target to create a regular user with
the same UID/GID as the current user (assumed to be the user owning the
working directory) inside the container and use it to run `make
release`.

Follows cilium/hubble#751

Signed-off-by: Tobias Klauser <tobias@cilium.io>
tklauser added a commit to cilium/cilium-cli that referenced this pull request Jun 23, 2022
Instead of adding the checkout directory to git's safe directories as
done in commit 023ccfb ("make: allow running `git status` during
release build"), change the release target to create a regular user with
the same UID/GID as the current user (assumed to be the user owning the
working directory) inside the container and use it to run `make
release`.

Follows cilium/hubble#751

Signed-off-by: Tobias Klauser <tobias@cilium.io>
tklauser added a commit to cilium/pwru that referenced this pull request Jun 28, 2022
Instead of adding the checkout directory to git's safe directories as
done in commit 1d42d3f ("make: allow running git status during
release build"), change the release target to create a regular user with
the same UID/GID as the current user (assumed to be the user owning the
working directory) inside the container and use it to run `make
release`.

Follows cilium/hubble#751 and cilium-cli#945

Signed-off-by: Tobias Klauser <tobias@cilium.io>
tklauser added a commit to cilium/pwru that referenced this pull request Jun 28, 2022
Instead of adding the checkout directory to git's safe directories as
done in commit 1d42d3f ("make: allow running git status during
release build"), change the release target to create a regular user with
the same UID/GID as the current user (assumed to be the user owning the
working directory) inside the container and use it to run `make
release`.

Follows cilium/hubble#751 and cilium/cilium-cli#945

Signed-off-by: Tobias Klauser <tobias@cilium.io>
brb pushed a commit to cilium/pwru that referenced this pull request Jun 28, 2022
Instead of adding the checkout directory to git's safe directories as
done in commit 1d42d3f ("make: allow running git status during
release build"), change the release target to create a regular user with
the same UID/GID as the current user (assumed to be the user owning the
working directory) inside the container and use it to run `make
release`.

Follows cilium/hubble#751 and cilium/cilium-cli#945

Signed-off-by: Tobias Klauser <tobias@cilium.io>
aditighag pushed a commit to aditighag/cilium-cli that referenced this pull request Apr 21, 2023
Instead of adding the checkout directory to git's safe directories as
done in commit 023ccfb ("make: allow running `git status` during
release build"), change the release target to create a regular user with
the same UID/GID as the current user (assumed to be the user owning the
working directory) inside the container and use it to run `make
release`.

Follows cilium/hubble#751

Signed-off-by: Tobias Klauser <tobias@cilium.io>
michi-covalent pushed a commit to michi-covalent/cilium that referenced this pull request May 30, 2023
Instead of adding the checkout directory to git's safe directories as
done in commit 023ccfb8466e ("make: allow running `git status` during
release build"), change the release target to create a regular user with
the same UID/GID as the current user (assumed to be the user owning the
working directory) inside the container and use it to run `make
release`.

Follows cilium/hubble#751

Signed-off-by: Tobias Klauser <tobias@cilium.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note/misc This PR makes changes that have no direct user impact.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants