send_file: resolve home's symlinks before the "under home" check
Check resolved symlinks in the file path but compared it to s.Home as given, so a home reached through a symlink rejected its own files. Seen when tools_test ran on NativeLink, whose work dir is under the /var/lib/nativelink -> private/nativelink symlink. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0119iKoN3fSvRGUAYHupPW4U
This commit is contained in:
1 parent
af249326e8
commit
8c83a3316a
2 files changed
+21
-1
No files matched your search
@@ -247,7 +247,11 @@ func (s *Server) Check(path string) error {
|
||||
if err != nil {
|
||||
return fmt.Errorf("can't find %s", path)
|
||||
}
|
||||
if !strings.HasPrefix(real, filepath.Clean(s.Home)+"/") {
|
||||
home := filepath.Clean(s.Home)
|
||||
if h, err := filepath.EvalSymlinks(home); err == nil {
|
||||
home = h
|
||||
}
|
||||
if !strings.HasPrefix(real, home+"/") {
|
||||
return fmt.Errorf("%s isn't under %s; copy it there first", path, s.Home)
|
||||
}
|
||||
st, err := os.Stat(real)
|
||||
|
||||
Reference in new issue
Block a user