Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid signatures are accepted #12

Closed
aleahy opened this issue May 15, 2021 · 1 comment
Closed

Invalid signatures are accepted #12

aleahy opened this issue May 15, 2021 · 1 comment

Comments

@aleahy
Copy link

aleahy commented May 15, 2021

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?

@cyrillkalita
Copy link
Member

@aleahy absolutely!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants