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/GlobalUserInfo.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 GlobalUserInfo {
21
22
	/**
23
	 * Wiki class
24
	 *
25
	 * @var Wiki
26
	 * @access private
27
	 */
28
	private $wiki;
29
30
	/**
31
	 * Username
32
	 *
33
	 * @var string
34
	 * @access private
35
	 */
36
	private $pgUsername;
37
38
	/**
39
	 * Global groups member is a part of
40
	 *
41
	 * @var array
42
	 * @access private
43
	 */
44
	private $groups = array();
45
46
	/**
47
	 * Accounts that user has merged on other wikis
48
	 *
49
	 * @var array
50
	 * @access private
51
	 */
52
	private $merged = array();
53
54
	/**
55
	 * Accounts that are not attached to the global account
56
	 *
57
	 * @var array
58
	 * @access private
59
	 */
60
	private $unattached = array();
61
62
	/**
63
	 * Whether or not global account exists
64
	 *
65
	 * @var bool
66
	 * @access private
67
	 */
68
	private $exists = true;
69
70
	/**
71
	 * Date that global account was created
72
	 *
73
	 * @var string
74
	 * @access private
75
	 */
76
	private $registration;
77
78
	/**
79
	 * Global account ID
80
	 *
81
	 * @var int
82
	 * @access private
83
	 */
84
	private $id;
85
86
	/**
87
	 * Construction method for the GlobalUserInfo class
88
	 *
89
	 * @access public
90
	 * @param Wiki &$wikiClass The Wiki class object
91
	 * @param mixed $pgUsername Username
92
	 * @throws APIError
93
	 * @throws AssertFailure
94
	 * @throws DependencyError
95
	 * @throws LoggedOut
96
	 * @throws MWAPIError
97
	 */
98
	function __construct( Wiki &$wikiClass, $pgUsername ) {
99
100
		if( !array_key_exists( 'Central Auth', $wikiClass->get_extensions() ) ) {
101
			throw new DependencyError( "CentralAuth", "http://www.mediawiki.org/wiki/Extension:CentralAuth" );
102
		}
103
104
		$this->username = ucfirst( $pgUsername );
0 ignored issues
show
The property username does not seem to exist. Did you mean pgUsername?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
105
		$this->wiki = $wikiClass;
106
107
		$guiRes = $this->wiki->apiQuery(
108
			array(
109
				'action'  => 'query',
110
				'meta'    => 'globaluserinfo',
111
				'guiuser' => ucfirst( $pgUsername ),
112
				'guiprop' => 'groups|merged|unattached',
113
			), false, false
114
		);
115
116
		if( !isset( $guiRes['query']['globaluserinfo'] ) ) {
117
			$this->exists = false;
118
			if( isset( $guiRes['error'] ) && $guiRes['error']['code'] != 'guinosuchuser' ) {
119
				throw new MWAPIError($guiRes['error']);
120
			} elseif( @$guiRes['error']['code'] != 'guinosuchuser' ) {
121
				throw new MWAPIError(array('code' => 'UnknownError', 'info' => 'Unknown API Error'));
122
			}
123
		} else {
124
			$this->groups = $guiRes['query']['globaluserinfo']['groups'];
125
			$this->merged = $guiRes['query']['globaluserinfo']['merged'];
126
			$this->merged = $guiRes['query']['globaluserinfo']['unattached'];
127
			$this->id = $guiRes['query']['globaluserinfo']['id'];
128
			$this->registration = $guiRes['query']['globaluserinfo']['registration'];
129
		}
130
	}
131
132
	/**
133
	 * Returns the global account ID
134
	 *
135
	 * @return int
136
	 * @access public
137
	 */
138
	public function get_id() {
139
		return $this->id;
140
	}
141
142
	/**
143
	 * Returns the date that global account was created
144
	 *
145
	 * @return string
146
	 * @access public
147
	 */
148
	public function get_registration() {
149
		return $this->registration;
150
	}
151
152
	/**
153
	 * Returns the global groups member is a part of
154
	 *
155
	 * @return array
156
	 * @access public
157
	 */
158
	public function get_groups() {
159
		return $this->groups;
160
	}
161
162
	/**
163
	 * Returns the accounts that user has merged on other wikis
164
	 *
165
	 * @return array
166
	 * @access public
167
	 */
168
	public function get_merged() {
169
		return $this->merged;
170
	}
171
172
	/**
173
	 * Returns the accounts that are not attached to the global account
174
	 *
175
	 * @return array
176
	 * @access public
177
	 */
178
	public function get_unattached() {
179
		return $this->unattached;
180
	}
181
182
	/**
183
	 * Returns whether or not global account exists
184
	 *
185
	 * @return bool
186
	 * @access public
187
	 */
188
	public function get_exists() {
189
		return $this->unattached;
190
	}
191
192
}