-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
setuid flag is lost in COPYed files #2075
Comments
tonydelanuez
added a commit
to tonydelanuez/kaniko
that referenced
this issue
May 15, 2022
Fixes GoogleContainerTools#2075 When a file with the setuid bit is copied from one stage to another, the permissions were not copied over properly after setting ownership on directory and the file itself.
tonydelanuez
added a commit
to tonydelanuez/kaniko
that referenced
this issue
May 15, 2022
Fixes GoogleContainerTools#2075 When a file with the setuid bit is copied from one stage to another, the permissions were not copied over properly after setting ownership on directory and the file itself.
4 tasks
imjasonh
added a commit
that referenced
this issue
May 22, 2022
* Fix missing file permissions on multi-stage build Fixes #2075 When a file with the setuid bit is copied from one stage to another, the permissions were not copied over properly after setting ownership on directory and the file itself. * Update pkg/util/fs_util.go Co-authored-by: Jason Hall <[email protected]> * Adding boilerplate to dockerfile * Add bash check to bail with exit code 1 if setuid not present Co-authored-by: Jason Hall <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Actual behavior
When a file with the setuid flag enabled is
COPY
ed from one stage to another, the setuid flag is lost. This appears to be new behavior as of v1.8.0.Expected behavior
All file mode flags/bits should be
COPY
ed.An example of when this is desired is fixuid.
To Reproduce
In this example, I use fixuid as the file under test. However, any executable would likely work.
Use the Dockerfile and build context noted in Additional Information, below. During the build process, the (pre-
COPY
) permissions are displayed as a sanity check.For each kaniko image noted Additional Information, below, build the image.
Run the resulting image and check the file mode on the
fixuid
binary.Here are the results from running the script across recent kaniko versions. Note that the first line of output is from the build itself (before the
COPY
), while the second line is from the subsequentdocker run
using the built image.Verify the behavior with Docker:
A workaround is to set the file mode with a separate
RUN
command after theCOPY
. This does result in the setuid flag appearing in the image. However, I would expect the same functionality as Docker.Additional Information
Dockerfile:
Build Context:
curl -fLsSO "https://github.com/boxboat/fixuid/releases/download/v0.5.1/fixuid-0.5.1-linux-amd64.tar.gz"
(Any file would likely work; doesn't have to be
fixuid
.)Kaniko Image (fully qualified with digest):
The following images were used in the tests above.
1.8.0
and1.8.1
exhibit the bug.1.6.0
and1.7.0
do not.Triage Notes for the Maintainers
--cache
flagThe text was updated successfully, but these errors were encountered: