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/htmlform/fields/HTMLCheckField.php (1 issue)

Labels
Severity

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
 * A checkbox field
5
 */
6
class HTMLCheckField extends HTMLFormField {
7
	public function getInputHTML( $value ) {
8
		global $wgUseMediaWikiUIEverywhere;
9
10
		if ( !empty( $this->mParams['invert'] ) ) {
11
			$value = !$value;
12
		}
13
14
		$attr = $this->getTooltipAndAccessKey();
15
		$attr['id'] = $this->mID;
16
17
		$attr += $this->getAttributes( [ 'disabled', 'tabindex' ] );
18
19
		if ( $this->mClass !== '' ) {
20
			$attr['class'] = $this->mClass;
21
		}
22
23
		$attrLabel = [ 'for' => $this->mID ];
24
		if ( isset( $attr['title'] ) ) {
25
			// propagate tooltip to label
26
			$attrLabel['title'] = $attr['title'];
27
		}
28
29
		$chkLabel = Xml::check( $this->mName, $value, $attr ) .
0 ignored issues
show
It seems like $value defined by parameter $value on line 7 can also be of type string; however, Xml::check() does only seem to accept boolean, maybe add an additional type check?

This check looks at variables that have been passed in as parameters and are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
30
			'&#160;' .
31
			Html::rawElement( 'label', $attrLabel, $this->mLabel );
32
33
		if ( $wgUseMediaWikiUIEverywhere || $this->mParent instanceof VFormHTMLForm ) {
34
			$chkLabel = Html::rawElement(
35
				'div',
36
				[ 'class' => 'mw-ui-checkbox' ],
37
				$chkLabel
38
			);
39
		}
40
41
		return $chkLabel;
42
	}
43
44
	/**
45
	 * Get the OOUI version of this field.
46
	 * @since 1.26
47
	 * @param string $value
48
	 * @return OOUI\CheckboxInputWidget The checkbox widget.
49
	 */
50
	public function getInputOOUI( $value ) {
51
		if ( !empty( $this->mParams['invert'] ) ) {
52
			$value = !$value;
53
		}
54
55
		$attr = $this->getTooltipAndAccessKey();
56
		$attr['id'] = $this->mID;
57
		$attr['name'] = $this->mName;
58
59
		$attr += OOUI\Element::configFromHtmlAttributes(
60
			$this->getAttributes( [ 'disabled', 'tabindex' ] )
61
		);
62
63
		if ( $this->mClass !== '' ) {
64
			$attr['classes'] = [ $this->mClass ];
65
		}
66
67
		$attr['selected'] = $value;
68
		$attr['value'] = '1'; // Nasty hack, but needed to make this work
69
70
		return new OOUI\CheckboxInputWidget( $attr );
71
	}
72
73
	/**
74
	 * For a checkbox, the label goes on the right hand side, and is
75
	 * added in getInputHTML(), rather than HTMLFormField::getRow()
76
	 *
77
	 * ...unless OOUI is being used, in which case we actually return
78
	 * the label here.
79
	 *
80
	 * @return string
81
	 */
82
	public function getLabel() {
83
		if ( $this->mParent instanceof OOUIHTMLForm ) {
84
			return $this->mLabel;
85
		} elseif (
86
			$this->mParent instanceof HTMLForm &&
87
			$this->mParent->getDisplayFormat() === 'div'
88
		) {
89
			return '';
90
		} else {
91
			return '&#160;';
92
		}
93
	}
94
95
	/**
96
	 * Get label alignment when generating field for OOUI.
97
	 * @return string 'left', 'right', 'top' or 'inline'
98
	 */
99
	protected function getLabelAlignOOUI() {
100
		return 'inline';
101
	}
102
103
	/**
104
	 * checkboxes don't need a label.
105
	 * @return bool
106
	 */
107
	protected function needsLabel() {
108
		return false;
109
	}
110
111
	/**
112
	 * @param WebRequest $request
113
	 *
114
	 * @return bool
115
	 */
116
	public function loadDataFromRequest( $request ) {
117
		$invert = isset( $this->mParams['invert'] ) && $this->mParams['invert'];
118
119
		// GetCheck won't work like we want for checks.
120
		// Fetch the value in either one of the two following case:
121
		// - we have a valid submit attempt (form was just submitted, or a GET URL forged by the user)
122
		// - checkbox name has a value (false or true), ie is not null
123
		if ( $this->isSubmitAttempt( $request ) || $request->getVal( $this->mName ) !== null ) {
124
			return $invert
125
				? !$request->getBool( $this->mName )
126
				: $request->getBool( $this->mName );
127
		} else {
128
			return (bool)$this->getDefault();
129
		}
130
	}
131
}
132