INNER CODE UNIT · Go
err
pilinux/gorest · config/config.go:699
if _, err = os.Stat(path); err == nil { // #nosec G703 -- path is constrained to the workspace root by sanitizeConfigDir
return nil
}
if !os.IsNotExist(err) {
return err
}
if err = os.MkdirAll(path, 0750); err != nil { // #nosec G703 -- path is constrained to the workspace root by sanitizeConfigDir
return err
}
return nil
}
// sanitizeConfigDir ensures that the provided directory is a valid relative path and does not lead outside the workspace.
func sanitizeConfigDir(dir string) (string, error) {
cleanDir := filepath.Clean(strings.TrimSpace(dir))