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 (o *OnChainVerifier) filterSignerAdded(
	ctx context.Context,
	filterer *multisig.MultisigControlFilterer,
	event *types.SignerEvent,
) error {
	iter, err := filterer.FilterSignerAdded(
		&bind.FilterOpts{
			Start:   event.BlockNumber,
			End:     &event.BlockNumber,
			Context: ctx,
		},
	)
	if err != nil {
		o.log.Error("Couldn't start filtering on signer added event",
			logging.Error(err))
		return err
	}
	defer iter.Close()

	for iter.Next() {
		if o.log.GetLevel() <= logging.DebugLevel {
			o.log.Debug("found signer added event on chain",
				logging.String("new-signer", iter.Event.NewSigner.Hex()),
			)
		}

		nonce, _ := big.NewInt(0).SetString(event.Nonce, 10)
		if iter.Event.Raw.BlockNumber == event.BlockNumber &&
			uint64(iter.Event.Raw.Index) == event.LogIndex &&
			iter.Event.NewSigner.Hex() == event.Address &&
			nonce.Cmp(iter.Event.Nonce) == 0 &&
			iter.Event.Raw.TxHash.Hex() == event.TxHash {
			// now we know the event is OK,
			// just need to check for confirmations
			return o.ethConfirmations.Check(event.BlockNumber)
		}
	}

	return ErrNoSignerEventFound
}