fix: harden operations and configuration recovery

This commit is contained in:
proxyctl coordinator
2026-08-30 11:13:45 +08:00
parent e34bf7d989
commit 8928986830
27 changed files with 542 additions and 125 deletions
+14
View File
@@ -10,6 +10,20 @@ import (
"proxyctl/internal/target"
)
func TestReadOnlyWriteAuthorityRejectsUnreadableExistingFile(t *testing.T) {
if os.Geteuid() == 0 {
t.Skip("root can read files regardless of mode bits")
}
path := filepath.Join(t.TempDir(), "managed.json")
if err := os.WriteFile(path, []byte("{}\n"), 0o200); err != nil {
t.Fatal(err)
}
check := target.ReadOnlyWriteAuthority(path)
if check.OK || !strings.Contains(check.Evidence, "cannot be read") {
t.Fatalf("unreadable destination reported writable: %#v", check)
}
}
func TestReadOnlyWriteAuthorityRejectsSymlinkedFinalAndAncestorWithoutTouchingVictim(t *testing.T) {
for _, test := range []struct {
name string