Issues (1401)

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.

repo/includes/Specials/SpecialSetLabel.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
namespace Wikibase\Repo\Specials;
4
5
use InvalidArgumentException;
6
use Wikibase\DataModel\Entity\EntityDocument;
7
use Wikibase\DataModel\Term\LabelsProvider;
8
use Wikibase\Lib\Store\EntityTitleLookup;
9
use Wikibase\Lib\Summary;
10
use Wikibase\Repo\ChangeOp\ChangeOps;
11
use Wikibase\Repo\CopyrightMessageBuilder;
12
use Wikibase\Repo\EditEntity\MediawikiEditEntityFactory;
13
use Wikibase\Repo\Store\EntityPermissionChecker;
14
use Wikibase\Repo\SummaryFormatter;
15
use Wikibase\Repo\WikibaseRepo;
16
17
/**
18
 * Special page for setting the label of a Wikibase entity.
19
 *
20
 * @license GPL-2.0-or-later
21
 * @author Bene* < [email protected] >
22
 */
23
class SpecialSetLabel extends SpecialModifyTerm {
0 ignored issues
show
There is one abstract method getName in this class; you could implement it, or declare this class as abstract.
Loading history...
24
25
	public function __construct(
26
		SpecialPageCopyrightView $copyrightView,
27
		SummaryFormatter $summaryFormatter,
28
		EntityTitleLookup $entityTitleLookup,
29
		MediawikiEditEntityFactory $editEntityFactory,
30
		EntityPermissionChecker $entityPermissionChecker
31
	) {
32
		parent::__construct(
33
			'SetLabel',
34
			$copyrightView,
35
			$summaryFormatter,
36
			$entityTitleLookup,
37
			$editEntityFactory,
38
			$entityPermissionChecker
39
		);
40
	}
41
42
	public static function factory(): self {
43
		$wikibaseRepo = WikibaseRepo::getDefaultInstance();
44
45
		$settings = $wikibaseRepo->getSettings();
46
		$copyrightView = new SpecialPageCopyrightView(
47
			new CopyrightMessageBuilder(),
48
			$settings->getSetting( 'dataRightsUrl' ),
49
			$settings->getSetting( 'dataRightsText' )
50
		);
51
52
		return new self(
53
			$copyrightView,
54
			$wikibaseRepo->getSummaryFormatter(),
55
			$wikibaseRepo->getEntityTitleLookup(),
56
			$wikibaseRepo->newEditEntityFactory(),
57
			$wikibaseRepo->getEntityPermissionChecker()
58
		);
59
	}
60
61
	public function doesWrites() {
62
		return true;
63
	}
64
65
	/**
66
	 * @see SpecialModifyTerm::validateInput
67
	 *
68
	 * @return bool
69
	 */
70
	protected function validateInput() {
71
		if ( !parent::validateInput() ) {
72
			return false;
73
		}
74
75
		return $this->getBaseRevision()->getEntity() instanceof LabelsProvider;
76
	}
77
78
	/**
79
	 * @see SpecialModifyTerm::getPostedValue()
80
	 *
81
	 * @return string|null
82
	 */
83
	protected function getPostedValue() {
84
		return $this->getRequest()->getVal( 'label' );
85
	}
86
87
	/**
88
	 * @see SpecialModifyTerm::getValue()
89
	 *
90
	 * @param EntityDocument $entity
91
	 * @param string $languageCode
92
	 *
93
	 * @throws InvalidArgumentException
94
	 * @return string
95
	 */
96
	protected function getValue( EntityDocument $entity, $languageCode ) {
97
		if ( !( $entity instanceof LabelsProvider ) ) {
98
			throw new InvalidArgumentException( '$entity must be a LabelsProvider' );
99
		}
100
101
		$labels = $entity->getLabels();
102
103
		if ( $labels->hasTermForLanguage( $languageCode ) ) {
104
			return $labels->getByLanguage( $languageCode )->getText();
105
		}
106
107
		return '';
108
	}
109
110
	/**
111
	 * @see SpecialModifyTerm::setValue()
112
	 *
113
	 * @param EntityDocument $entity
114
	 * @param string $languageCode
115
	 * @param string $value
116
	 *
117
	 * @return Summary
118
	 */
119
	protected function setValue( EntityDocument $entity, $languageCode, $value ) {
120
		$value = $value === '' ? null : $value;
121
		$summary = new Summary( 'wbsetlabel' );
122
123
		if ( $value === null ) {
124
			$changeOp = $this->termChangeOpFactory->newRemoveLabelOp( $languageCode );
125
		} else {
126
			$changeOp = $this->termChangeOpFactory->newSetLabelOp( $languageCode, $value );
127
		}
128
129
		$fingerprintChangeOp = $this->termChangeOpFactory->newFingerprintChangeOp( new ChangeOps( [ $changeOp ] ) );
130
131
		$this->applyChangeOp( $fingerprintChangeOp, $entity, $summary );
132
133
		return $summary;
134
	}
135
136
}
137