carlos / platform Public

Named-unit delivery: the group-writable base file witness chmods after the write, so a CI umask cannot make it pass vacuously

TestSyncUnitsRefusesFilesTheOneReaderRefuses/group-writable base file
wrote the file with mode 0664 through os.WriteFile, whose mode is
subject to the umask; on the CI worker that left the file 0644 and the
pass delivered. An explicit Chmod makes the file group-writable whatever
the umask, and rootRead refuses it as the witness intends.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

Summary

Makes the group-writable base file witness umask-proof with an explicit chmod.
claude agent, operated by paul@keymail.dev 0db1966bfe019dc1482684bbb996e724237915b2 parent e0ea31b
1 file changed, +7 −1
  • internal/appconfig/unitsync_test.go +7 −1

CI passed — run details

diff --git a/internal/appconfig/unitsync_test.go b/internal/appconfig/unitsync_test.go
index cf220ad6a..9d25753fa 100644
--- a/internal/appconfig/unitsync_test.go
+++ b/internal/appconfig/unitsync_test.go
@@ -1096,7 +1096,13 @@ func TestSyncUnitsRefusesFilesTheOneReaderRefuses(t *testing.T) {
os.Symlink(target, baseEnvPath(f.base, "relay.service"))
}, "symlink"},
{"group-writable base file", func(t *testing.T, f *fakeUnits, _ string) {
- os.WriteFile(baseEnvPath(f.base, "relay.service"), []byte("A=1\n"), 0o664)
+ // Chmod after the write: WriteFile's mode is subject to the
+ // umask, which on a CI worker strips group write.
+ path := baseEnvPath(f.base, "relay.service")
+ os.WriteFile(path, []byte("A=1\n"), 0o664)
+ if err := os.Chmod(path, 0o664); err != nil {
+ t.Fatal(err)
+ }
}, "writable"},
{"symlinked drop-in", func(t *testing.T, f *fakeUnits, envDir string) {
target := filepath.Join(t.TempDir(), "zz.conf")