Skip to content

Commit

Permalink
add skip-signature flag #206 (#207)
Browse files Browse the repository at this point in the history
Signed-off-by: Denis Vaumoron <dvaumoron@gmail.com>
  • Loading branch information
dvaumoron authored Jul 15, 2024
1 parent c32708d commit f793334
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions cmd/tenv/subcmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ func addInstallationFlags(flags *pflag.FlagSet, conf *config.Config, params subC
flags.StringVarP(&conf.Arch, "arch", "a", conf.Arch, "specify arch for binaries downloading")
if params.pPublicKeyPath != nil {
flags.StringVarP(params.pPublicKeyPath, "key-file", "k", "", "local path to PGP public key file (replace check against remote one)")
flags.BoolVarP(&conf.SkipSignature, "skip-signature", "s", false, "skip signature checking")
}
}

Expand Down
1 change: 1 addition & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ type Config struct {
remoteConfLoaded bool
RemoteConfPath string
RootPath string
SkipSignature bool
Tf RemoteConfig
TfKeyPath string
Tg RemoteConfig
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require (
github.com/hashicorp/hcl/v2 v2.21.0
github.com/spf13/cobra v1.8.1
github.com/spf13/pflag v1.0.5
github.com/zclconf/go-cty v1.14.4
github.com/zclconf/go-cty v1.15.0
gopkg.in/yaml.v3 v3.0.1
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXl
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no=
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
github.com/zclconf/go-cty v1.14.4 h1:uXXczd9QDGsgu0i/QFR/hzI5NYCHLf6NQw/atrbnhq8=
github.com/zclconf/go-cty v1.14.4/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE=
github.com/zclconf/go-cty v1.15.0 h1:tTCRWxsexYUmtt/wVxgDClUe+uQusuI443uL6e+5sXQ=
github.com/zclconf/go-cty v1.15.0/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE=
github.com/zclconf/go-cty-debug v0.0.0-20240509010212-0d6042c53940 h1:4r45xpDWB6ZMSMNJFMOjqrGHynW3DIBuR2H9j0ug+Mo=
github.com/zclconf/go-cty-debug v0.0.0-20240509010212-0d6042c53940/go.mod h1:CmBdvvj3nqzfzJ6nTCIwDTPZ56aVGvDrmztiO5g3qrM=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
Expand Down
4 changes: 4 additions & 0 deletions versionmanager/retriever/terraform/terraformretriever.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@ func (r TerraformRetriever) checkSumAndSig(fileName string, data []byte, downloa
return err
}

if r.conf.SkipSignature {
return nil
}

dataSumsSig, err := download.Bytes(downloadSumsSigURL, r.conf.Displayer.Display)
if err != nil {
return err
Expand Down
4 changes: 4 additions & 0 deletions versionmanager/retriever/tofu/tofuretriever.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ func (r TofuRetriever) checkSumAndSig(version *version.Version, stable bool, dat
return err
}

if r.conf.SkipSignature {
return nil
}

dataSumsSig, err := download.Bytes(assetURLs[3], r.conf.Displayer.Display)
if err != nil {
return err
Expand Down

0 comments on commit f793334

Please sign in to comment.