Repository navigation
fix: Write secret files without following symlinks - #775
Merged
Merged
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
20 tasks
Techassi
requested changes
Nov 13, 2026
Techassi
left a comment
Member
There was a problem hiding this comment.
A couple of comments. There might come more, but this PR requires full mental attention (which is quite taxing) and I want to get the most important bits right before moving to more nit-picky stuff.
Techassi
previously approved these changes
Nov 16, 2026
lfrancke
enabled auto-merge
November 16, 2026 08:53
lfrancke
disabled auto-merge
November 16, 2026 08:53
lfrancke
enabled auto-merge
November 16, 2026 10:04
Techassi
approved these changes
Nov 16, 2026
Member
Author
Release notePreviously, the secret-operator followed symlinks when it rewrote secret files in a volume, for example after a kubelet restart, so a Pod that had replaced a file or directory in its secret volume with a symlink could make the operator write secret data outside the volume. With this release, the secret-operator writes secret data only into regular files inside the volume and refuses to publish the volume when it finds a symlink, FIFO or device node in their place. |
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