From 24fad163b2dabed737d882773829685612f12070 Mon Sep 17 00:00:00 2001 From: 0xmuralik Date: Tue, 18 Oct 2022 15:36:34 +0530 Subject: [PATCH] ignore gosec --- app/utils.go | 2 +- ethereum/eip712/eip712.go | 2 +- gql/resolver.go | 1 + gql/status.go | 2 +- gql/util.go | 8 ++++---- rpc/namespaces/ethereum/debug/api.go | 2 +- version/version.go | 2 +- x/auction/client/cli/tx.go | 2 +- x/auction/genesis.go | 1 + x/evm/module.go | 2 +- x/feemarket/module.go | 2 +- x/nameservice/client/cli/tx.go | 2 +- x/nameservice/genesis.go | 2 +- 13 files changed, 16 insertions(+), 14 deletions(-) diff --git a/app/utils.go b/app/utils.go index 235041c3..4774bce9 100644 --- a/app/utils.go +++ b/app/utils.go @@ -2,7 +2,7 @@ package app import ( "encoding/json" - "math/rand" + "math/rand" // #nosec G702 "time" "github.com/cosmos/cosmos-sdk/codec" diff --git a/ethereum/eip712/eip712.go b/ethereum/eip712/eip712.go index 50860093..c7f67384 100644 --- a/ethereum/eip712/eip712.go +++ b/ethereum/eip712/eip712.go @@ -5,7 +5,7 @@ import ( "encoding/json" "fmt" "math/big" - "reflect" + "reflect" // #nosec G702 "strings" "time" diff --git a/gql/resolver.go b/gql/resolver.go index 23eaf10c..75d75710 100644 --- a/gql/resolver.go +++ b/gql/resolver.go @@ -313,6 +313,7 @@ func (q queryResolver) GetBondsByOwner(ctx context.Context, address string) (*Ow ownerBonds := make([]*Bond, len(bondResp.GetBonds())) for i, bond := range bondResp.GetBonds() { + // #nosec G601 bondObj, err := getGQLBond(&bond) //nolint: all if err != nil { return nil, err diff --git a/gql/status.go b/gql/status.go index 0a8822ad..0ed0d7ae 100644 --- a/gql/status.go +++ b/gql/status.go @@ -91,7 +91,7 @@ func getValidatorSet(client client.Context) ([]*ValidatorInfo, error) { // GetDiskUsage returns disk usage for the given path. func GetDiskUsage(dirPath string) (string, error) { - out, err := exec.Command("du", "-sh", dirPath).Output() + out, err := exec.Command("du", "-sh", dirPath).Output() // #nosec G204 if err != nil { return "", err } diff --git a/gql/util.go b/gql/util.go index 4cfe9578..a2747f80 100644 --- a/gql/util.go +++ b/gql/util.go @@ -4,7 +4,7 @@ import ( "context" "encoding/json" "fmt" - "reflect" + "reflect" // #nosec G702 "strconv" auctiontypes "github.com/cerc-io/laconicd/x/auction/types" @@ -166,11 +166,11 @@ func GetGQLAuction(auction *auctiontypes.Auction, bids []*auctiontypes.Bid) (*Au func getReferences(ctx context.Context, resolver QueryResolver, r *nstypes.RecordType) ([]*Record, error) { var ids []string - for _, value := range r.Attributes { + for key := range r.Attributes { //nolint: all - switch value.(type) { + switch r.Attributes[key].(type) { case interface{}: - if obj, ok := value.(map[string]interface{}); ok { + if obj, ok := r.Attributes[key].(map[string]interface{}); ok { if _, ok := obj["/"]; ok && len(obj) == 1 { if _, ok := obj["/"].(string); ok { ids = append(ids, obj["/"].(string)) diff --git a/rpc/namespaces/ethereum/debug/api.go b/rpc/namespaces/ethereum/debug/api.go index 2bba5bab..e86e45c2 100644 --- a/rpc/namespaces/ethereum/debug/api.go +++ b/rpc/namespaces/ethereum/debug/api.go @@ -6,7 +6,7 @@ import ( "fmt" "io" "os" - "runtime" + "runtime" // #nosec G702 "runtime/debug" "runtime/pprof" "sync" diff --git a/version/version.go b/version/version.go index fa16dc85..abc1177e 100755 --- a/version/version.go +++ b/version/version.go @@ -2,7 +2,7 @@ package version import ( "fmt" - "runtime" + "runtime" // #nosec G702 ) var ( diff --git a/x/auction/client/cli/tx.go b/x/auction/client/cli/tx.go index 9218c9ea..f8df85b7 100644 --- a/x/auction/client/cli/tx.go +++ b/x/auction/client/cli/tx.go @@ -169,7 +169,7 @@ func GetCmdRevealBid() *cobra.Command { auctionID := args[0] revealFilePath := args[1] - revealBytes, err := ioutil.ReadFile(revealFilePath) + revealBytes, err := ioutil.ReadFile(revealFilePath) // #nosec G304 if err != nil { return err } diff --git a/x/auction/genesis.go b/x/auction/genesis.go index 44b1fc6f..d07ef47c 100644 --- a/x/auction/genesis.go +++ b/x/auction/genesis.go @@ -29,6 +29,7 @@ func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) types.GenesisState { genesisAuctions := []*types.Auction{} for _, auction := range auctions { + // #nosec G601 genesisAuctions = append(genesisAuctions, &auction) //nolint: all } return types.GenesisState{Params: params, Auctions: genesisAuctions} diff --git a/x/evm/module.go b/x/evm/module.go index 73885f2a..ae6fe869 100644 --- a/x/evm/module.go +++ b/x/evm/module.go @@ -4,7 +4,7 @@ import ( "context" "encoding/json" "fmt" - "math/rand" + "math/rand" // #nosec G702 "github.com/gorilla/mux" "github.com/grpc-ecosystem/grpc-gateway/runtime" diff --git a/x/feemarket/module.go b/x/feemarket/module.go index c8cdd710..cae68c83 100644 --- a/x/feemarket/module.go +++ b/x/feemarket/module.go @@ -4,7 +4,7 @@ import ( "context" "encoding/json" "fmt" - "math/rand" + "math/rand" // #nosec G702 "github.com/gorilla/mux" "github.com/grpc-ecosystem/grpc-gateway/runtime" diff --git a/x/nameservice/client/cli/tx.go b/x/nameservice/client/cli/tx.go index 711bf400..b4f4f74e 100644 --- a/x/nameservice/client/cli/tx.go +++ b/x/nameservice/client/cli/tx.go @@ -375,7 +375,7 @@ $ %s tx %s delete-name [crn] func GetPayloadFromFile(filePath string) (*types.PayloadType, error) { var payload types.PayloadType - data, err := ioutil.ReadFile(filePath) + data, err := ioutil.ReadFile(filePath) // #nosec G304 if err != nil { return nil, err } diff --git a/x/nameservice/genesis.go b/x/nameservice/genesis.go index ae6413b5..83c887f6 100644 --- a/x/nameservice/genesis.go +++ b/x/nameservice/genesis.go @@ -65,7 +65,7 @@ func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) types.GenesisState { authorityEntries = append(authorityEntries, types.AuthorityEntry{ Name: name, Entry: &record, //nolint: all - }) + }) // #nosec G601 } names := keeper.ListNameRecords(ctx)