Skip to content

Commit

Permalink
address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
gartnera committed Oct 31, 2024
1 parent 7919732 commit 9e6ec45
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions e2e/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,12 +208,14 @@ func WriteConfig(file string, config Config) error {
return errors.New("file name cannot be empty")
}

// #nosec G304 -- the variable is expected to be controlled by the user
fHandle, err := os.OpenFile(file, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600)
if err != nil {
return fmt.Errorf("open file: %w", err)
}
defer fHandle.Close()

// use a custom encoder so we can set the indentation level
encoder := yaml.NewEncoder(fHandle)
defer encoder.Close()
encoder.SetIndent(2)
Expand Down

0 comments on commit 9e6ec45

Please sign in to comment.