Issues (4122)

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/specials/SpecialNewimages.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
 * Implements Special:Newimages
4
 *
5
 * This program is free software; you can redistribute it and/or modify
6
 * it under the terms of the GNU General Public License as published by
7
 * the Free Software Foundation; either version 2 of the License, or
8
 * (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License along
16
 * with this program; if not, write to the Free Software Foundation, Inc.,
17
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18
 * http://www.gnu.org/copyleft/gpl.html
19
 *
20
 * @file
21
 * @ingroup SpecialPage
22
 */
23
24
class SpecialNewFiles extends IncludableSpecialPage {
25
	/** @var FormOptions */
26
	protected $opts;
27
28
	public function __construct() {
29
		parent::__construct( 'Newimages' );
30
	}
31
32
	public function execute( $par ) {
33
		$this->setHeaders();
34
		$this->outputHeader();
35
36
		$out = $this->getOutput();
37
		$this->addHelpLink( 'Help:New images' );
38
39
		$opts = new FormOptions();
40
41
		$opts->add( 'like', '' );
42
		$opts->add( 'showbots', false );
43
		$opts->add( 'hidepatrolled', false );
44
		$opts->add( 'limit', 50 );
45
		$opts->add( 'offset', '' );
46
47
		$opts->fetchValuesFromRequest( $this->getRequest() );
48
49
		if ( $par !== null ) {
50
			$opts->setValue( is_numeric( $par ) ? 'limit' : 'like', $par );
51
		}
52
53
		$opts->validateIntBounds( 'limit', 0, 500 );
54
55
		$this->opts = $opts;
56
57
		if ( !$this->including() ) {
58
			$this->setTopText();
59
			$this->buildForm();
60
		}
61
62
		$pager = new NewFilesPager( $this->getContext(), $opts );
63
64
		$out->addHTML( $pager->getBody() );
65
		if ( !$this->including() ) {
66
			$out->addHTML( $pager->getNavigationBar() );
67
		}
68
	}
69
70
	protected function buildForm() {
71
		$formDescriptor = [
72
			'like' => [
73
				'type' => 'text',
74
				'label-message' => 'newimages-label',
75
				'name' => 'like',
76
			],
77
78
			'showbots' => [
79
				'type' => 'check',
80
				'label-message' => 'newimages-showbots',
81
				'name' => 'showbots',
82
			],
83
84
			'hidepatrolled' => [
85
				'type' => 'check',
86
				'label-message' => 'newimages-hidepatrolled',
87
				'name' => 'hidepatrolled',
88
			],
89
90
			'limit' => [
91
				'type' => 'hidden',
92
				'default' => $this->opts->getValue( 'limit' ),
93
				'name' => 'limit',
94
			],
95
96
			'offset' => [
97
				'type' => 'hidden',
98
				'default' => $this->opts->getValue( 'offset' ),
99
				'name' => 'offset',
100
			],
101
		];
102
103
		if ( $this->getConfig()->get( 'MiserMode' ) ) {
104
			unset( $formDescriptor['like'] );
105
		}
106
107
		if ( !$this->getUser()->useFilePatrol() ) {
108
			unset( $formDescriptor['hidepatrolled'] );
109
		}
110
111
		$form = HTMLForm::factory( 'ooui', $formDescriptor, $this->getContext() )
0 ignored issues
show
Are you sure the assignment to $form is correct as \HTMLForm::factory('ooui...m()->displayForm(false) (which targets HTMLForm::displayForm()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
$form is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
112
			->setWrapperLegendMsg( 'newimages-legend' )
113
			->setSubmitTextMsg( 'ilsubmit' )
114
			->setMethod( 'get' )
115
			->prepareForm()
116
			->displayForm( false );
117
	}
118
119
	protected function getGroupName() {
120
		return 'changes';
121
	}
122
123
	/**
124
	 * Send the text to be displayed above the options
125
	 */
126 View Code Duplication
	function setTopText() {
127
		global $wgContLang;
128
129
		$message = $this->msg( 'newimagestext' )->inContentLanguage();
130
		if ( !$message->isDisabled() ) {
131
			$this->getOutput()->addWikiText(
132
				Html::rawElement( 'p',
133
					[ 'lang' => $wgContLang->getHtmlCode(), 'dir' => $wgContLang->getDir() ],
134
					"\n" . $message->plain() . "\n"
135
				),
136
				/* $lineStart */ false,
137
				/* $interface */ false
138
			);
139
		}
140
	}
141
}
142