diff --git a/internal/security/flock.go b/internal/security/flock.go index 78552a9..2d18ad9 100644 --- a/internal/security/flock.go +++ b/internal/security/flock.go @@ -16,6 +16,11 @@ func Flock(path string) (release func(), err error) { if err != nil { return nil, err } + // REQ-139 / F15: tighten pre-existing looser perms to 0600. + // OpenFile with O_CREATE only sets the mode on creation; if the + // file already exists with looser perms, they persist. Chmod + // ensures 0600 regardless. + _ = os.Chmod(path, 0o600) if err := syscall.Flock(int(f.Fd()), syscall.LOCK_EX); err != nil { f.Close() return nil, err