Skip to content

Invalid signatures are accepted #12

Closed
@aleahy

Description

@aleahy

Love the package, but there seems to be a problem with verifying the signature.

The isValid method of the MailgunSignatureValidator class doesn't seem to ever be able to return false.

It is expecting an exception to return false, but it can never receive one.

In the Webhook class, you have:

public static function constructEvent(array $payload, array $signature, string $secret): Event
    {
        // verify we are good, else throw an expection
        WebhookSignature::make($signature, $secret)->verify();
        // Make an event
        return Event::constructFrom($payload);
    }

But the verify() function only returns a bool and doesn't throw an exception like the Stripe package. So even if it is false, it doesn't raise an exception and the isValid method of the Signature Validator will always return true.

Would you be interested in a PR?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions