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

Fix permissions on secrets directory #3702

Merged
merged 2 commits into from
Jan 12, 2022

Conversation

rhatdan
Copy link
Member

@rhatdan rhatdan commented Jan 11, 2022

The permission on this directory will prevent user namespaces from using
secrets. Should be world searchable

[NO NEW TESTS REQUIRED]

Signed-off-by: Daniel J Walsh [email protected]

What type of PR is this?

/kind api-change
/kind bug
/kind cleanup
/kind deprecation
/kind design
/kind documentation
/kind failing-test
/kind feature
/kind flake
/kind other

What this PR does / why we need it:

How to verify it

Which issue(s) this PR fixes:

Special notes for your reviewer:

Does this PR introduce a user-facing change?


@rhatdan
Copy link
Member Author

rhatdan commented Jan 11, 2022

The permission on this directory will prevent user namespaces from using
secrets.  Should be world searchable

[NO TESTS NEEDED]

Signed-off-by: Daniel J Walsh <[email protected]>
@@ -2627,7 +2627,7 @@ func getSecretMount(tokens []string, secrets map[string]define.Secret, mountlabe

// Copy secrets to container working dir (or tmp dir if it's an env), since we need to chmod,
// chown and relabel it for the container user and we don't want to mess with the original file
if err := os.MkdirAll(filepath.Dir(ctrFileOnHost), 0644); err != nil {
if err := os.MkdirAll(filepath.Dir(ctrFileOnHost), 0755); err != nil {
return nil, "", err
}
if err := ioutil.WriteFile(ctrFileOnHost, data, 0644); err != nil {
Copy link
Member

@ashley-cui ashley-cui Jan 11, 2022

Choose a reason for hiding this comment

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

Do we also need to change the perms on the file itself or just the dir? Not sure

Copy link
Member Author

Choose a reason for hiding this comment

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

File is fine, it is world readable, This issue is 644 means a direcory it listable but not searchable.

So a non root user would not be able to get to the data file on disk. Although they would be able to list it.

@ashley-cui
Copy link
Member

LGTM

@TomSweeneyRedHat
Copy link
Member

@rhatdan I think the overlay test failure might be real. It looks like a perm issue trying to get to a directory.

@TomSweeneyRedHat
Copy link
Member

Code LGTM, maybe a test case adjustment is needed?

@flouthoc
Copy link
Collaborator

/lgtm
/approve

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 12, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: flouthoc, rhatdan

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

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

Successfully merging this pull request may close these issues.

5 participants