Language: Go
Label: safe
CWE: CWE-20 \u2014 Improper Input Validation
The product receives input or data, but it does
        not validate or incorrectly validates that the input has the
        properties that are required to process the data safely and
        correctly.

Code:
func (e *ERC20LogicView) FindAssetList(
	al *types.ERC20AssetList,
	blockNumber,
	logIndex uint64,
	txHash string,
) error {
	bf, err := bridgecontract.NewErc20BridgeLogicRestrictedFilterer(
		e.clt.CollateralBridgeAddress(), e.clt)
	if err != nil {
		return err
	}

	resp := "ok"
	defer func() {
		metrics.EthCallInc("find_asset_list", al.VegaAssetID, resp)
	}()

	ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
	defer cancel()
	iter, err := bf.FilterAssetListed(
		&bind.FilterOpts{
			Start:   blockNumber - 1,
			Context: ctx,
		},
		[]ethcommon.Address{ethcommon.HexToAddress(al.AssetSource)},
		[][32]byte{},
	)
	if err != nil {
		resp = getMaybeHTTPStatus(err)
		return err
	}
	defer iter.Close()

	var event *bridgecontract.Erc20BridgeLogicRestrictedAssetListed
	assetID := strings.TrimPrefix(al.VegaAssetID, "0x")

	for iter.Next() {
		if hex.EncodeToString(iter.Event.VegaAssetId[:]) == assetID &&
			iter.Event.Raw.BlockNumber == blockNumber &&
			uint64(iter.Event.Raw.Index) == logIndex &&
			iter.Event.Raw.TxHash.Hex() == txHash {
			event = iter.Event

			break
		}
	}

	if event == nil {
		return ErrUnableToFindERC20AssetList
	}

	// now ensure we have enough confirmations
	if err := e.ethConfs.Check(event.Raw.BlockNumber); err != nil {
		return err
	}

	return nil
}