Skip to content

Commit

Permalink
Security (logger): Resolve gosec G301 (CWE-276)
Browse files Browse the repository at this point in the history
  • Loading branch information
yunginnanet committed Jun 26, 2024
1 parent 833b424 commit 317fd91
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (c *Configuration) findFallbackDir() error {
errs = append(errs, err)
}

if err = os.MkdirAll(filepath.Join(loc, "HellPot"), 0755); err == nil {
if err = os.MkdirAll(filepath.Join(loc, "HellPot"), 0750); err == nil {
c.Directory = filepath.Join(loc, "HellPot")
c.File = "HellPot.log"
return nil
Expand Down Expand Up @@ -99,7 +99,7 @@ func (c *Configuration) setupDirAndFile() error {
return fmt.Errorf("failed to access specified log directory: %w", err)
}
if errors.Is(err, os.ErrNotExist) {
if err = os.MkdirAll(c.Directory, 0755); err != nil {
if err = os.MkdirAll(c.Directory, 0750); err != nil {
return fmt.Errorf("failed to create specified log directory: %w", err)
}
}
Expand All @@ -116,7 +116,7 @@ func (c *Configuration) setupDirAndFile() error {
return fmt.Errorf("failed to access specified log directory: %w", err)
}
if errors.Is(err, os.ErrNotExist) {
if err = os.MkdirAll(filepath.Dir(c.File), 0755); err != nil {
if err = os.MkdirAll(filepath.Dir(c.File), 0750); err != nil {
return fmt.Errorf("failed to create specified log directory: %w", err)
}
}
Expand Down

0 comments on commit 317fd91

Please sign in to comment.