diff --git a/.golangci.yaml b/.golangci.yaml index 90c081429a..12df91f3b1 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -82,6 +82,10 @@ output: # all available settings of specific linters linters-settings: + gosec: + # TODO: fix all issues with int overflow and return this rule back + excludes: + - G115 dogsled: # checks assignments with too many blank identifiers; default is 2 max-blank-identifiers: 2 diff --git a/ekm/signer_storage.go b/ekm/signer_storage.go index fc8eadd62e..5f67dcffa9 100644 --- a/ekm/signer_storage.go +++ b/ekm/signer_storage.go @@ -128,7 +128,7 @@ func (s *storage) OpenWallet() (core.Wallet, error) { if err != nil { return nil, errors.Wrap(err, "failed to open wallet") } - if obj.Value == nil || len(obj.Value) == 0 { + if len(obj.Value) == 0 { return nil, errors.New("failed to open wallet") } // decode @@ -280,7 +280,7 @@ func (s *storage) RetrieveHighestAttestation(pubKey []byte) (*phase0.Attestation if !found { return nil, false, nil } - if obj.Value == nil || len(obj.Value) == 0 { + if len(obj.Value) == 0 { return nil, found, errors.Wrap(err, "highest attestation value is empty") } @@ -333,7 +333,7 @@ func (s *storage) RetrieveHighestProposal(pubKey []byte) (phase0.Slot, bool, err if !found { return 0, found, nil } - if obj.Value == nil || len(obj.Value) == 0 { + if len(obj.Value) == 0 { return 0, found, errors.Wrap(err, "highest proposal value is empty") } @@ -350,7 +350,7 @@ func (s *storage) RemoveHighestProposal(pubKey []byte) error { } func (s *storage) decryptData(objectValue []byte) ([]byte, error) { - if s.encryptionKey == nil || len(s.encryptionKey) == 0 { + if len(s.encryptionKey) == 0 { return objectValue, nil } @@ -363,7 +363,7 @@ func (s *storage) decryptData(objectValue []byte) ([]byte, error) { } func (s *storage) encryptData(objectValue []byte) ([]byte, error) { - if s.encryptionKey == nil || len(s.encryptionKey) == 0 { + if len(s.encryptionKey) == 0 { return objectValue, nil } diff --git a/integration/qbft/tests/setup_test.go b/integration/qbft/tests/setup_test.go index d319c44793..6a5655b840 100644 --- a/integration/qbft/tests/setup_test.go +++ b/integration/qbft/tests/setup_test.go @@ -2,6 +2,7 @@ package tests import ( "context" + "os" "testing" spectypes "github.com/bloxapp/ssv-spec/types" @@ -61,10 +62,13 @@ func TestMain(m *testing.M) { Nodes: nodes, } - m.Run() + // exitCode required here only for linter + exitCode := m.Run() //teardown for i := 0; i < len(ln.Nodes); i++ { _ = ln.Nodes[i].Close() } + + os.Exit(exitCode) } diff --git a/operator/keys/rsa_linux_test.go b/operator/keys/rsa_linux_test.go index e53d875fdf..c6e29d42d6 100644 --- a/operator/keys/rsa_linux_test.go +++ b/operator/keys/rsa_linux_test.go @@ -1,4 +1,5 @@ -// go:build linux +//go:build linux + package keys import ( @@ -6,10 +7,9 @@ import ( "crypto/rand" "crypto/rsa" "crypto/sha256" + "testing" "github.com/stretchr/testify/require" - - "testing" ) func Test_VerifyRegularSigWithOpenSSL(t *testing.T) {