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/maintenance/dumpRdf.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
namespace Wikibase\Repo\Maintenance;
4
5
use MediaWiki\MediaWikiServices;
6
use Wikibase\DataModel\Services\Entity\EntityPrefetcher;
7
use Wikibase\DataModel\Services\EntityId\EntityIdPager;
8
use Wikibase\DataModel\Services\Lookup\PropertyDataTypeLookup;
9
use Wikibase\Lib\Store\EntityRevisionLookup;
10
use Wikibase\Lib\Store\EntityTitleLookup;
11
use Wikibase\Repo\Dumpers\DumpGenerator;
12
use Wikibase\Repo\Dumpers\RdfDumpGenerator;
13
use Wikibase\Repo\Rdf\EntityRdfBuilderFactory;
14
use Wikibase\Repo\Rdf\RdfVocabulary;
15
use Wikibase\Repo\Rdf\ValueSnakRdfBuilderFactory;
16
use Wikibase\Repo\Store\Sql\SqlEntityIdPagerFactory;
17
use Wikibase\Repo\WikibaseRepo;
18
use Wikimedia\Purtle\BNodeLabeler;
19
20
require_once __DIR__ . '/DumpEntities.php';
21
22
/**
23
 * @license GPL-2.0-or-later
24
 * @author Stas Malyshev
25
 * @author Addshore
26
 */
