Issues (197)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

...stripe-email-failed-preorder-authentication.php (2 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
if ( ! defined( 'ABSPATH' ) ) {
3
	exit; // Exit if accessed directly.
4
}
5
6
/**
7
 * Failed Renewal/Pre-Order Authentication Notification
8
 *
9
 * @extends WC_Stripe_Email_Failed_Authentication
10
 */
11
class WC_Stripe_Email_Failed_Preorder_Authentication extends WC_Stripe_Email_Failed_Authentication {
12
	/**
13
	 * Holds the message, which is entered by admins when sending the email.
14
	 *
15
	 * @var string
16
	 */
17
	protected $custom_message;
18
19
	/**
20
	 * Constructor.
21
	 *
22
	 * @param WC_Email[] $email_classes All existing instances of WooCommerce emails.
23
	 */
24 View Code Duplication
	public function __construct( $email_classes = array() ) {
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
25
		$this->id             = 'failed_preorder_sca_authentication';
26
		$this->title          = __( 'Pre-order Payment Action Needed', 'woocommerce-gateway-stripe' );
27
		$this->description    = __( 'This is an order notification sent to the customer once a pre-order is complete, but additional payment steps are required.', 'woocommerce-gateway-stripe' );
28
		$this->customer_email = true;
29
30
		$this->template_html  = 'emails/failed-preorder-authentication.php';
31
		$this->template_plain = 'emails/plain/failed-preorder-authentication.php';
32
		$this->template_base  = plugin_dir_path( WC_STRIPE_MAIN_FILE ) . 'templates/';
33
34
		// Use the "authentication required" hook to add the correct, later hook.
35
		add_action( 'wc_gateway_stripe_process_payment_authentication_required', array( $this, 'trigger' ) );
36
37
		if ( isset( $email_classes['WC_Pre_Orders_Email_Pre_Order_Available'] ) ) {
38
			$this->original_email = $email_classes['WC_Pre_Orders_Email_Pre_Order_Available'];
39
		}
40
41
		// We want all the parent's methods, with none of its properties, so call its parent's constructor, rather than my parent constructor.
42
		parent::__construct();
43
	}
44
45
	/**
46
	 * When autnentication is required, this adds another action to `wc_pre_orders_pre_order_completed`
47
	 * in order to send the authentication required email when the custom pre-orders message is available.
48
	 *
49
	 * @param WC_Order $order The order whose payment is failing.
50
	 */
51
	public function trigger( $order ) {
52
		if ( class_exists( 'WC_Pre_Orders_Order' ) && WC_Pre_Orders_Order::order_contains_pre_order( $order->get_id() ) ) {
53
			if ( isset( $this->original_email ) ) {
54
				remove_action( 'wc_pre_order_status_completed_notification', array( $this->original_email, 'trigger' ), 10, 2 );
55
			}
56
57
			add_action( 'wc_pre_orders_pre_order_completed', array( $this, 'send_email' ), 10, 2 );
58
		}
59
	}
60
61
	/**
62
	 * Triggers the email while also disconnecting the original Pre-Orders email.
63
	 *
64
	 * @param WC_Order $order The order that is being paid.
65
	 * @param string   $message The message, which should be added to the email.
66
	 */
67
	public function send_email( $order, $message ) {
68
		$this->custom_message = $message;
69
70
		parent::trigger( $order );
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (trigger() instead of send_email()). Are you sure this is correct? If so, you might want to change this to $this->trigger().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
71
72
		// Restore the action of the original email for other bulk actions.
73
		if ( isset( $this->original_email ) ) {
74
			add_action( 'wc_pre_order_status_completed_notification', array( $this->original_email, 'trigger' ), 10, 2 );
75
		}
76
	}
77
78
	/**
79
	 * Returns the default subject of the email (modifyable in settings).
80
	 *
81
	 * @return string
82
	 */
83
	public function get_default_subject() {
84
		return __( 'Payment authorization needed for pre-order {order_number}', 'woocommerce-gateway-stripe' );
85
	}
86
87
	/**
88
	 * Returns the default heading of the email (modifyable in settings).
89
	 *
90
	 * @return string
91
	 */
92
	public function get_default_heading() {
93
		return __( 'Payment authorization needed for pre-order {order_number}', 'woocommerce-gateway-stripe' );
94
	}
95
96
	/**
97
	 * Returns the custom message, entered by the admin.
98
	 *
99
	 * @return string
100
	 */
101
	public function get_custom_message() {
102
		return $this->custom_message;
103
	}
104
}
105