Repository navigation
security(fs): reject symlinked store entries escaping the store root - #3654
Merged
Merged
Conversation
safePath only performed a lexical prefix check, so a symlink inside the store whose target lives outside the root passed validation. Get, Set, Delete, Prune, Move, Link, LinkTarget, Exists and IsDir then acted on the real target outside the store. List already resolved symlinks and skipped escapes; that protection was missing from the read, write and delete paths. Resolve the longest existing prefix of the requested path and verify the real location stays within the store root. Walking up to the longest existing prefix catches symlinked entries and intermediate directory symlinks while still allowing paths whose trailing components do not exist yet, e.g. when creating a new secret. Fixes GHSA-v4c2-4fvx-chr3. Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
dominikschulz
force-pushed
the
fix/symesc
branch
from
October 9, 2026 18:44
1e51e4b to
556b11c
Compare
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.
safePath only performed a lexical prefix check, so a symlink inside the store whose target lives outside the root passed validation. Get, Set, Delete, Prune, Move, Link, LinkTarget, Exists and IsDir then acted on the real target outside the store. List already resolved symlinks and skipped escapes; that protection was missing from the read, write and delete paths.
Resolve the longest existing prefix of the requested path and verify the real location stays within the store root. Walking up to the longest existing prefix catches symlinked entries and intermediate directory symlinks while still allowing paths whose trailing components do not exist yet, e.g. when creating a new secret.
Fixes GHSA-v4c2-4fvx-chr3.