matomo-org / plugin-TrackingSpamPrevention

GNU General Public License v3.0
12 stars 7 forks source link

When an IP is banned, an HTTP 500 happens in the tracking request because it fails to send the email #32

Closed tsteur closed 2 years ago

tsteur commented 2 years ago

Getting this error:

image

To reproduce, set max actions per visit for example to 3 and configure a notification email.

image

Then issue 4 tracking requests. The 4th tracking request should result in an HTTP 500.

We noticed this yesterday ourselves as pretty much all tracking requests resulted in an HTTP 500 in one account.

The problem is that we shouldn't use twig to create the email in https://github.com/matomo-org/plugin-TrackingSpamPrevention/blob/4.x-dev/BanIpNotificationEmail.php#L30

The email content is very basic anyway so we could instead simply create the email content in PHP directly.

For security we might want to call Common::sanitizeInputValue($string) for each of the values.

tsteur commented 2 years ago

@AltamashShaikh be great to look into this one soon.

AltamashShaikh commented 2 years ago

@tsteur will start working on this from tomorrow