Skip to content

Potential help with stopping bots from hitting the gift cards PHP file directly. #453

@Benunc

Description

@Benunc

This may be totally a me-problem (and I've mitigated it with a cloudflare rule) but a client site where I am using this plugin was having memory issues, and I dug in and found that it came back to a fatal error related to this file:

PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in {redacted}wp-content/plugins/woocommerce-square/includes/Emails/WC_Square_Gift_Card_Sent.php on line 90

Here's the thing: I don't have the gift cards module in use at all. That file should not even be able to be called, much less get to a problem on line 90.

I was also getting phantom spam orders, which may or may not be related. They did go away with a cloudflare rule blocking http.request.uri.path contains "WC_Square_Gift_Card_Sent.php"

I'm unable to replicate the problem in a test environment, but a simple fix would be to have the code exit quickly based on whether or not the gift cards option is enabled.

But also, I'm out of my depth knowing what the second order effects would be of that decision. Just thought I'd pass it along.

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