diff --git a/.github/workflows/client.yml b/.github/workflows/client.yml index 7210eed..91964f2 100644 --- a/.github/workflows/client.yml +++ b/.github/workflows/client.yml @@ -51,7 +51,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - - uses: securego/gosec@v2.19.0 + - uses: securego/gosec@v2.24.7 with: args: ./... diff --git a/pkg/chain/ethereum/block_counter.go b/pkg/chain/ethereum/block_counter.go index 50be8ae..c80c575 100644 --- a/pkg/chain/ethereum/block_counter.go +++ b/pkg/chain/ethereum/block_counter.go @@ -97,7 +97,7 @@ func (bc *BlockCounter) WatchBlocks(ctx context.Context) <-chan uint64 { // waited on a message will be sent. func (bc *BlockCounter) receiveBlocks() { for block := range bc.subscriptionChannel { - topBlockNumber, err := strconv.ParseInt(block.Number, 0, 32) + receivedBlockHeight, err := strconv.ParseUint(block.Number, 0, 64) if err != nil { logger.Errorf("error receiving a new block: [%v]", err) continue @@ -111,7 +111,6 @@ func (bc *BlockCounter) receiveBlocks() { // If we have already received notification about this block, // we do nothing. All handlers were already called for this block // height. - receivedBlockHeight := uint64(topBlockNumber) if receivedBlockHeight == bc.latestBlockHeight { continue } diff --git a/pkg/chain/ethereum/ethutil/rate_limiter_test.go b/pkg/chain/ethereum/ethutil/rate_limiter_test.go index c02ab98..a3bc792 100644 --- a/pkg/chain/ethereum/ethutil/rate_limiter_test.go +++ b/pkg/chain/ethereum/ethutil/rate_limiter_test.go @@ -480,6 +480,15 @@ func (mec *mockEthereumClient) TransactionReceipt( return nil, nil } +func (mec *mockEthereumClient) SubscribeTransactionReceipts( + ctx context.Context, + q *ethereum.TransactionReceiptsQuery, + ch chan<- []*types.Receipt, +) (ethereum.Subscription, error) { + mec.mockRequest() + return nil, nil +} + func (mec *mockEthereumClient) BalanceAt( ctx context.Context, account common.Address, diff --git a/pkg/chain/ethereum/ethutil/resubscribe_test.go b/pkg/chain/ethereum/ethutil/resubscribe_test.go index 41b7f78..ea33176 100644 --- a/pkg/chain/ethereum/ethutil/resubscribe_test.go +++ b/pkg/chain/ethereum/ethutil/resubscribe_test.go @@ -2,6 +2,7 @@ package ethutil import ( "context" + "errors" "fmt" "testing" "time" @@ -18,7 +19,7 @@ func TestEmitOriginalError(t *testing.T) { subscribeFn := func(ctx context.Context) (event.Subscription, error) { if !failedOnce { failedOnce = true - return nil, fmt.Errorf(expectedFailMessage) + return nil, errors.New(expectedFailMessage) } delegate := event.NewSubscription(func(unsubscribed <-chan struct{}) error { return nil diff --git a/pkg/persistence/disk_persistence.go b/pkg/persistence/disk_persistence.go index b911355..3b364db 100644 --- a/pkg/persistence/disk_persistence.go +++ b/pkg/persistence/disk_persistence.go @@ -207,7 +207,7 @@ func CheckStoragePermission(dirBasePath string) error { func EnsureDirectoryExists(dirBasePath, newDirName string) error { dirPath := filepath.Join(dirBasePath, newDirName) if _, err := os.Stat(dirPath); os.IsNotExist(err) { - err = os.Mkdir(dirPath, os.ModePerm) + err = os.Mkdir(dirPath, 0o750) if err != nil { return fmt.Errorf( "error occurred while creating a dir: [%w]; "+ diff --git a/tools/generators/promise/promise.go b/tools/generators/promise/promise.go index 5abe610..2e0c5ae 100644 --- a/tools/generators/promise/promise.go +++ b/tools/generators/promise/promise.go @@ -43,7 +43,7 @@ func main() { flag.Parse() if *doHelp { - fmt.Printf(helpText(path.Base(os.Args[0]))) + fmt.Print(helpText(path.Base(os.Args[0]))) os.Exit(0) } @@ -58,7 +58,7 @@ func main() { } func errorAndExit(err string) { - fmt.Fprintf(os.Stderr, err+"\n\n") + fmt.Fprintf(os.Stderr, "%s\n\n", err) fmt.Println(helpText(path.Base(os.Args[0]))) os.Exit(1) diff --git a/tools/generators/template/template.go b/tools/generators/template/template.go index 345fe38..276a0f7 100644 --- a/tools/generators/template/template.go +++ b/tools/generators/template/template.go @@ -31,7 +31,7 @@ func main() { templateFile := os.Args[templateFileArgIndex] - // #nosec G304 (file path provided as taint input) + // #nosec G304 G703 (file path provided as taint input) // This line is placed in the auxiliary generator code, // not in the core application. User input has to be passed to provide a // path to the template file. @@ -77,7 +77,7 @@ func main() { } func errorAndExit(err string) { - fmt.Fprintf(os.Stderr, err+"\n\n") + fmt.Fprintf(os.Stderr, "%s\n\n", err) fmt.Println(helpText(os.Args[0])) os.Exit(1)