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

util: fix GetRuntimeDir permission check #947

Merged

Conversation

giuseppe
Copy link
Member

@giuseppe giuseppe commented Mar 1, 2022

Do not require 0700 permissions for the runtime directory but accept
anything that is writeable by the user.

Signed-off-by: Giuseppe Scrivano [email protected]

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 1, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: giuseppe

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@giuseppe
Copy link
Member Author

giuseppe commented Mar 1, 2022

@baude @rhatdan @edsantiago PTAL

We need this for now until we can use containers/podman#13389

@edsantiago
Copy link
Collaborator

@giuseppe be advised this is now low priority. Current plan is to revert the commit that caused this.

Ref: containers/podman#13391 (main)
Ref: containers/podman#13392 (v4.0)

Do not require 0700 permissions for the runtime directory but accept
anything that is writeable by the user.

Signed-off-by: Giuseppe Scrivano <[email protected]>
Copy link
Member

@vrothberg vrothberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
@edsantiago PTanotherL

@@ -19,6 +19,12 @@ var (
rootlessRuntimeDir string
)

// isWriteableOnlyByOwner checks that the specified permission mask allows write
// access only to the owner.
func isWriteableOnlyByOwner(perm os.FileMode) bool {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find the function name misleading: yes, it checks WritableOnlyByOwner but also checks that owner has rx. Unfortunately I don't know the context for checking that so I don't know when if or how user perms would not be rwx, or why there's a need to check.

As best I can tell from the original commit 4cc4c7137d29111fe6ccca526bc11d435fa20dd7, I believe the intention behind this check was more "does owner have rwx" than "is it locked down". If so, a name like ownerHasFullAccess() might be more descriptive - but I really don't know. @giuseppe this was your code from the beginning, though: what was your intention then (July 2018)? Can you (or anyone) find a less misleading name for this check?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh wow, github didn't linkify the commit hash. Try this instead: #1048

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, another failure to linkify. This? containers/podman#1048

@rhatdan
Copy link
Member

rhatdan commented Mar 2, 2022

I don't believe we care about the ownership of the directory from Podmans point of view other then the user can use it.
So
/lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants