R-1214: the capped copy refuses any path with a symlink in it (security review: a link under /mnt pointing outside resolves elsewhere for the daemon); red-proved; unreleased
gates / gates (push) Successful in 1m53s
gates / gates (push) Successful in 1m53s
This commit is contained in:
@@ -91,3 +91,24 @@ func TestR1214_ANotStartedContainerFallsBackAnRsyncErrorDoesNot(t *testing.T) {
|
||||
t.Fatalf("no readable image → the plain copy: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// A symlink under the capped root that points elsewhere must never reach the container (the daemon would resolve it
|
||||
// somewhere else, and `--delete` would mirror that over the copy) — the security review's case.
|
||||
// RED-PROOF: with the EvalSymlinks check removed, this fails — seen failing 2026-10-22.
|
||||
func TestR1214_ASymlinkedPathNeverGoesToDocker(t *testing.T) {
|
||||
root := t.TempDir() + "/"
|
||||
elsewhere := t.TempDir()
|
||||
os.WriteFile(filepath.Join(elsewhere, "f"), []byte("x"), 0644)
|
||||
link := filepath.Join(root, "drive1", "unit")
|
||||
os.MkdirAll(filepath.Dir(link), 0755)
|
||||
if err := os.Symlink(elsewhere, link); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
rec := withSeams(t, root, "img", func([]string) ([]byte, int, error) { return nil, 0, nil })
|
||||
if err := rsyncMirror(link, filepath.Join(root, "drive2", "unit")); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(rec.calls) != 0 {
|
||||
t.Fatalf("a symlinked path went to the container: %v", rec.calls)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user