Skip to content

Commit

Permalink
update file permissions to be r/w only for owner
Browse files Browse the repository at this point in the history
  • Loading branch information
maidul98 committed Mar 1, 2023
1 parent ff82af8 commit 1f05d6e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions cli/packages/cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package cmd
import (
"encoding/json"
"fmt"
"os"

"github.com/Infisical/infisical-merge/packages/api"
"github.com/Infisical/infisical-merge/packages/models"
Expand Down Expand Up @@ -96,7 +95,7 @@ func writeWorkspaceFile(selectedWorkspace models.Workspace) error {
return err
}

err = util.WriteToFile(util.INFISICAL_WORKSPACE_CONFIG_FILE_NAME, marshalledWorkspaceFile, os.ModePerm)
err = util.WriteToFile(util.INFISICAL_WORKSPACE_CONFIG_FILE_NAME, marshalledWorkspaceFile, 0600)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions cli/packages/util/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func WriteInitalConfig(userCredentials *models.UserCredentials) error {
}

// Create file in directory
err = WriteToFile(fullConfigFilePath, configFileMarshalled, os.ModePerm)
err = WriteToFile(fullConfigFilePath, configFileMarshalled, 0600)
if err != nil {
return err
}
Expand Down Expand Up @@ -197,7 +197,7 @@ func WriteConfigFile(configFile *models.ConfigFile) error {
}

// Create file in directory
err = os.WriteFile(fullConfigFilePath, configFileMarshalled, os.ModePerm)
err = os.WriteFile(fullConfigFilePath, configFileMarshalled, 0600)
if err != nil {
return fmt.Errorf("writeConfigFile: Unable to write to file [err=%s]", err)
}
Expand Down
2 changes: 1 addition & 1 deletion cli/packages/util/secrets.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ func WriteBackupSecrets(workspace string, environment string, encryptionKey []by
}

listOfSecretsMarshalled, _ := json.Marshal(encryptedSecrets)
err = os.WriteFile(fmt.Sprintf("%s/%s", fullPathToSecretsBackupFolder, fileName), listOfSecretsMarshalled, os.ModePerm)
err = os.WriteFile(fmt.Sprintf("%s/%s", fullPathToSecretsBackupFolder, fileName), listOfSecretsMarshalled, 0600)
if err != nil {
return fmt.Errorf("WriteBackupSecrets: Unable to write backup secrets to file [err=%s]", err)
}
Expand Down

0 comments on commit 1f05d6e

Please sign in to comment.