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.

...wc-stripe-email-failed-authentication-retry.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
/**
3
 * Admin email about payment retry failed due to authentication
4
 *
5
 * Email sent to admins when an attempt to automatically process a subscription renewal payment has failed
6
 * with the `authentication_needed` error, and a retry rule has been applied to retry the payment in the future.
7
 *
8
 * @version     4.3.0
9
 * @package     WooCommerce_Stripe/Classes/WC_Stripe_Email_Failed_Authentication_Retry
10
 * @extends     WC_Email_Failed_Order
11
 */
12
13
if ( ! defined( 'ABSPATH' ) ) {
14
	exit;
15
}
16
17
/**
18
 * An email sent to the admin when payment fails to go through due to authentication_required error.
19
 *
20
 * @since 4.3.0
21
 */
22
class WC_Stripe_Email_Failed_Authentication_Retry extends WC_Email_Failed_Order {
23
24
	/**
25
	 * Constructor
26
	 */
27
	public function __construct() {
28
		$this->id          = 'failed_authentication_requested';
29
		$this->title       = __( 'Payment Authentication Requested Email', 'woocommerce-gateway-stripe' );
30
		$this->description = __( 'Payment authentication requested emails are sent to chosen recipient(s) when an attempt to automatically process a subscription renewal payment fails because the transaction requires an SCA verification, the customer is requested to authenticate the payment, and a retry rule has been applied to notify the customer again within a certain time period.', 'woocommerce-gateway-stripe' );
31
32
		$this->heading = __( 'Automatic renewal payment failed due to authentication required', 'woocommerce-gateway-stripe' );
33
		$this->subject = __( '[{site_title}] Automatic payment failed for {order_number}. Customer asked to authenticate payment and will be notified again {retry_time}', 'woocommerce-gateway-stripe' );
34
35
		$this->template_html  = 'emails/failed-renewal-authentication-requested.php';
36
		$this->template_plain = 'emails/plain/failed-renewal-authentication-requested.php';
37
		$this->template_base  = plugin_dir_path( WC_STRIPE_MAIN_FILE ) . 'templates/';
38
39
		$this->recipient = $this->get_option( 'recipient', get_option( 'admin_email' ) );
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
		WC_Email::__construct();
43
	}
44
45
	/**
46
	 * Get the default e-mail subject.
47
	 *
48
	 * @return string
49
	 */
50
	public function get_default_subject() {
51
		return $this->subject;
52
	}
53
54
	/**
55
	 * Get the default e-mail heading.
56
	 *
57
	 * @return string
58
	 */
59
	public function get_default_heading() {
60
		return $this->heading;
61
	}
62
63
	/**
64
	 * Trigger.
65
	 *
66
	 * @param int           $order_id The order ID.
67
	 * @param WC_Order|null $order Order object.
68
	 */
69
	public function trigger( $order_id, $order = null ) {
70
		$this->object = $order;
71
72
		$this->find['retry-time'] = '{retry_time}';
73
		if ( class_exists( 'WCS_Retry_Manager' ) && function_exists( 'wcs_get_human_time_diff' ) ) {
74
			$this->retry = WCS_Retry_Manager::store()->get_last_retry_for_order( wcs_get_objects_property( $order, 'id' ) );
75
			$this->replace['retry-time'] = wcs_get_human_time_diff( $this->retry->get_time() );
76
		} else {
77
			WC_Stripe_Logger::log( 'WCS_Retry_Manager class or does not exist. Not able to send admnin email about customer notification for authentication required for renewal payment.' );
78
			return;
79
		}
80
81
		$this->find['order-number']    = '{order_number}';
82
		$this->replace['order-number'] = $this->object->get_order_number();
83
84
		if ( ! $this->is_enabled() || ! $this->get_recipient() ) {
85
			return;
86
		}
87
88
		$this->send( $this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments() );
89
	}
90
91
	/**
92
	 * Get content html.
93
	 *
94
	 * @return string
95
	 */
96 View Code Duplication
	public function get_content_html() {
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...
97
		return wc_get_template_html(
98
			$this->template_html,
99
			array(
100
				'order'         => $this->object,
101
				'retry'         => $this->retry,
102
				'email_heading' => $this->get_heading(),
103
				'sent_to_admin' => true,
104
				'plain_text'    => false,
105
				'email'         => $this,
106
			),
107
			'',
108
			$this->template_base
109
		);
110
	}
111
112
	/**
113
	 * Get content plain.
114
	 *
115
	 * @return string
116
	 */
117 View Code Duplication
	public function get_content_plain() {
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...
118
		return wc_get_template_html(
119
			$this->template_plain,
120
			array(
121
				'order'         => $this->object,
122
				'retry'         => $this->retry,
123
				'email_heading' => $this->get_heading(),
124
				'sent_to_admin' => true,
125
				'plain_text'    => true,
126
				'email'         => $this,
127
			),
128
			'',
129
			$this->template_base
130
		);
131
	}
132
}
133