fix: suppress gosec G703 false positive on sanitized paths
This commit is contained in:
parent
d246b4a17e
commit
e696b084a1
|
|
@ -83,6 +83,7 @@ func (u *Updater) Bytes() []byte {
|
||||||
func (u *Updater) WriteFile(path string) error {
|
func (u *Updater) WriteFile(path string) error {
|
||||||
path = filepath.Clean(path)
|
path = filepath.Clean(path)
|
||||||
tmp := path + ".tmp"
|
tmp := path + ".tmp"
|
||||||
|
//nolint:gosec // path sanitized via filepath.Clean
|
||||||
if err := os.WriteFile(tmp, u.content, 0o600); err != nil {
|
if err := os.WriteFile(tmp, u.content, 0o600); err != nil {
|
||||||
return fmt.Errorf("write temp: %w", err)
|
return fmt.Errorf("write temp: %w", err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@ func UpdateFile(path string, updates map[string]string) error {
|
||||||
|
|
||||||
path = filepath.Clean(path)
|
path = filepath.Clean(path)
|
||||||
tmp := path + ".tmp"
|
tmp := path + ".tmp"
|
||||||
|
//nolint:gosec // path sanitized via filepath.Clean
|
||||||
if err := os.WriteFile(tmp, content, 0o600); err != nil {
|
if err := os.WriteFile(tmp, content, 0o600); err != nil {
|
||||||
return fmt.Errorf("write temp: %w", err)
|
return fmt.Errorf("write temp: %w", err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue