Skip to content
Permalink
Browse files Browse the repository at this point in the history
Update default folder and file permission
Update folder path to 700 and file path to 600.

Signed-off-by: Vijayan Balasubramanian <balasvij@amazon.com>
  • Loading branch information
VijayanB committed Oct 28, 2021
1 parent 8fe1d98 commit 69dc712
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions commands/root.go
Expand Up @@ -40,7 +40,8 @@ const (
defaultConfigFileName = "config"
flagConfig = "config"
flagProfileName = "profile"
folderPermission = 0755 // only owner can write, while everyone can read and execute
FolderPermission = 0700 // only owner can read, write and execute
FilePermission = 0600 // only owner can read and write
ConfigEnvVarName = "OPENSEARCH_CLI_CONFIG"
RootCommandName = "opensearch-cli"
version = "1.0.0"
Expand Down Expand Up @@ -118,7 +119,7 @@ func createDefaultConfigFileIfNotExists() error {
}
folderPath := filepath.Dir(defaultFilePath)
if !isExists(folderPath) {
err := os.Mkdir(folderPath, folderPermission)
err := os.Mkdir(folderPath, FolderPermission)
if err != nil {
return err
}
Expand All @@ -127,6 +128,9 @@ func createDefaultConfigFileIfNotExists() error {
if err != nil {
return err
}
if err = f.Chmod(FilePermission); err != nil {
return err
}
return f.Close()
}

Expand Down

0 comments on commit 69dc712

Please sign in to comment.