Issues (165)

Security Analysis    no request data  

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.

Plugins/AbuseFilter.php (1 issue)

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
/**
4
 * This file is part of Peachy MediaWiki Bot API
5
 *
6
 * Peachy is free software: you can redistribute it and/or modify
7
 * it under the terms of the GNU General Public License as published by
8
 * the Free Software Foundation, either version 3 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
 */
19
20
class AbuseFilter {
21
22
	/**
23
	 * Wiki class
24
	 *
25
	 * @var Wiki
26
	 * @access private
27
	 */
28
	private $wiki;
29
30
	/**
31
	 * Construction method for the AbuseFilter class
32
	 *
33
	 * @access public
34
	 * @param Wiki &$wikiClass The Wiki class object
35
	 * @throws DependencyError
36
	 */
37
	public function __construct(Wiki &$wikiClass)
38
	{
39
		$this->wiki = $wikiClass;
40
41
		if( !array_key_exists( 'Abuse Filter', $wikiClass->get_extensions() ) ) {
42
			throw new DependencyError( "AbuseFilter", "http://www.mediawiki.org/wiki/Extension:AbuseFilter" );
0 ignored issues
show
'http://www.mediawiki.or.../Extension:AbuseFilter' is of type string, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
43
		}
44
	}
45
46
	/**
47
	 * Returns the abuse filter log
48
	 *
49
	 * @access public
50
	 * @param int $filter Filter ID. Default null
51
	 * @param string $user Show entries by this user. Default null
52
	 * @param string $title Show entries to this title. Default null
53
	 * @param int $limit Number of entries to retrieve. Defautl null
54
	 * @param string $start Timestamp to start at. Default null
55
	 * @param string $end Timestamp to end at. Default null
56
	 * @param string $dir Direction to list. Default older
57
	 * @param array $prop Properties to retrieve. Default array( 'ids', 'filter', 'user', 'ip', 'title', 'action', 'details', 'result', 'timestamp' )
58
	 * @return array
59
	 */
60
	public function abuselog( $filter = null, $user = null, $title = null, $limit = null, $start = null, $end = null, $dir = 'older', $prop = array(
61
		'ids', 'filter', 'user', 'ip', 'title', 'action', 'details', 'result', 'timestamp'
62
	) ) {
63
64
		$tArray = array(
65
			'prop'   => $prop,
66
			'_code'  => 'afl',
67
			'afldir' => $dir,
68
			'_limit' => $limit,
69
			'list'   => 'abuselog',
70
		);
71
72
		if( !is_null( $filter ) ) $tArray['aflfilter'] = $filter;
73
		if( !is_null( $user ) ) $tArray['afluser'] = $user;
74
		if( !is_null( $title ) ) $tArray['afltitle'] = $title;
75
		if( !is_null( $start ) ) $tArray['aflstart'] = $start;
76
		if( !is_null( $end ) ) $tArray['aflend'] = $end;
77
78
		pecho( "Getting abuse log...\n\n", PECHO_NORMAL );
79
80
		return $this->wiki->listHandler( $tArray );
81
	}
82
83
	/**
84
	 * Returns a list of all filters
85
	 *
86
	 * @access public
87
	 * @param int $start Filter ID to start at. Default null
88
	 * @param int $end Filter ID to end at. Default null
89
	 * @param string $dir Direction to list. Default newer
90
	 * @param bool $enabled Only list enabled filters. true => only enabled, false => only disabled, null => all
91
	 * @param bool $deleted Only list deleted filters. true => only deleted, false => only non-deleted, null => all
92
	 * @param bool $private Only list private filters. true => only private, false => only non-private, null => all
93
	 * @param int $limit Number of filters to get. Default null
94
	 * @param array $prop Properties to retrieve. Default array( 'id', 'description', 'pattern', 'actions', 'hits', 'comments', 'lasteditor', 'lastedittime', 'status', 'private' )
95
	 * @return array
96
	 */
97
	public function abusefilters( $start = null, $end = null, $dir = 'newer', $enabled = null, $deleted = false, $private = null, $limit = null, $prop = array(
98
		'id', 'description', 'pattern', 'actions', 'hits', 'comments', 'lasteditor', 'lastedittime', 'status', 'private'
99
	) ) {
100
101
		$tArray = array(
102
			'prop'    => $prop,
103
			'_code'   => 'abf',
104
			'abfdir'  => $dir,
105
			'_limit'  => $limit,
106
			'abfshow' => array(),
107
			'list'    => 'abusefilters'
108
		);
109
110
		if( !is_null( $enabled ) ) {
111
			if( $enabled ) {
112
				$tArray['abfshow'][] = 'enabled';
113
			} else {
114
				$tArray['abfshow'][] = '!enabled';
115
			}
116
		}
117
118
		if( !is_null( $deleted ) ) {
119
			if( $deleted ) {
120
				$tArray['abfshow'][] = 'deleted';
121
			} else {
122
				$tArray['abfshow'][] = '!deleted';
123
			}
124
		}
125
126
		if( !is_null( $private ) ) {
127
			if( $private ) {
128
				$tArray['abfshow'][] = 'private';
129
			} else {
130
				$tArray['abfshow'][] = '!private';
131
			}
132
		}
133
134
		$tArray['abfshow'] = implode( '|', $tArray['abfshow'] );
135
136
		if( !is_null( $start ) ) $tArray['abfstartid'] = $start;
137
		if( !is_null( $end ) ) $tArray['abfendid'] = $end;
138
139
		pecho( "Getting abuse filter list...\n\n", PECHO_NORMAL );
140
141
		return $this->wiki->listHandler( $tArray );
142
	}
143
144
145
}