Skip to content

Commit 35525e2

Browse files
committed
remove rsync support
rsync was executed as an external command, which means we have no insight into or control over what it actually does. From a security perspective, this is far from ideal. To be clear, there's nothing inherently wrong with rsync itself. However, if we were to support it properly within SFTPGo, we would need to implement the low-level protocol internally rather than relying on launching an external process. This would ensure it works seamlessly with any storage backend, just as SFTP does, for example. We recommend using one of the many alternatives that rely on the SFTP protocol, such as rclone Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
1 parent cc0ee9f commit 35525e2

File tree

13 files changed

+31
-1035
lines changed

13 files changed

+31
-1035
lines changed

internal/common/common_test.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,19 +1412,6 @@ func TestUserPerms(t *testing.T) {
14121412
u.Permissions["/"] = []string{dataprovider.PermDeleteDirs, dataprovider.PermRenameFiles, dataprovider.PermRenameDirs}
14131413
assert.False(t, u.HasPermsDeleteAll("/"))
14141414
assert.True(t, u.HasPermsRenameAll("/"))
1415-
1416-
toCheck := []string{dataprovider.PermDownload, dataprovider.PermUpload, dataprovider.PermCreateDirs, dataprovider.PermListItems,
1417-
dataprovider.PermOverwrite, dataprovider.PermDelete}
1418-
u.Permissions = make(map[string][]string)
1419-
u.Permissions["/"] = []string{dataprovider.PermListItems}
1420-
u.Permissions["/example-dir/bar"] = []string{dataprovider.PermListItems}
1421-
u.Permissions["/example-dir"] = toCheck
1422-
assert.True(t, u.HasPerms(toCheck, "/example-dir"))
1423-
assert.False(t, u.HasRecursivePerms(toCheck, "/example-dir"))
1424-
delete(u.Permissions, "/example-dir/bar")
1425-
assert.True(t, u.HasRecursivePerms(toCheck, "/example-dir"))
1426-
u.Permissions["/example-dirbar"] = []string{dataprovider.PermListItems}
1427-
assert.True(t, u.HasRecursivePerms(toCheck, "/example-dir"))
14281415
}
14291416

14301417
func TestGetTLSVersion(t *testing.T) {

internal/dataprovider/user.go

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -876,27 +876,6 @@ func (u *User) HasAnyPerm(permissions []string, path string) bool {
876876
return false
877877
}
878878

879-
// HasRecursivePerms returns true if the user has all the specified permissions
880-
// in the given folder and in every subfolder that has explicit permissions
881-
// defined.
882-
func (u *User) HasRecursivePerms(permissions []string, virtualPath string) bool {
883-
if !u.HasPerms(permissions, virtualPath) {
884-
return false
885-
}
886-
for dir, perms := range u.Permissions {
887-
if len(dir) > len(virtualPath) {
888-
if strings.HasPrefix(dir, virtualPath+"/") {
889-
for _, permission := range permissions {
890-
if !slices.Contains(perms, permission) {
891-
return false
892-
}
893-
}
894-
}
895-
}
896-
}
897-
return true
898-
}
899-
900879
// HasPerms returns true if the user has all the given permissions
901880
func (u *User) HasPerms(permissions []string, path string) bool {
902881
perms := u.GetPermissionsForPath(path)

internal/sftpd/cmd_unix.go

Lines changed: 0 additions & 37 deletions
This file was deleted.

internal/sftpd/cmd_windows.go

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)