fix: gosec issues (#779)
* remove gosec warnigs with medium severity * Improvement(Ethermint): Fix gosec vulnerabilities * Improvement(Evmos): address pr comments * Improvement(Ethermint): Fix flags test by using PersistentFlags() instead of Flags() * Improvement(Ethermint): Fix return of defer function * Improvement(Ethermint): Replace PersistentFlags with Flags * Apply suggestions from code review * Improvement(Ethermint): Use persisentFlags again and remove required attribute for chain id Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
This commit is contained in:
co-authored by
Federico Kunze Küllmer
parent
32eaec8d99
commit
2d8be4e85b
+8
-10
@@ -49,7 +49,7 @@ const (
|
||||
)
|
||||
|
||||
// AddTxFlags adds common flags for commands to post tx
|
||||
func AddTxFlags(cmd *cobra.Command) *cobra.Command {
|
||||
func AddTxFlags(cmd *cobra.Command) (*cobra.Command, error) {
|
||||
cmd.PersistentFlags().String(flags.FlagChainID, "testnet", "Specify Chain ID for sending Tx")
|
||||
cmd.PersistentFlags().String(flags.FlagFrom, "", "Name or address of private key with which to sign")
|
||||
cmd.PersistentFlags().String(flags.FlagFees, "", "Fees to pay along with transaction; eg: 10aphoton")
|
||||
@@ -66,13 +66,11 @@ func AddTxFlags(cmd *cobra.Command) *cobra.Command {
|
||||
// ))
|
||||
|
||||
// viper.BindPFlag(flags.FlagTrustNode, cmd.Flags().Lookup(flags.FlagTrustNode))
|
||||
|
||||
// TODO: we need to handle the errors for these, decide if we should return error upward and handle
|
||||
// nolint: errcheck
|
||||
viper.BindPFlag(flags.FlagNode, cmd.Flags().Lookup(flags.FlagNode))
|
||||
// nolint: errcheck
|
||||
viper.BindPFlag(flags.FlagKeyringBackend, cmd.Flags().Lookup(flags.FlagKeyringBackend))
|
||||
// nolint: errcheck
|
||||
cmd.MarkFlagRequired(flags.FlagChainID)
|
||||
return cmd
|
||||
if err := viper.BindPFlag(flags.FlagNode, cmd.PersistentFlags().Lookup(flags.FlagNode)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := viper.BindPFlag(flags.FlagKeyringBackend, cmd.PersistentFlags().Lookup(flags.FlagKeyringBackend)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return cmd, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user