GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (217)

Security Analysis    no vulnerabilities found

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.

backup/class-backup-engine-database-mysqldump.php (3 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
namespace HM\BackUpWordPress;
4
5
use Symfony\Component\Process\Process as Process;
6
7
/**
8
 * Perform a database backup using the mysqldump cli command
9
 */
10
class Mysqldump_Database_Backup_Engine extends Database_Backup_Engine {
11
12
	/**
13
	 * The path to the mysqldump executable
14
	 *
15
	 * @var string
16
	 */
17
	private $mysqldump_executable_path = '';
18
19
	public function __construct() {
20
		parent::__construct();
21
	}
22
23
	/**
24
	 * Calculate the path to the mysqldump executable.
25
	 *
26
	 * The executable path can be overridden using either the `HMBKP_MYSQLDUMP_PATH`
27
	 * Constant or the `hmbkp_mysqldump_executable_path` filter.
28
	 *
29
	 * If neither of those are set then we fallback to checking a number of
30
	 * common locations.
31
	 *
32
	 * @return string|false The path to the executable or false.
33
	 */
34
	public function get_mysqldump_executable_path() {
35
36
		// Return now if it's set in a Constant
37
		if ( defined( 'HMBKP_MYSQLDUMP_PATH' ) && HMBKP_MYSQLDUMP_PATH ) {
38
			$this->mysqldump_executable_path = HMBKP_MYSQLDUMP_PATH;
39
		}
40
41
		/**
42
		 * Allow the executable path to be set via a filter
43
		 *
44
		 * @param string The path to the mysqldump executable
45
		 */
46
		$this->mysqldump_executable_path = apply_filters( 'hmbkp_mysqldump_executable_path', '' );
47
48
		if ( ! $this->mysqldump_executable_path ) {
49
50
			// List of possible mysqldump locations
51
			$paths = array(
52
				'mysqldump',
53
				'/usr/local/bin/mysqldump',
54
				'/usr/local/mysql/bin/mysqldump',
55
				'/usr/mysql/bin/mysqldump',
56
				'/usr/bin/mysqldump',
57
				'/opt/local/lib/mysql6/bin/mysqldump',
58
				'/opt/local/lib/mysql5/bin/mysqldump',
59
				'/opt/local/lib/mysql4/bin/mysqldump',
60
				'/xampp/mysql/bin/mysqldump',
61
				'/Program Files/xampp/mysql/bin/mysqldump',
62
				'/Program Files/MySQL/MySQL Server 6.0/bin/mysqldump',
63
				'/Program Files/MySQL/MySQL Server 5.7/bin/mysqldump',
64
				'/Program Files/MySQL/MySQL Server 5.6/bin/mysqldump',
65
				'/Program Files/MySQL/MySQL Server 5.5/bin/mysqldump',
66
				'/Program Files/MySQL/MySQL Server 5.4/bin/mysqldump',
67
				'/Program Files/MySQL/MySQL Server 5.1/bin/mysqldump',
68
				'/Program Files/MySQL/MySQL Server 5.0/bin/mysqldump',
69
				'/Program Files/MySQL/MySQL Server 4.1/bin/mysqldump',
70
				'/opt/local/bin/mysqldump',
71
			);
72
73
			$this->mysqldump_executable_path = Backup_Utilities::get_executable_path( $paths );
0 ignored issues
show
Documentation Bug introduced by
It seems like \HM\BackUpWordPress\Back...executable_path($paths) can also be of type false. However, the property $mysqldump_executable_path is declared as type string. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
74
75
		}
76
77
		return $this->mysqldump_executable_path;
78
79
	}
80
81
	/**
82
	 * Perform the database backup.
83
	 *
84
	 * @return bool Whether the backup completed successfully or not.
85
	 */
86
	public function backup() {
87
88
		if ( ! $this->get_mysqldump_executable_path() ) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $this->get_mysqldump_executable_path() of type string|false is loosely compared to false; this is ambiguous if the string can be empty. You might want to explicitly use === false instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For string values, the empty string '' is a special case, in particular the following results might be unexpected:

''   == false // true
''   == null  // true
'ab' == false // false
'ab' == null  // false

// It is often better to use strict comparison
'' === false // false
'' === null  // false
Loading history...
89
			return false;
90
		}
91
92
		// Grab the database connections args
93
		$args = $this->get_mysql_connection_args();
94
95
		// Allow lock-tables to be overridden
96
		if ( defined( 'HMBKP_MYSQLDUMP_SINGLE_TRANSACTION' ) && HMBKP_MYSQLDUMP_SINGLE_TRANSACTION  ) {
97
			$args[] = '--single-transaction';
98
		}
99
100
		// Make sure binary data is exported properly
101
		$args[] = '--hex-blob';
102
103
		// The file we're saving too
104
		$args[] = '-r ' . escapeshellarg( $this->get_backup_filepath() );
105
106
		// The database we're dumping
107
		$args[] = escapeshellarg( $this->get_name() );
108
109
		$process = new Process( $this->get_mysqldump_executable_path() . ' ' . implode( ' ', $args ) );
110
		$process->setTimeout( HOUR_IN_SECONDS );
111
112
		try {
113
			$process->run();
114
		} catch ( \Exception $e ) {
115
			$this->error( __CLASS__, $e->getMessage() );
116
		}
117
118
		if ( ! $process->isSuccessful() ) {
119
			$this->error( __CLASS__, $process->getErrorOutput() );
120
		}
121
122
		return $this->verify_backup();
123
124
	}
125
126
	/**
127
	 * Get the connection args for the mysqldump command
128
	 *
129
	 * @return array The array of connection args
0 ignored issues
show
Consider making the return type a bit more specific; maybe use string[].

This check looks for the generic type array as a return type and suggests a more specific type. This type is inferred from the actual code.

Loading history...
130
	 */
131
	public function get_mysql_connection_args() {
132
133
		$args = array();
134
135
		$args[] = '-u ' . escapeshellarg( $this->get_user() );
136
137
		if ( $this->get_password() ) {
138
			$args[] = '-p' . escapeshellarg( $this->get_password() );
139
		}
140
141
		$args[] = '-h ' . escapeshellarg( $this->get_host() );
142
143
		if ( $this->get_port() ) {
144
			$args[] = '-P ' . escapeshellarg( $this->get_port() );
145
		}
146
147
		if ( $this->get_socket() ) {
148
			$args[] = '--protocol=socket -S ' . escapeshellarg( $this->get_socket() );
149
		}
150
151
		return $args;
152
153
	}
154
}
155