nosec G705

This commit is contained in:
0xmuralik 2022-10-18 12:14:29 +05:30
parent 906ec2a06c
commit 670dc398e4
13 changed files with 16 additions and 11 deletions

View File

@ -768,6 +768,7 @@ func (app *EthermintApp) LoadHeight(height int64) error {
// ModuleAccountAddrs returns all the app's module account addresses.
func (app *EthermintApp) ModuleAccountAddrs() map[string]bool {
modAccAddrs := make(map[string]bool)
// #nosec G705
for acc := range maccPerms {
modAccAddrs[authtypes.NewModuleAddress(acc).String()] = true
}
@ -779,6 +780,7 @@ func (app *EthermintApp) ModuleAccountAddrs() map[string]bool {
// allowed to receive external tokens.
func (app *EthermintApp) BlockedAddrs() map[string]bool {
blockedAddrs := make(map[string]bool)
// #nosec G705
for acc := range maccPerms {
blockedAddrs[authtypes.NewModuleAddress(acc).String()] = !allowedReceivingModAcc[acc]
}

2
go.mod
View File

@ -198,7 +198,7 @@ require (
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect
golang.org/x/oauth2 v0.0.0-20220622183110-fd043fe589d2 // indirect
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 // indirect
golang.org/x/sys v0.0.0-20220908150016-7ac13a9a928d // indirect
golang.org/x/sys v0.0.0-20220913175220-63ea55921009 // indirect
golang.org/x/term v0.0.0-20220722155259-a9ba230a4035 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/api v0.93.0 // indirect

4
go.sum
View File

@ -1456,8 +1456,8 @@ golang.org/x/sys v0.0.0-20220610221304-9f5ed59c137d/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220624220833-87e55d714810/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220908150016-7ac13a9a928d h1:RoyzQTK76Rktm3p4xyZslc8T8I1tBz4UEjZCzeh57mM=
golang.org/x/sys v0.0.0-20220908150016-7ac13a9a928d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220913175220-63ea55921009 h1:PuvuRMeLWqsf/ZdT1UUZz0syhioyv1mzuFZsXs4fvhw=
golang.org/x/sys v0.0.0-20220913175220-63ea55921009/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=

View File

@ -193,6 +193,7 @@ func mapToKeyValuePairs(attrs map[string]interface{}) ([]*KeyValue, error) {
trueVal := true
falseVal := false
// #nosec G705
for key, value := range attrs {
kvPair := &KeyValue{
Key: key,

View File

@ -124,6 +124,7 @@ func (m *memEventBus) closeAllSubscribers(name string) {
subsribers := m.subscribers[name]
delete(m.subscribers, name)
// #nosec G705
for _, sub := range subsribers {
close(sub)
}
@ -134,6 +135,7 @@ func (m *memEventBus) publishAllSubscribers(name string, msg coretypes.ResultEve
subsribers := m.subscribers[name]
m.subscribersMux.RUnlock()
// #nosec G705
for _, sub := range subsribers {
select {
case sub <- msg:

View File

@ -102,6 +102,7 @@ func (api *PublicFilterAPI) timeoutLoop() {
for {
<-ticker.C
api.filtersMu.Lock()
// #nosec G705
for id, f := range api.filters {
select {
case <-f.deadline.C:

View File

@ -240,6 +240,7 @@ func (es *EventSystem) eventLoop() {
delete(es.index[f.typ], f.id)
var channelInUse bool
// #nosec G705
for _, sub := range es.index[f.typ] {
if sub.event == f.event {
channelInUse = true

View File

@ -173,6 +173,7 @@ func (s *websocketsServer) readLoop(wsConn *wsConn) {
subscriptions := make(map[rpc.ID]pubsub.UnsubscribeFunc)
defer func() {
// cancel all subscriptions when connection closed
// #nosec G705
for _, unsubFn := range subscriptions {
unsubFn()
}

View File

@ -87,7 +87,6 @@ func call(t *testing.T, method string, params interface{}) *Response {
require.NoError(t, err)
time.Sleep(1 * time.Second)
/* #nosec */
res, err := http.Post(HOST, "application/json", bytes.NewBuffer(req))
require.NoError(t, err)
@ -110,7 +109,6 @@ func callWithError(method string, params interface{}) (*Response, error) {
}
time.Sleep(1 * time.Second)
/* #nosec */
res, err := http.Post(HOST, "application/json", bytes.NewBuffer(req))
if err != nil {
return nil, err
@ -246,7 +244,6 @@ func TestEth_GetFilterChanges_WrongID(t *testing.T) {
req, err := json.Marshal(createRequest("eth_getFilterChanges", []string{"0x1122334400000077"}))
require.NoError(t, err)
/* #nosec */
res, err := http.Post(HOST, "application/json", bytes.NewBuffer(req))
require.NoError(t, err)

View File

@ -32,13 +32,11 @@ import (
"github.com/ethereum/go-ethereum/crypto"
)
// #nosec 101
const (
/* #nosec */
OpWeightMsgEthSimpleTransfer = "op_weight_msg_eth_simple_transfer"
/* #nosec */
OpWeightMsgEthCreateContract = "op_weight_msg_eth_create_contract"
/* #nosec */
OpWeightMsgEthCallContract = "op_weight_msg_eth_call_contract"
OpWeightMsgEthCallContract = "op_weight_msg_eth_call_contract"
)
const (

View File

@ -53,6 +53,7 @@ func newJournal() *journal {
func (j *journal) sortedDirties() []common.Address {
keys := make([]common.Address, len(j.dirties))
i := 0
// #nosec G705
for k := range j.dirties {
keys[i] = k
i++

View File

@ -39,6 +39,7 @@ type Storage map[common.Hash]common.Hash
func (s Storage) SortedKeys() []common.Hash {
keys := make([]common.Hash, len(s))
i := 0
// #nosec G705
for k := range s {
keys[i] = k
i++

View File

@ -60,7 +60,7 @@ func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) types.GenesisState {
authorities := keeper.ListNameAuthorityRecords(ctx)
authorityEntries := []types.AuthorityEntry{}
// #nosec
// #nosec G705
for name, record := range authorities {
authorityEntries = append(authorityEntries, types.AuthorityEntry{
Name: name,