Repository navigation
Conversation
Processes in the Pod can write to the volume, because the kubelet applies the fsGroup with group write permissions, so any entry in it may have been replaced since the last publish. Secret files and their directories are now opened relative to their parent without following symlinks, and data is only written into regular files.
lfrancke
force-pushed
the
fix/write-secret-files-nofollow
branch
from
November 10, 2026 21:34
932fea6 to
d469897
Compare
lfrancke
marked this pull request as ready for review
November 10, 2026 21:41
Techassi
self-requested a review
November 11, 2026 07:59
| }; | ||
| use serde::{Deserialize, de::IntoDeserializer}; | ||
| use snafu::{ResultExt, Snafu, ensure}; | ||
| use snafu::{OptionExt, ResultExt, Snafu, ensure}; |
Member
There was a problem hiding this comment.
I know it was already done that way for ResultExt, but it's prefarable to show that we only need the trait methods:
Suggested change
| use snafu::{OptionExt, ResultExt, Snafu, ensure}; | |
| use snafu::{OptionExt as _, ResultExt as _, Snafu, ensure}; |
20 tasks
| .await | ||
| .context(publish_error::CreateFileSnafu { path })?; | ||
| Ok(()) | ||
| write_secret_file(target_path, Path::new(PROVISIONED_MARKER_FILE_NAME), &[]) |
Member
There was a problem hiding this comment.
This could be a const (might need to be PathBuf).
Member
There was a problem hiding this comment.
I realise it wasn't before, so no big deal
| assert_eq!(contents, b"key"); | ||
| } | ||
|
|
||
| #[test] |
Member
There was a problem hiding this comment.
I think tests using std::os::unix should technically be gated. But not a big deal.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This is a followup to #773 and #770.
There are two places where we write files now: the marker file and the secret.
In the last PRs we secured the marker file against "symlink" attacks. The problem is that the pod can write to its own volume so it may have replaced any part of the path with a symlink.
This PR also secures the secret writing part by combining them into one write function.
This introduces a new direct dependecy on
rustixbut we already had an indirect dependency on it before. The alternative that i've used in the past would be thecap-stdlibrary/crate but that's a whole new thing.Reviewer
Acceptance