Merge pull request from GHSA-c2h3-6mxw-7mvq
v1 & v2 runtimes: reduce permissions for bundle dir
This commit is contained in:
@@ -51,11 +51,15 @@ type snapshotter struct {
|
||||
// root needs to be a mount point of btrfs.
|
||||
func NewSnapshotter(root string) (snapshots.Snapshotter, error) {
|
||||
// If directory does not exist, create it
|
||||
if _, err := os.Stat(root); err != nil {
|
||||
if st, err := os.Stat(root); err != nil {
|
||||
if !os.IsNotExist(err) {
|
||||
return nil, err
|
||||
}
|
||||
if err := os.Mkdir(root, 0755); err != nil {
|
||||
if err := os.Mkdir(root, 0700); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else if st.Mode()&os.ModePerm != 0700 {
|
||||
if err := os.Chmod(root, 0700); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user