Skip to content

Commit

Permalink
Prevent harmful usage of defaults.Set() (#233)
Browse files Browse the repository at this point in the history
  • Loading branch information
Taimoor Ahmad authored Jan 5, 2024
1 parent f66d7cc commit 165b10b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .changes/unreleased/Bugfix-20240105-154208.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
kind: Bugfix
body: Fix bug in Infra where unexpected data would be included in requests
time: 2024-01-05T15:42:08.827698-05:00
4 changes: 0 additions & 4 deletions src/cmd/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (

"github.com/opslevel/opslevel-go/v2023"

"github.com/creasty/defaults"
"github.com/opslevel/cli/common"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -466,8 +465,5 @@ func readCheckInput() (*CheckInputType, error) {
// Unmarshall
evt := &CheckInputType{}
viper.Unmarshal(&evt)
if err := defaults.Set(evt); err != nil {
return nil, err
}
return evt, nil
}
4 changes: 0 additions & 4 deletions src/cmd/infra.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"os"
"strings"

"github.com/creasty/defaults"
"github.com/opslevel/cli/common"
"github.com/opslevel/opslevel-go/v2023"
"github.com/rs/zerolog/log"
Expand Down Expand Up @@ -249,8 +248,5 @@ func readInfraInput() (*opslevel.InfraInput, error) {
cobra.CheckErr(err)
evt := &opslevel.InfraInput{}
cobra.CheckErr(yaml.Unmarshal(file, &evt))
if err := defaults.Set(evt); err != nil {
return nil, err
}
return evt, nil
}

0 comments on commit 165b10b

Please sign in to comment.