feat: add deployment foundation and cross-device handoff

This commit is contained in:
2026-09-25 08:49:19 +08:00
parent 8ccb8b7c15
commit e965b0943d
77 changed files with 8018 additions and 0 deletions
+44
View File
@@ -0,0 +1,44 @@
package aptrepo
import (
"os"
"path"
"path/filepath"
"syscall"
"testing"
)
func TestArtifactRejectsSymlinksAndFIFO(t *testing.T) {
for _, kind := range []string{"root-link", "file-link", "fifo"} {
t.Run(kind, func(t *testing.T) {
dir, lock := artifactFixture(t)
filename := filepath.Join(dir, path.Base(lock.Packages[0].Filename))
switch kind {
case "root-link":
link := filepath.Join(t.TempDir(), "link")
if err := os.Symlink(dir, link); err != nil {
t.Fatal(err)
}
dir = link + "/"
case "file-link":
target := filepath.Join(t.TempDir(), "target")
if err := os.Rename(filename, target); err != nil {
t.Fatal(err)
}
if err := os.Symlink(target, filename); err != nil {
t.Fatal(err)
}
case "fifo":
if err := os.Remove(filename); err != nil {
t.Fatal(err)
}
if err := syscall.Mkfifo(filename, 0600); err != nil {
t.Fatal(err)
}
}
if err := verifyArtifacts(dir, lock); err == nil {
t.Fatal("unsafe file accepted")
}
})
}
}