Skip to content

security(fs): reject symlinked store entries escaping the store root - #3654

Merged
dominikschulz merged 1 commit into
gopasspw:masterfrom
dominikschulz:fix/symesc
Oct 10, 2026
Merged

dominikschulz merged 1 commit into
gopasspw:masterfrom
dominikschulz:fix/symesc

Conversation

@dominikschulz

Copy link
Copy Markdown
Member

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.

@dominikschulz
dominikschulz requested a balanced review from Copilot October 9, 2026 18:19

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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
dominikschulz merged commit 7e4fa09 into gopasspw:master Oct 10, 2026
10 checks passed
@dominikschulz
dominikschulz deleted the fix/symesc branch October 10, 2026 05:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

⌂ 换网址