Issues (341)

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.

Rule/Url.php (4 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
 * Part of the Joomla Framework Form Package
4
 *
5
 * @copyright  Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
6
 * @license    GNU General Public License version 2 or later; see LICENSE
7
 */
8
9
namespace Joomla\Form\Rule;
10
11
use Joomla\Form\Form;
12
use Joomla\Form\Rule;
13
use Joomla\String\StringHelper;
14
use Joomla\Uri\UriHelper;
15
use Joomla\Registry\Registry;
16
use SimpleXMLElement;
17
18
/**
19
 * Form Rule class for the Joomla Framework.
20
 *
21
 * @since       1.0
22
 * @deprecated  The joomla/form package is deprecated
23
 */
24
class Url extends Rule
0 ignored issues
show
Deprecated Code introduced by
The class Joomla\Form\Rule has been deprecated with message: The joomla/form package is deprecated

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
25
{
26
	/**
27
	 * Method to test an external url for a valid parts.
28
	 *
29
	 * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the <field /> tag for the form field object.
30
	 * @param   mixed             $value    The form field value to validate.
31
	 * @param   string            $group    The field name group control value. This acts as as an array container for the field.
32
	 *                                      For example if the field has name="foo" and the group value is set to "bar" then the
33
	 *                                      full field name would end up being "bar[foo]".
34
	 * @param   Registry          $input    An optional Registry object with the entire data set to validate against the entire form.
35
	 * @param   Form              $form     The form object for which the field is being tested.
36
	 *
37
	 * @return  boolean  True if the value is valid, false otherwise.
38
	 *
39
	 * @since   1.0
40
	 * @link    http://www.w3.org/Addressing/URL/url-spec.txt
41
	 * @see	    Jstring
42
	 */
43
	public function test(SimpleXMLElement $element, $value, $group = null, Registry $input = null, Form $form = null)
44
	{
45
		// If the field is empty and not required, the field is valid.
46
		$required = ((string) $element['required'] == 'true' || (string) $element['required'] == 'required');
47
48
		if (!$required && empty($value))
49
		{
50
			return true;
51
		}
52
53
		$urlParts = UriHelper::parse_url($value);
54
55
		// See http://www.w3.org/Addressing/URL/url-spec.txt
56
		// Use the full list or optionally specify a list of permitted schemes.
57
		if ($element['schemes'] == '')
58
		{
59
			$scheme = array('http', 'https', 'ftp', 'ftps', 'gopher', 'mailto', 'news', 'prospero', 'telnet', 'rlogin', 'tn3270', 'wais', 'url',
60
				'mid', 'cid', 'nntp', 'tel', 'urn', 'ldap', 'file', 'fax', 'modem', 'git');
61
		}
62
		else
63
		{
64
			$scheme = explode(',', $element['schemes']);
65
		}
66
67
		/*
68
		 * This rule is only for full URLs with schemes because parse_url does not parse
69
		 * accurately without a scheme.
70
		 * @see http://php.net/manual/en/function.parse-url.php
71
		 */
72
		if ($urlParts && !array_key_exists('scheme', $urlParts))
73
		{
74
			return false;
75
		}
76
77
		$urlScheme = (string) $urlParts['scheme'];
78
		$urlScheme = strtolower($urlScheme);
79
80
		if (in_array($urlScheme, $scheme) == false)
0 ignored issues
show
Coding Style Best Practice introduced by
It seems like you are loosely comparing two booleans. Considering using the strict comparison === instead.

When comparing two booleans, it is generally considered safer to use the strict comparison operator.

Loading history...
81
		{
82
			return false;
83
		}
84
85
		// For some schemes here must be two slashes.
86
		$scheme = array('http', 'https', 'ftp', 'ftps', 'gopher', 'wais', 'prospero', 'sftp', 'telnet', 'git');
87
88
		if (in_array($urlScheme, $scheme) && substr($value, strlen($urlScheme), 3) !== '://')
89
		{
90
			return false;
91
		}
92
93
		// The best we can do for the rest is make sure that the strings are valid UTF-8
94
		// and the port is an integer.
95 View Code Duplication
		if (array_key_exists('host', $urlParts) && !StringHelper::valid((string) $urlParts['host']))
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
96
		{
97
			return false;
98
		}
99
100
		if (array_key_exists('port', $urlParts) && !is_int((int) $urlParts['port']))
101
		{
102
			return false;
103
		}
104
105 View Code Duplication
		if (array_key_exists('path', $urlParts) && !StringHelper::valid((string) $urlParts['path']))
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
106
		{
107
			return false;
108
		}
109
110
		return true;
111
	}
112
}
113