Issues (25)

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.

src/LegacyDeserializerFactory.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
namespace Wikibase\InternalSerialization;
4
5
use Deserializers\Deserializer;
6
use Deserializers\DispatchableDeserializer;
7
use Wikibase\DataModel\Entity\EntityIdParser;
8
use Wikibase\InternalSerialization\Deserializers\LegacyEntityDeserializer;
9
use Wikibase\InternalSerialization\Deserializers\LegacyEntityIdDeserializer;
10
use Wikibase\InternalSerialization\Deserializers\LegacyFingerprintDeserializer;
11
use Wikibase\InternalSerialization\Deserializers\LegacyItemDeserializer;
12
use Wikibase\InternalSerialization\Deserializers\LegacyPropertyDeserializer;
13
use Wikibase\InternalSerialization\Deserializers\LegacySiteLinkListDeserializer;
14
use Wikibase\InternalSerialization\Deserializers\LegacySnakDeserializer;
15
use Wikibase\InternalSerialization\Deserializers\LegacySnakListDeserializer;
16
use Wikibase\InternalSerialization\Deserializers\LegacyStatementDeserializer;
17
18
/**
19
 * Factory for constructing deserializers that implement handling for the legacy format.
20
 *
21
 * @since 1.0
22
 *
23
 * @license GPL-2.0-or-later
24
 * @author Jeroen De Dauw < [email protected] >
25
 */
26
class LegacyDeserializerFactory {
27
28
	/**
29
	 * @var Deserializer
30
	 */
31
	private $dataValueDeserializer;
32
33
	/**
34
	 * @var EntityIdParser
35
	 */
36
	private $idParser;
37
38 2
	public function __construct( Deserializer $dataValueDeserializer, EntityIdParser $idParser ) {
39 2
		$this->dataValueDeserializer = $dataValueDeserializer;
40 2
		$this->idParser = $idParser;
41 2
	}
42
43
	/**
44
	 * @return DispatchableDeserializer
45
	 */
46 1
	public function newEntityDeserializer() {
47 1
		return new LegacyEntityDeserializer(
48 1
			$this->newItemDeserializer(),
0 ignored issues
show
$this->newItemDeserializer() of type object<Deserializers\Deserializer> is not a sub-type of object<Deserializers\DispatchableDeserializer>. It seems like you assume a child interface of the interface Deserializers\Deserializer to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
49 1
			$this->newPropertyDeserializer()
0 ignored issues
show
$this->newPropertyDeserializer() of type object<Deserializers\Deserializer> is not a sub-type of object<Deserializers\DispatchableDeserializer>. It seems like you assume a child interface of the interface Deserializers\Deserializer to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
50
		);
51
	}
52
53
	/**
54
	 * @return Deserializer
55
	 */
56 1
	private function newItemDeserializer() {
57 1
		return new LegacyItemDeserializer(
58 1
			$this->newEntityIdDeserializer(),
59 1
			$this->newSiteLinkListDeserializer(),
60 1
			$this->newStatementDeserializer(),
61 1
			$this->newTermsDeserializer()
62
		);
63
	}
64
65
	/**
66
	 * @return Deserializer
67
	 */
68 1
	private function newPropertyDeserializer() {
69 1
		return new LegacyPropertyDeserializer(
70 1
			$this->newEntityIdDeserializer(),
71 1
			$this->newTermsDeserializer()
72
		);
73
	}
74
75
	/**
76
	 * @return Deserializer
77
	 */
78 1
	private function newEntityIdDeserializer() {
79 1
		return new LegacyEntityIdDeserializer( $this->idParser );
80
	}
81
82
	/**
83
	 * @return Deserializer
84
	 */
85 1
	private function newTermsDeserializer() {
86 1
		return new LegacyFingerprintDeserializer();
87
	}
88
89
	/**
90
	 * @return Deserializer
91
	 */
92 1
	private function newSiteLinkListDeserializer() {
93 1
		return new LegacySiteLinkListDeserializer();
94
	}
95
96
	/**
97
	 * @deprecated since 1.4 - use newStatementDeserializer instead
98
	 *
99
	 * @return Deserializer
100
	 */
101
	public function newClaimDeserializer() {
102
		return $this->newStatementDeserializer();
103
	}
104
105
	/**
106
	 * @return DispatchableDeserializer
107
	 */
108 1
	public function newStatementDeserializer() {
109 1
		return new LegacyStatementDeserializer(
110 1
			$this->newSnakDeserializer(),
111 1
			$this->newSnakListDeserializer()
112
		);
113
	}
114
115
	/**
116
	 * @return Deserializer
117
	 */
118 1
	public function newSnakListDeserializer() {
119 1
		return new LegacySnakListDeserializer( $this->newSnakDeserializer() );
120
	}
121
122
	/**
123
	 * @return Deserializer
124
	 */
125 2
	public function newSnakDeserializer() {
126 2
		return new LegacySnakDeserializer( $this->dataValueDeserializer );
127
	}
128
129
}
130