Issues (48)

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.

includes/SDImport.special.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
if (!defined('MEDIAWIKI')) { die(-1); } 
3
 
4
 
5
# Our SpecialPage
6
class SpecialSDImport extends SpecialPage {
7
	
8
	
9
	/**
10
	 * Constructor : initialise object
11
	 * Get data POSTed through the form and assign them to the object
12
	 * @param $request WebRequest : data posted.
13
	 */
14
	
15
	public function __construct($request = null) {
16
		parent::__construct('SDImport');   #The first argument must be the name of your special page
17
	
18
19
	}
20
	
21
	private static function getKeyOptionsWithBlank( $keys ) {
22
		
23
		global $wgContLang;
24
		
25
		$list_namespaces = array( "" => "" );
26
		
27
		foreach ( $keys as $key ) {
28
			
29
			$keyName = $wgContLang->getNsText( $key );
30
			
31
			$list_namespaces[ $keyName ] = $key;
32
		}
33
		
34
		return $list_namespaces;
35
	}
36
37
	
38
	/**
39
	 * Special page entry point
40
	 */
41
	public function execute($par) {
42
		global $wgOut;
43
		
44
		global $wgSDImportDataPage; // Configuration options
45
	
46
		$list_namespaces = self::getKeyOptionsWithBlank( array_keys( $wgSDImportDataPage ) );
47
	
48
		$wgOut->addModules( 'ext.sdimport' );
49
		$this->setHeaders();
50
	
51
		// TODO: We should handle request in the form in a better way. $wgRequest Check examples here: involved http://www.mediawiki.org/wiki/Category:Special_page_extensions
52
	
53
		# A formDescriptor for uploading stuff
54
		$formDescriptor = array(
55
	
56
			'fileupload' => array(
57
				'section' => 'upload',
58
				'label' => 'Upload file',
59
                'class' => 'HTMLTextField',
60
				'type' => 'file'
61
			),
62
			'separator' => array(
63
				'section' => 'upload',
64
				'type' => 'select',
65
				'label' => 'Separator',
66
				'options' => array(  "," => ",","{TAB}" => "{TAB}", ";" => ";" )
67
			),
68
			'delimiter' => array(
69
				'section' => 'upload',
70
				'type' => 'select',
71
				'label' => 'Delimiter',
72
				'options' => array( "\"" => "\"" , "'" => "'" )
73
			),
74
			'namespace' => array(
75
				'section' => 'upload',
76
				'type' => 'select',
77
				'label' => 'Namespace',
78
				'options' => $list_namespaces
79
			),
80
			'single' => [
81
				'section' => 'upload',
82
				'class' => 'HTMLCheckField',
83
				'label' => 'Single row mode',
84
				'default' => false,
85
			]		
86
87
		);
88
89
	
90
		$htmlForm = new HTMLForm( $formDescriptor, 'sdimport-form' );
91
	
92
		$htmlForm->setSubmitText( wfMessage('sdimport-form-submit-button')->text() ); # What text does the submit button display
93
		$htmlForm->setTitle( $this->getTitle() ); # You must call setTitle() on an HTMLForm
94
	
95
		/* We set a callback function */
96
		$htmlForm->setSubmitCallback( array( 'SpecialSDImport', 'processCSV' ) );
97
	
98
		$htmlForm->suppressReset(false); # Get back reset button
99
	
100
		$wgOut->addHTML( "<div id='sdintro' class='sdimport_section'>" );
101
		$wgOut->addHTML( wfMessage('sdimport-form-intro')->text() );			
102
		$wgOut->addHTML( "</div>" );
103
		$wgOut->addHTML( "<div id='sdform' class='sdimport_section'>" );
104
		$htmlForm->show(); # Displaying the form
105
		$wgOut->addHTML( "</div>" );
106
		$wgOut->addHTML( "<div id='sdpreview' class='hot handsontable htColumnHeaders sdimport_section'></div>" );
107
		//$wgOut->addHTML( "<div id='sdpreview' class='hot handsontable htColumnHeaders'></div>");
108
	}
109
	
110
	
111
	static function processCSV( $formData ) {
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
112
113
		// Everything handled via Javascript. Nothing done here...
114
		return true;
115
	}
116
	
117
}
118