Merge pull request #2199 from jnaulty/jnaulty/improve-config-file-perms

Restrict file permissions for config file/dir
pull/2206/head
Nolan Brubaker 2020-01-15 15:13:22 -05:00 committed by GitHub
commit ee0cbcf11e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -69,11 +69,11 @@ func SaveConfig(config VeleroConfig) error {
// Try to make the directory in case it doesn't exist
dir := filepath.Dir(fileName)
if err := os.MkdirAll(dir, 0755); err != nil {
if err := os.MkdirAll(dir, 0700); err != nil {
return errors.WithStack(err)
}
configFile, err := os.OpenFile(fileName, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0755)
configFile, err := os.OpenFile(fileName, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0600)
if err != nil {
return errors.WithStack(err)
}