Issues (87)

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.

includes/class-delete.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
namespace DummyPress;
3
use DummyPress\Views\Users as Users;
4
5
/**
6
 * Class to handle deletion of test data for the plugin.
7
 *
8
 * @package    WordPress
9
 * @subpackage Evans
10
 * @author     Mike Selander
11
 */
12
class Delete {
13
14
	/**
15
	 * Delete all test content created ever.
16
	 *
17
	 * @access private
18
	 */
19
	public function delete_all_test_data() {
20
		$return = '';
21
22
		if ( ! $this->user_can_delete() ) {
23
			return;
24
		}
25
26
		$types = apply_filters( 'tc-types', array() );
27
28
		if ( ! empty( $types ) ) {
29
30
			foreach ( $types as $type ) {
31
32
				$class = 'DummyPress\Types\\' . ucwords( $type );
33
				$object = new $class();
34
35
				$return .= $object->delete_all();
36
37
			}
38
39
		}
40
41
		return $return;
42
43
	}
44
45
	/**
46
	 * Delete test data terms.
47
	 *
48
	 * This function will search for all terms of a particular taxonomy ($slug)
49
	 * and delete them all using a particular term_meta flag that we set when creating
50
	 * the posts. Validates the user first.
51
	 *
52
	 * @see WP_Query, wp_delete_post
53
	 *
54
	 * @param string $data Information about the type.
55
	 */
56
	public function delete_objects( $data ) {
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...
57
58
		// Make sure that the current user is logged in & has full permissions.
59
		if ( ! $this->user_can_delete() ) {
60
			return;
61
		}
62
63
		if ( empty( $data ) ) {
64
			return;
65
		}
66
67
		$type = 'DummyPress\Types\\' . ucwords( $data['type'] );
68
		$slug = $data['slug'];
69
70
		$object = new $type();
71
72
		return $object->delete( $slug );
73
74
	}
75
76
77
	/**
78
	 * Run some checks to make sure that our user is allowed to delete data.
79
	 *
80
	 * @see is_user_logged_in, current_user_can
81
	 */
82
	public function user_can_delete() {
83
84
		// User must be logged in
85
		if ( ! is_user_logged_in() ) {
86
			return false;
87
		}
88
89
		// User must have editor priveledges, at a minimum
90
		if ( ! current_user_can( 'delete_others_posts' ) ) {
0 ignored issues
show
This if statement, and the following return statement can be replaced with return (bool) current_us...'delete_others_posts');.
Loading history...
91
			return false;
92
		}
93
94
		// We passed all the checks, hooray!
95
		return true;
96
97
	}
98
99
100
}
101