"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
serve restic: fix --private-repos isolation bypass CVE-2026-59733
Nick Craig-Wooddade21c16160
diff --git a/cmd/serve/restic/restic.go b/cmd/serve/restic/restic.goindex 24af0db69..8c173a436 100644--- a/cmd/serve/restic/restic.go+++ b/cmd/serve/restic/restic.go@@ -244,6 +244,12 @@ func WithRemote(next http.Handler) http.Handler {urlpath = r.URL.Path}urlpath = strings.Trim(urlpath, "/")+ // Reject any non-canonical path, in particular one containing ".."+ // traversal elements.+ if urlpath != "" && path.Clean(urlpath) != urlpath {+ http.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest)+ return+ }parts := matchData.FindStringSubmatch(urlpath)// if no data directory, layout is flatif parts != nil {diff --git a/cmd/serve/restic/restic_privaterepos_test.go b/cmd/serve/restic/restic_privaterepos_test.goindex 21e1d68ce..e59d9baf6 100644--- a/cmd/serve/restic/restic_privaterepos_test.go+++ b/cmd/serve/restic/restic_privaterepos_test.go@@ -75,4 +75,16 @@ func TestResticPrivateRepositories(t *testing.T) {checkRequest(t, router.ServeHTTP, req, []wantFunc{wantCode(http.StatusForbidden)})}+ // Reaching another user's repo via a ".." traversal in the path must be+ // rejected even though the {userID} segment matches the authenticated user+ // (GHSA-fqj9-69pf-6pjg).+ reqs = []*http.Request{+ newAuthenticatedRequest(t, "GET", "/test/../other_user/config", nil, opt.Auth.BasicUser, opt.Auth.BasicPass),+ newAuthenticatedRequest(t, "POST", "/test/../other_user/config", strings.NewReader("evil"), opt.Auth.BasicUser, opt.Auth.BasicPass),+ newAuthenticatedRequest(t, "DELETE", "/test/../other_user/config", nil, opt.Auth.BasicUser, opt.Auth.BasicPass),+ }+ for _, req := range reqs {+ checkRequest(t, router.ServeHTTP, req, []wantFunc{wantCode(http.StatusBadRequest)})+ }+}