Skip to content

Commit

Permalink
[ioctl] Modify file permission as 0600 (#3563)
Browse files Browse the repository at this point in the history
  • Loading branch information
huof6829 authored Jul 19, 2022
1 parent 4014325 commit 4a7b0b0
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions ioctl/cmd/contract/contractshare.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func isDir(path string) bool {

func isReadOnly(path string) bool {
var readOnly = false
file, err := os.OpenFile(filepath.Clean(path), os.O_WRONLY, 0666)
file, err := os.OpenFile(filepath.Clean(path), os.O_WRONLY, 0600)
if err != nil {
if os.IsPermission(err) {
log.Println("Error: Write permission denied.")
Expand Down Expand Up @@ -255,7 +255,7 @@ func share(args []string) error {
log.Println("mkdir failed: ", err)
break
}
if err := os.WriteFile(setPath, []byte(content), 0644); err != nil {
if err := os.WriteFile(setPath, []byte(content), 0600); err != nil {
log.Println("set file failed: ", err)
break
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/log/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func InitLoggers(globalCfg GlobalConfig, subCfgs map[string]GlobalConfig, opts .
return err
}
if cfg.StderrRedirectFile != nil {
stderrF, err := os.OpenFile(*cfg.StderrRedirectFile, os.O_WRONLY|os.O_CREATE|os.O_SYNC|os.O_APPEND, 0644)
stderrF, err := os.OpenFile(*cfg.StderrRedirectFile, os.O_WRONLY|os.O_CREATE|os.O_SYNC|os.O_APPEND, 0600)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/recovery/recovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func LogCrash(r interface{}) {
}

func writeHeapProfile(path string) {
f, err := os.OpenFile(filepath.Clean(path), os.O_CREATE|os.O_RDWR, 0644)
f, err := os.OpenFile(filepath.Clean(path), os.O_CREATE|os.O_RDWR, 0600)
if err != nil {
log.S().Errorf("crashlog: open heap profile error: %v", err)
return
Expand Down
2 changes: 1 addition & 1 deletion tools/addrgen/internal/cmd/createconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var createConfigCmd = &cobra.Command{
priKeyBytes,
pubKeyBytes,
)
if err := os.WriteFile(_outputFile, []byte(cfgStr), 0666); err != nil {
if err := os.WriteFile(_outputFile, []byte(cfgStr), 0600); err != nil {
log.L().Fatal("failed to write file", zap.Error(err))
}
},
Expand Down

0 comments on commit 4a7b0b0

Please sign in to comment.