Skip to content

Commit aedb077

Browse files
fix: /etc/ld.so.cache file permissions (#1758)
`/etc/ld.so.cache` is created with `os.Create` internally which creates a file with `0666` permissions ([dag](https://oci.dag.dev/fs/cgr.dev/chainguard/bash@sha256:b53e7f70cc3ac51b9c2a52fc4bfeb264ca6a560919a3e8228639e6890247196d/etc/)) ```bash -rw-rw-rw- 0/0 6528 1970-01-01 00:00 ld.so.cache ``` This PR lowers the permission of file to `0644` Signed-off-by: Vishal Choudhary <[email protected]>
1 parent 4369867 commit aedb077

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pkg/build/build_implementation.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,9 @@ func updateCache(ctx context.Context, fsys apkfs.FullFS) error {
257257
if err := cacheFile.Write(lsc); err != nil {
258258
return fmt.Errorf("writing /etc/ld.so.cache: %w", err)
259259
}
260+
if err := fsys.Chmod("etc/ld.so.cache", 0644); err != nil {
261+
return fmt.Errorf("chmod /etc/ld.so.cache: %w", err)
262+
}
260263

261264
return nil
262265
}

0 commit comments

Comments
 (0)