Skip to content

Commit

Permalink
replace magic number with constant for writefile perms
Browse files Browse the repository at this point in the history
  • Loading branch information
ArturRibeiro-CX committed Sep 12, 2024
1 parent 168825a commit 78644c6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/remediation/remediation.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,14 @@ func addition(r *Remediation, lines *[]string) []string {
return remediation
}

const (
FilePermMode = 0600 // File permissions mode with read and write only
)

func (s *Summary) writeRemediation(remediatedLines, lines []string, filePath, similarityID string) []string {
remediated := []byte(strings.Join(remediatedLines, "\n"))

mode := os.FileMode(0600)
mode := os.FileMode(FilePermMode)

if err := os.WriteFile(filePath, remediated, mode); err != nil {
log.Error().Msgf("failed to write file: %s", err)
Expand Down

0 comments on commit 78644c6

Please sign in to comment.