Skip to content

Commit 088d5cf

Browse files
committed
shim: Create pid-file and address with 0644 permissions
Fixes ae70213 In ae70213 the WritePidFile and WriteAddress functions were changed to use AtomicFile instead of os.CreateFile. However, AtomicFile creates a temporary file and then changes its permissions with os.Chmod which alters the previously observed behavior of os.CreateFile which takes the system's umask into account. This means that on Linux-based systems these files suddenly became world writable (#9363). This commit explicitly requests 0644 permissions as even on systems without default umask of 0022 there is no reason to have these two files world writable. Signed-off-by: Jaroslav Jindrak <[email protected]>
1 parent ad9e654 commit 088d5cf

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

runtime/v2/shim/util.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ func WritePidFile(path string, pid int) error {
126126
if err != nil {
127127
return err
128128
}
129-
f, err := atomicfile.New(path, 0o666)
129+
f, err := atomicfile.New(path, 0o644)
130130
if err != nil {
131131
return err
132132
}
@@ -144,7 +144,7 @@ func WriteAddress(path, address string) error {
144144
if err != nil {
145145
return err
146146
}
147-
f, err := atomicfile.New(path, 0o666)
147+
f, err := atomicfile.New(path, 0o644)
148148
if err != nil {
149149
return err
150150
}

0 commit comments

Comments
 (0)