Skip to content

fix(fs): handle symlinks in overlay rename and copy#1014

Merged
chaliy merged 3 commits intomainfrom
claude/fix-symlink-overlay-security-w8H9Q
Apr 2, 2026
Merged

fix(fs): handle symlinks in overlay rename and copy#1014
chaliy merged 3 commits intomainfrom
claude/fix-symlink-overlay-security-w8H9Q

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented Apr 2, 2026

Summary

  • OverlayFs::rename and copy used read_file() which intentionally doesn't follow symlinks (TM-ESC-002), causing silent failures when operating on symlinks. Now detects symlinks via stat() and preserves them using read_link() + symlink().
  • Same fix applied to MountableFs cross-mount rename/copy paths.
  • Added TM-ESC-016 to threat model spec and public docs.

Test plan

  • overlay_rename_preserves_symlink — rename symlink in upper layer
  • overlay_rename_symlink_from_lower_layer — rename symlink from lower to upper (CoW)
  • overlay_copy_preserves_symlink — copy preserves symlink type
  • symlink_rename_cannot_escape_mount_via_read — read_file on renamed symlink still blocked
  • bash_mv_symlink_in_overlay — end-to-end mv + readlink in bash session
  • Full test suite passes, clippy clean

chaliy added 3 commits April 2, 2026 12:16
OverlayFs::rename and copy used read_file which intentionally doesn't
follow symlinks (TM-ESC-002), causing silent failures when renaming or
copying symlinks. Now detects symlinks via stat and preserves them as
symlinks using read_link + symlink. Same fix applied to MountableFs
cross-mount rename/copy.
Document the symlink rename/copy vulnerability in overlay and mountable
filesystems. OverlayFs::rename used read_file which doesn't follow
symlinks, silently failing. Now fixed and tracked as TM-ESC-016.
Cover MountableFs cross-mount paths for symlink rename and copy
to ensure symlinks are preserved across filesystem boundaries.
@chaliy chaliy merged commit b68a7b2 into main Apr 2, 2026
27 checks passed
@chaliy chaliy deleted the claude/fix-symlink-overlay-security-w8H9Q branch April 2, 2026 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant