-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix missing setuid flags on COPY --from=build operation (#2089)
* 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]>
- Loading branch information
1 parent
e22346d
commit 77ac694
Showing
3 changed files
with
38 additions
and
5 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
integration/dockerfiles-with-context/issue-2075/Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Copyright 2022 Google, Inc. All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
FROM docker.io/debian:bullseye-slim as base | ||
FROM base as build | ||
COPY ["top1", "/tmp/top1"] | ||
RUN \ | ||
set -eu; \ | ||
cp /tmp/top1 /usr/local/bin/top1; \ | ||
chown root:root /usr/local/bin/top1; \ | ||
chmod u=rxs,go=rx /usr/local/bin/top1; \ | ||
ls -lh /usr/local/bin/top1 | ||
FROM base as final | ||
COPY --from=build ["/usr/local/bin/top1", "/usr/local/bin/"] | ||
RUN [ -u /usr/local/bin/top1 ] | ||
LABEL \ | ||
description="Testing setuid behavior in Kaniko" |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77ac694
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks!