-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Workingdir does not give write access to the group #7804
Comments
Hey @urvi-p, thanks for the issue. This is the "normal" kubernetes behavior, tektoncd/pipeline doesn't do any magic with workingdir (and does very little to none with workspaces). When you specify a workingdir that doesn't exists (which is the case, |
@vdemeester I assumed that it was the workingdirinit that created the subpath: https://github.com/tektoncd/pipeline/blob/main/cmd/workingdirinit/main.go Could we update the permissions here higher than 755 I wonder. But my understanding might be wrong here. |
As @chitrangpatel noted it looks like tekton and not k8 is creating the workingdir in cases where it's a relative path or starts with /workspace. For example, if I look at the permissions on both the workspace (using an emptyDir) and the directory created by Tekton, they are different:
Should the created directories just have the same permissions as their 'parent' workspace? |
I looked into this. Turns out that we have two volumeMounts. An The code https://github.com/tektoncd/pipeline/blob/main/cmd/workingdirinit/main.go here is updating and creating directories under the We could do the following though:
cc @tektoncd/core-maintainers looking for feedback here. |
@vdemeester I'm bringing this back on our radar. Please see my comment above. I think we can fix this and we probably should. |
What happens if the |
I think what happens even now is that the workingDir init tries to create the path within I think if we mount all the volumes that the Task uses have into the workingDirInit containers and not limit it to just |
Prior to this PR, workingDirInit did not deal handle permissions of nested child directories in workingDirs. This PR provides the same permissions as that of the existing parent directory. This allows non-root users to also create relative sub diectories in a workspace if used as a workingDir. Fixes tektoncd#7804.
Prior to this PR, workingDirInit did not deal handle permissions of nested child directories in workingDirs. This PR provides the same permissions as that of the existing parent directory. This allows non-root users to also create relative sub diectories in a workspace if used as a workingDir. Fixes tektoncd#7804.
Prior to this PR, workingDirInit did not deal handle permissions of nested child directories in workingDirs. This PR provides the same permissions as that of the existing parent directory. This allows non-root users to also create relative sub diectories in a workspace if used as a workingDir. Fixes tektoncd#7804.
Prior to this PR, workingDirInit did not deal handle permissions of nested child directories in workingDirs. This PR provides the same permissions as that of the existing parent directory. This allows non-root users to also create relative sub diectories in a workspace if used as a workingDir. Fixes tektoncd#7804.
Expected Behavior
Workingdir should be created with write access for the group.
Images with the user as nonroot should be able to run commands that require write access in the workingdir.
Actual Behavior
Workingdir is created with no write access for the group, even though the group has write access for the workspace itself.
(For images with a nonroot user) Running a command like
mkdir
in the workingdir will return aPermission denied
error.Steps to Reproduce the Problem
Additional Info
Kubernetes version:
Output of
kubectl version
:Tekton Pipeline version:
Output of
tkn version
orkubectl get pods -n tekton-pipelines -l app=tekton-pipelines-controller -o=jsonpath='{.items[0].metadata.labels.version}'
The text was updated successfully, but these errors were encountered: