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.

class-wc-stripe-email-failed-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
 * Base for Failed Renewal/Pre-Order Authentication Notifications.
8
 *
9
 * @extends WC_Email
10
 */
11
abstract class WC_Stripe_Email_Failed_Authentication extends WC_Email {
12
	/**
13
	 * An instance of the email, which would normally be sent after a failed payment.
14
	 *
15
	 * @var WC_Email
16
	 */
17
	public $original_email;
18
19
	/**
20
	 * Generates the HTML for the email while keeping the `template_base` in mind.
21
	 *
22
	 * @return string
23
	 */
24 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...
25
		ob_start();
26
		wc_get_template(
27
			$this->template_html,
28
			array(
29
				'order'             => $this->object,
30
				'email_heading'     => $this->get_heading(),
31
				'sent_to_admin'     => false,
32
				'plain_text'        => false,
33
				'authorization_url' => $this->get_authorization_url( $this->object ),
34
				'email'             => $this,
35
			),
36
			'',
37
			$this->template_base
38
		);
39
		return ob_get_clean();
40
	}
41
42
	/**
43
	 * Generates the plain text for the email while keeping the `template_base` in mind.
44
	 *
45
	 * @return string
46
	 */
47 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...
48
		ob_start();
49
		wc_get_template(
50
			$this->template_plain,
51
			array(
52
				'order'             => $this->object,
53
				'email_heading'     => $this->get_heading(),
54
				'sent_to_admin'     => false,
55
				'plain_text'        => true,
56
				'authorization_url' => $this->get_authorization_url( $this->object ),
57
				'email'             => $this,
58
			),
59
			'',
60
			$this->template_base
61
		);
62
		return ob_get_clean();
63
	}
64
65
	/**
66
	 * Generates the URL, which will be used to authenticate the payment.
67
	 *
68
	 * @param WC_Order $order The order whose payment needs authentication.
69
	 * @return string
70
	 */
71
	public function get_authorization_url( $order ) {
72
		return add_query_arg( 'wc-stripe-confirmation', 1, $order->get_checkout_payment_url( false ) );
73
	}
74
75
	/**
76
	 * Uses specific fields from `WC_Email_Customer_Invoice` for this email.
77
	 */
78
	public function init_form_fields() {
79
		parent::init_form_fields();
80
		$base_fields = $this->form_fields;
81
82
		$this->form_fields = array(
83
			'enabled'    => array(
84
				'title'   => _x( 'Enable/Disable', 'an email notification', 'woocommerce-gateway-stripe' ),
85
				'type'    => 'checkbox',
86
				'label'   => __( 'Enable this email notification', 'woocommerce-gateway-stripe' ),
87
				'default' => 'yes',
88
			),
89
90
			'subject'    => $base_fields['subject'],
91
			'heading'    => $base_fields['heading'],
92
			'email_type' => $base_fields['email_type'],
93
		);
94
	}
95
96
	/**
97
	 * Triggers the email.
98
	 *
99
	 * @param WC_Order $order The renewal order whose payment failed.
100
	 */
101
	public function trigger( $order ) {
102
		if ( ! $this->is_enabled() ) {
103
			return;
104
		}
105
106
		$this->object = $order;
107
108
		if ( method_exists( $order, 'get_billing_email' ) ) {
109
			$this->recipient = $order->get_billing_email();
110
		} else {
111
			$this->recipient = $order->billing_email;
112
		}
113
114
		$this->find['order_date'] = '{order_date}';
115
		if ( function_exists( 'wc_format_datetime' ) ) { // WC 3.0+
116
			$this->replace['order_date'] = wc_format_datetime( $order->get_date_created() );
117
		} else { // WC < 3.0
118
			$this->replace['order_date'] = $order->date_created->date_i18n( wc_date_format() );
119
		}
120
121
		$this->find['order_number']    = '{order_number}';
122
		$this->replace['order_number'] = $order->get_order_number();
123
124
		$this->send( $this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments() );
125
	}
126
}
127