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.

classes/backup/class-backup.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
namespace HM\BackUpWordPress;
4
5
class Backup {
6
7
	private $excludes;
8
	public $warnings = array();
9
	public $errors = array();
10
	private $backup_filename;
11
	private $database_dump_filename;
12
	private $backup_filepath = '';
13
	private $database_dump_filepath = '';
14
	private $status = null;
15
	private $type = 'complete';
16
17
	public function __construct( $backup_filename, $database_dump_filename = null ) {
18
		$this->backup_filename = $backup_filename;
19
		$this->database_dump_filename = $database_dump_filename;
20
	}
21
22
	public function set_type( $type ) {
23
		$this->type = $type;
24
	}
25
26
	public function set_backup_filename( $filename ) {
27
		$this->backup_filename = $filename;
28
	}
29
30
	public function set_status( Backup_Status $status ) {
31
		$this->status = $status;
32
	}
33
34
	public function set_excludes( Excludes $excludes ) {
35
		$this->excludes = $excludes;
36
	}
37
38
	public function run() {
39
40
		Path::get_instance()->cleanup();
41
42
		if ( 'file' !== $this->type ) {
43
			$this->backup_database();
44
		}
45
46
		if ( 'database' !== $this->type ) {
47
			$this->backup_files();
48
		}
49
50
		Path::get_instance()->cleanup();
51
52
	}
53
54
	public function backup_database() {
55
56
		if ( $this->status ) {
57
			$this->status->set_status( __( 'Backing up database...', 'backupwordpress' ) );
58
		}
59
60
		$database_backup_engines = apply_filters( 'hmbkp_database_backup_engines', array(
61
			new Mysqldump_Database_Backup_Engine,
62
			new IMysqldump_Database_Backup_Engine,
63
		) );
64
65
		// Set the file backup engine settings
66
		if (  $this->database_dump_filename ) {
67
			foreach ( $database_backup_engines as &$backup_engine ) {
68
				$backup_engine->set_backup_filename( $this->database_dump_filename );
69
			}
70
		}
71
72
		// Dump the database
73
		$database_dump = $this->perform_backup( $database_backup_engines );
74
75
		if ( is_a( $database_dump, __NAMESPACE__ . '\\Backup_Engine' ) ) {
76
			$this->database_dump_filepath = $database_dump->get_backup_filepath();
77
		}
78
79
		// Fire up the file backup engines
80
		$file_backup_engines = apply_filters( 'hmbkp_file_backup_engines', array(
81
			new Zip_File_Backup_Engine,
82
			new Zip_Archive_File_Backup_Engine,
83
		) );
84
85
		// Set the file backup engine settings
86
		foreach ( $file_backup_engines as &$backup_engine ) {
87
			$backup_engine->set_backup_filename( $this->backup_filename );
88
			$backup_engine->set_excludes( new Excludes( array( '*.zip', 'index.html', '.htaccess', '.*-running', '.files' ) ) );
89
		}
90
91
		// Zip up the database dump
92
		$root = Path::get_root();
93
		Path::get_instance()->set_root( Path::get_path() );
94
		$file_backup = $this->perform_backup( $file_backup_engines );
95
		Path::get_instance()->set_root( $root );
96
97
		if ( is_a( $file_backup, __NAMESPACE__ . '\\Backup_Engine' ) ) {
98
			$this->backup_filepath = $file_backup->get_backup_filepath();
99
		}
100
101
		// Delete the Database Backup now that we've zipped it up
102
		if ( file_exists( $this->database_dump_filepath ) ) {
103
			unlink( $this->database_dump_filepath );
104
		}
105
106
	}
107
108
	public function backup_files() {
109
110
		if ( $this->status ) {
111
			$this->status->set_status( __( 'Backing up files...', 'backupwordpress' ) );
112
		}
113
114
		// Fire up the file backup engines
115
		$backup_engines = apply_filters( 'hmbkp_file_backup_engines', array(
116
			new Zip_File_Backup_Engine,
117
			new Zip_Archive_File_Backup_Engine,
118
		) );
119
120
		// Set the file backup engine settings
121
		foreach ( $backup_engines as &$backup_engine ) {
122
			$backup_engine->set_backup_filename( $this->backup_filename );
123
			if ( $this->excludes ) {
124
				$backup_engine->set_excludes( $this->excludes );
125
			}
126
		}
127
128
		$file_backup = $this->perform_backup( $backup_engines );
129
130
		if ( is_a( $file_backup, __NAMESPACE__ . '\\Backup_Engine' ) ) {
131
			$this->backup_filepath = $file_backup->get_backup_filepath();
132
		}
133
134
	}
135
136
	/**
137
	 * Perform the backup by iterating through each Backup_Engine in turn until
138
	 * we find one which works. If a backup filename or any excludes have been
139
	 * set then those are passed to each Backup_Engine.
140
	 */
141
	public function perform_backup( array $backup_engines ) {
0 ignored issues
show
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
142
143
		foreach ( $backup_engines as $backup_engine ) {
144
145
			/**
146
			 * If the backup_engine completes the backup then we
147
			 * clear any errors or warnings from previously failed backup_engines
148
			 * and return the successful one.
149
			 */
150
			if ( $backup_engine->backup() ) {
151
				$this->errors = array();
152
				$this->warnings = $backup_engine->get_warnings();
153
				return $backup_engine;
154
			}
155
156
			// Store all the errors and warnings as they are shown if all engines fail
157
			$this->warnings = array_merge( $this->warnings, $backup_engine->get_warnings() );
158
			$this->errors   = array_merge( $this->errors, $backup_engine->get_errors() );
159
160
		}
161
162
		return false;
163
164
	}
165
166
	public function get_warnings() {
167
		return $this->warnings;
168
	}
169
170
	public function get_errors() {
171
		return $this->errors;
172
	}
173
174
	/**
175
	 * Add an warning to the errors warnings.
176
	 *
177
	 * A warning is always treat as non-fatal and should only be used for recoverable
178
	 * issues with the backup process.
179
	 *
180
	 * @param  string $context The context for the warning.
181
	 * @param  string $error   The warning that was encountered.
0 ignored issues
show
There is no parameter named $error. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
182
	 */
183 View Code Duplication
	public function warning( $context, $warning ) {
184
185
		if ( empty( $context ) || empty( $warning ) ) {
186
			return;
187
		}
188
189
		// Ensure we don't store duplicate warnings by md5'ing the error as the key
190
		$this->warnings[ $context ][ md5( implode( ':', (array) $warning ) ) ] = $warning;
191
192
	}
193
194
	/**
195
	 * Back compat with old error method
196
	 *
197
	 * Only the backup engines themselves can fire fatal errors
198
	 *
199
	 * @deprecated 3.4 Backup->warning( $context, $warning )
200
	 */
201
	public function error( $context, $message ) {
202
		_deprecated_function( __FUNCTION__, '3.4', 'Backup->warning( $context, $warning )' );
203
		$this->warning( $context, $message );
204
	}
205
206
	public function get_database_backup_filepath() {
207
		return $this->database_dump_filepath;
208
	}
209
210
	public function get_backup_filepath() {
211
		return $this->backup_filepath;
212
	}
213
214
	/**
215
	 * Back compat with old method name
216
	 *
217
	 * @see Backup::get_backup_filepath()
218
	 * @deprecated 3.4 Use Backup::get_backup_filepath()
219
	 */
220
	public function get_archive_filepath() {
221
		_deprecated_function( __FUNCTION__, '3.4', 'get_backup_filepath()' );
222
		return $this->get_backup_filepath();
223
	}
224
}
225