PasteFerry (隔空贴): clipboard and file sync across macOS, Windows and Linux. Direct-first, end-to-end encrypted. Optional official access: no server to host. Independent self-hosting remains available.
Dart airdrop-alternativeclipboardclipboard-sharingclipboard-synccopy-pastecross-platformend-to-end-encryptionfile-syncfile-transferfluttergolanglinuxmacosnat-traversalp2pself-hostedtailscaleuniversal-clipboardwebrtcwindows
Windows 上跳过 Unix 权限位的测试;以斜杠开头的归档路径一律拒绝
baiyuze2b04f63d424d
diff --git a/client-core/internal/config/config_test.go b/client-core/internal/config/config_test.goindex 3b80fb4..0de93aa 100644--- a/client-core/internal/config/config_test.go+++ b/client-core/internal/config/config_test.go@@ -4,6 +4,7 @@ import ("encoding/json""os""path/filepath"+ "runtime""strings""testing""time"@@ -172,13 +173,18 @@ func TestPathsLayout(t *testing.T) {if err != nil {t.Fatal(err)}- // 缓存里是用户复制过的文件,不该让同机其他用户读到- if perm := info.Mode().Perm(); perm != 0o700 {+ // 缓存里是用户复制过的文件,不该让同机其他用户读到。+ // Windows 没有 Unix 权限位,数据目录在 %LOCALAPPDATA% 下,系统默认只给当前用户访问+ if perm := info.Mode().Perm(); runtime.GOOS != "windows" && perm != 0o700 {t.Errorf("缓存目录权限 = %o,期望 0700", perm)}}func TestSaveWritesPrivatePermissions(t *testing.T) {+ if runtime.GOOS == "windows" {+ // Windows 没有 Unix 权限位;数据目录在 %LOCALAPPDATA% 下,系统默认只给当前用户访问+ t.Skip("Windows 不用权限位")+ }p := PathsUnder(t.TempDir())if err := Save(p, Default()); err != nil {t.Fatal(err)diff --git a/client-core/internal/identity/identity_test.go b/client-core/internal/identity/identity_test.goindex b1fef88..48cdb6f 100644--- a/client-core/internal/identity/identity_test.go+++ b/client-core/internal/identity/identity_test.go@@ -5,6 +5,7 @@ import ("encoding/json""os""path/filepath"+ "runtime""strings""testing"@@ -38,6 +39,9 @@ func TestCreateThenLoadIsStable(t *testing.T) {}func TestPrivateKeyFilePermissions(t *testing.T) {+ if runtime.GOOS == "windows" {+ t.Skip("Windows 不用权限位,私钥另用 DPAPI 加密,见 protect_windows_test.go")+ }path := filepath.Join(t.TempDir(), "identity.json")if _, err := LoadOrCreate(path); err != nil {t.Fatal(err)diff --git a/client-core/internal/pack/pack.go b/client-core/internal/pack/pack.goindex 078ba44..5ba9e85 100644--- a/client-core/internal/pack/pack.go+++ b/client-core/internal/pack/pack.go@@ -252,7 +252,8 @@ func Unpack(r io.Reader, destDir string) ([]string, error) {func safeJoin(base, name string) (string, error) {clean := filepath.Clean(filepath.FromSlash(name))// VolumeName 拦住 Windows 上的「C:foo」「\\server\share」:它们不算绝对路径,Join 之后却能跑出去- if filepath.IsAbs(clean) || strings.HasPrefix(clean, "..") || filepath.VolumeName(clean) != "" {+ if filepath.IsAbs(clean) || strings.HasPrefix(clean, "..") || filepath.VolumeName(clean) != "" ||+ strings.HasPrefix(clean, string(filepath.Separator)) { // Windows 上「\etc」不算绝对路径return "", fmt.Errorf("归档中含非法路径: %q", name)}target := filepath.Join(base, clean)