27
class DumpRdf extends DumpEntities {
28
29
	/**
30
	 * @var EntityRevisionLookup
31
	 */
32
	private $revisionLookup;
33
34
	/**
35
	 * @var EntityPrefetcher
36
	 */
37
	private $entityPrefetcher;
38
39
	/**
40
	 * @var PropertyDataTypeLookup
41
	 */
42
	private $propertyDatatypeLookup;
43
44
	/**
45
	 * @var ValueSnakRdfBuilderFactory
46
	 */
47
	private $valueSnakRdfBuilderFactory;
48
49
	/**
50
	 * @var EntityRdfBuilderFactory
51
	 */
52
	private $entityRdfBuilderFactory;
53
54
	/**
55
	 * @var RdfVocabulary
56
	 */
57
	private $rdfVocabulary;
58
59
	/**
60
	 * @var bool
61
	 */
62
	private $hasHadServicesSet = false;
63
64
	/**
65
	 * @var EntityTitleLookup
66
	 */
67
	private $titleLookup;
68
69
	public function __construct() {
70
		parent::__construct();
71
		$this->addOption( 'format', 'Set the dump format, such as "nt" or "ttl". Defaults to "ttl".', false, true );
72
		$this->addOption(
73
			'flavor',
74
			'Set the flavor to produce. Can be either "full-dump" or "truthy-dump". Defaults to "full-dump".',
75
			false,
76
			true
77
		);
78
		$this->addOption( 'redirect-only', 'Whether to only dump information about redirects.', false, false );
79
		$this->addOption( 'part-id', 'Unique identifier for this part of multi-part dump, to be used for marking bnodes.', false, true );
80
	}
81
82
	public function setServices(
83
		SqlEntityIdPagerFactory $sqlEntityIdPagerFactory,
84
		array $existingEntityTypes,
85
		array $entityTypesWithoutRdfOutput,
86
		EntityPrefetcher $entityPrefetcher,
87
		PropertyDataTypeLookup $propertyDataTypeLookup,
88
		ValueSnakRdfBuilderFactory $valueSnakRdfBuilderFactory,
89
		EntityRdfBuilderFactory $entityRdfBuilderFactory,
90
		EntityRevisionLookup $entityRevisionLookup,
91
		RdfVocabulary $rdfVocabulary,
92
		$titleLookup
93
	) {
94
		parent::setDumpEntitiesServices(
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (setDumpEntitiesServices() instead of setServices()). Are you sure this is correct? If so, you might want to change this to $this->setDumpEntitiesServices().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
95
			$sqlEntityIdPagerFactory,
96
			$existingEntityTypes,
97
			$entityTypesWithoutRdfOutput
98
		);
99
		$this->entityPrefetcher = $entityPrefetcher;
100
		$this->propertyDatatypeLookup = $propertyDataTypeLookup;
101
		$this->valueSnakRdfBuilderFactory = $valueSnakRdfBuilderFactory;
102
		$this->entityRdfBuilderFactory = $entityRdfBuilderFactory;
103
		$this->revisionLookup = $entityRevisionLookup;
104
		$this->rdfVocabulary = $rdfVocabulary;
105
		$this->titleLookup = $titleLookup;
106
		$this->hasHadServicesSet = true;
107
	}
108
109
	public function execute() {
110
		if ( !$this->hasHadServicesSet ) {
111
			$wikibaseRepo = WikibaseRepo::getDefaultInstance();
112
			$sqlEntityIdPagerFactory = new SqlEntityIdPagerFactory(
113
				$wikibaseRepo->getEntityNamespaceLookup(),
114
				$wikibaseRepo->getEntityIdLookup(),
115
				MediaWikiServices::getInstance()->getLinkCache()
116
			);
117
118
			$this->setServices(
119
				$sqlEntityIdPagerFactory,
120
				$wikibaseRepo->getEnabledEntityTypes(),
121
				$wikibaseRepo->getSettings()->getSetting( 'entityTypesWithoutRdfOutput' ),
122
				$wikibaseRepo->getStore()->getEntityPrefetcher(),
123
				$wikibaseRepo->getPropertyDataTypeLookup(),
124
				$wikibaseRepo->getValueSnakRdfBuilderFactory(),
125
				$wikibaseRepo->getEntityRdfBuilderFactory(),
126
				$wikibaseRepo->getEntityRevisionLookup( $this->getEntityRevisionLookupCacheMode() ),
127
				$wikibaseRepo->getRdfVocabulary(),
128
				$wikibaseRepo->getEntityContentFactory()
129
			);
130
		}
131
		parent::execute();
132
	}
133
134
	/**
135
	 * Returns one of the EntityIdPager::XXX_REDIRECTS constants.
136
	 *
137
	 * @return mixed a EntityIdPager::XXX_REDIRECTS constant
138
	 */
139
	protected function getRedirectMode() {
140
		$redirectOnly = $this->getOption( 'redirect-only', false );
141
142
		if ( $redirectOnly ) {
143
			return EntityIdPager::ONLY_REDIRECTS;
144
		} else {
145
			return EntityIdPager::INCLUDE_REDIRECTS;
146
		}
147
	}
148
149
	/**
150
	 * Create concrete dumper instance
151
	 *
152
	 * @param resource $output
153
	 *
154
	 * @return DumpGenerator
155
	 */
156
	protected function createDumper( $output ) {
157
		$flavor = $this->getOption( 'flavor', 'full-dump' );
158
		if ( !in_array( $flavor, [ 'full-dump', 'truthy-dump' ] ) ) {
159
			$this->fatalError( 'Invalid flavor: ' . $flavor );
160
		}
161
162
		$labeler = null;
163
		$partId = $this->getOption( 'part-id' );
164
		if ( $partId ) {
165
			$labeler = new BNodeLabeler( "genid{$partId}-" );
166
		}
167
168
		if ( $this->getOption( 'sharding-factor', 1 ) !== 1 ) {
169
			$shard = $this->getOption( 'shard', 0 );
170
			if ( !$labeler ) {
171
				// Mark this shard's bnodes with shard ID if not told otherwise
172
				$labeler = new BNodeLabeler( "genid{$shard}-" );
173
			}
174
		}
175
176
		return RdfDumpGenerator::createDumpGenerator(
177
			$this->getOption( 'format', 'ttl' ),
178
			$output,
179
			$flavor,
180
			$this->revisionLookup,
181
			$this->propertyDatatypeLookup,
182
			$this->valueSnakRdfBuilderFactory,
183
			$this->entityRdfBuilderFactory,
184
			$this->entityPrefetcher,
185
			$this->rdfVocabulary,
186
			$this->titleLookup,
187
			$labeler
188
		);
189
	}
190
191
}
192
193
$maintClass = DumpRdf::class;
194
require_once RUN_MAINTENANCE_IF_MAIN;
195