use filepath.Clean to fix gosec G304
All checks were successful
CI / Tests (pull_request) Successful in 14s
CI / Style (pull_request) Successful in 9s

This commit is contained in:
Dan Anglin 2024-10-15 17:20:23 +01:00
parent 62914aca00
commit 87e7c90f1e
Signed by: dananglin
GPG key ID: 0C1D44CFBEE68638

View file

@ -4,6 +4,7 @@ import (
"encoding/json"
"fmt"
"os"
"path/filepath"
)
type Config struct {
@ -13,6 +14,8 @@ type Config struct {
}
func NewConfig(path string) (Config, error) {
path = filepath.Clean(path)
data, err := os.ReadFile(path)
if err != nil {
return Config{}, fmt.Errorf(