Skip to content

fix(localfile): reject symlinks in SetFileAttributes - #627

Merged
sfc-gh-ikryvanos merged 4 commits into
mainfrom
ikryvanos/localfile-symlink-setattr
Aug 27, 2026
Merged

fix(localfile): reject symlinks in SetFileAttributes#627
sfc-gh-ikryvanos merged 4 commits into
mainfrom
ikryvanos/localfile-symlink-setattr

Conversation

@sfc-gh-ikryvanos

@sfc-gh-ikryvanos sfc-gh-ikryvanos commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

%23%23 Summary

  • Reject SetFileAttributes on symlink paths (FailedPrecondition) so attribute changes cannot follow a link to an out-of-policy target
  • Use Lchown instead of Chown, and open immutable flag updates with O_NOFOLLOW on Linux as defense in depth
  • Add a regression test that a symlink target's mode is unchanged when attributes are requested via the link

%23%23 Test plan

  • go test ./services/localfile/server/...
  • GOOS=linux GOARCH=amd64 go build ./services/localfile/...
  • Confirm CI passes on the PR

Attribute changes followed symlinks, so chown/chmod/immutable
could escape path-based policy confinement. Lstat-reject
symlinks, use Lchown, and open immutable updates with O_NOFOLLOW.

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread services/localfile/server/localfile.go
@sfc-gh-ikryvanos
sfc-gh-ikryvanos merged commit 573262e into main Aug 27, 2026
7 checks passed
@sfc-gh-ikryvanos
sfc-gh-ikryvanos deleted the ikryvanos/localfile-symlink-setattr branch August 27, 2026 15:32
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.

2 participants