Skip to content

Commit

Permalink
golangci-lint: Fix file permission for gosec
Browse files Browse the repository at this point in the history
If fixes following error
```
pkg/os/windows/powershell/powershell_windows.go:77:12: G306: Expect WriteFile permissions to be 0600 or less (gosec)
	if err := os.WriteFile(filename, append([]byte{0xef, 0xbb, 0xbf}, []byte(scriptContent)...), 0666); err != nil {
	          ^
```
  • Loading branch information
praveenkumar authored and anjannath committed Jun 6, 2024
1 parent b880342 commit cd2dfcc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/os/windows/powershell/powershell_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func ExecuteAsAdmin(reason, cmd string) (string, string, error) {
filename := filepath.Join(tempDir, "runAsAdmin.ps1")

// #nosec G306
if err := os.WriteFile(filename, append([]byte{0xef, 0xbb, 0xbf}, []byte(scriptContent)...), 0666); err != nil {
if err := os.WriteFile(filename, append([]byte{0xef, 0xbb, 0xbf}, []byte(scriptContent)...), 0600); err != nil {
return "", "", err
}

Expand Down

0 comments on commit cd2dfcc

Please sign in to comment.