Skip to content

Commit 24c2f51

Browse files
author
Giuseppe Lumia
committed
Improve config security
Since the configuration file of the CLI contains secrets, it should be readable only to its owner.
1 parent 6f78949 commit 24c2f51

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

command/config/init.go

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ package config
2020
import (
2121
"errors"
2222
"fmt"
23+
"os"
2324
"strings"
2425

2526
"github.com/arduino/arduino-cloud-cli/internal/config"
@@ -65,6 +66,7 @@ func Init(params *InitParams) error {
6566
}
6667

6768
newSettings := viper.New()
69+
newSettings.SetConfigPermissions(os.FileMode(0600))
6870
config.SetDefaults(newSettings)
6971
if err := newSettings.WriteConfigAs(configFile.String()); err != nil {
7072
return fmt.Errorf("cannot create config file: %v", err)

0 commit comments

Comments
 (0)