Issues (4141)

Security Analysis    not enabled

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.

app/Config/routes.php (9 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
 * Routes configuration
4
 *
5
 * In this file, you set up routes to your controllers and their actions.
6
 * Routes are very important mechanism that allows you to freely connect
7
 * different URLs to chosen controllers and their actions (functions).
8
 *
9
 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
10
 * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
11
 *
12
 * Licensed under The MIT License
13
 * For full copyright and license information, please see the LICENSE.txt
14
 * Redistributions of files must retain the above copyright notice.
15
 *
16
 * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
17
 * @link          http://cakephp.org CakePHP(tm) Project
18
 * @package       app.Config
19
 * @since         CakePHP(tm) v 0.2.9
20
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
21
 */
22
/**
23
 * Here, we are connecting '/' (base path) to controller called 'Pages',
24
 * its action called 'display', and we pass a param to select the view file
25
 * to use (in this case, /app/View/Pages/home.ctp)...
26
 */
27
	//Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
28
/**
29
 * ...and connect the rest of 'Pages' controller's URLs.
30
 */
31
	//Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
32
	
33
	$dominio = verificar_dominio();
34
35
	if ($dominio['is_winners']) {
36
		Router::connect('/', array('controller' => 'home', 'action' => 'index'));
37
	} else {
38
		Router::connect('/', array('controller' => $dominio['controller'], 'action' => $dominio['funcao']));
39
	}
40
41
	$caminho = APP . 'Config/routesshop.php';
42
	
43
	Router::connect('/servicos', array('controller' => 'home', 'action', 'servicos'));
44
	Router::connect('/linha-do-tempo-winners-opensource', array('controller' => 'home', 'action' => 'timeline'));
45
	Router::connect('/canal-para-desenvolvedores-winners', array('controller' => 'home', 'action' => 'developers'));
46
	Router::connect('/clientes-erp-ecommerce-software-sob-medida-winners', array('controller' => 'home', 'action' => 'cases'));
47
	Router::connect('/quero-saber-como-funciona-winners-opensource', array('controller' => 'home', 'action' => 'contact'));
48
	
49
	require($caminho);
50
/**
51
 * Load all plugin routes. See the CakePlugin documentation on
52
 * how to customize the loading of plugin routes.
53
 */
54
	CakePlugin::routes();
55
56
/**
57
 * Load the CakePHP default routes. Only remove this if you do not want to use
58
 * the built-in default routes.
59
 */
60
	require CAKE . 'Config' . DS . 'routes.php';
61
/**
62
 * Função para verificar se o dominio pentece ao site, caso não pertença redireciona ao site correto 
63
 */
64
	function verificar_dominio() {
0 ignored issues
show
verificar_dominio uses the super-global variable $_SERVER which is generally not recommended.

Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable:

// Bad
class Router
{
    public function generate($path)
    {
        return $_SERVER['HOST'].$path;
    }
}

// Better
class Router
{
    private $host;

    public function __construct($host)
    {
        $this->host = $host;
    }

    public function generate($path)
    {
        return $this->host.$path;
    }
}

class Controller
{
    public function myAction(Request $request)
    {
        // Instead of
        $page = isset($_GET['page']) ? intval($_GET['page']) : 1;

        // Better (assuming you use the Symfony2 request)
        $page = $request->query->get('page', 1);
    }
}
Loading history...
65
		$dominiosWinners = array (
66
			'winners.local',
67
			'blog.winnersdesenvolvimento.com.br',
68
			'ciawn.com.br',
69
			'www.ciawn.com.br',
70
			'api.ciawn.com.br',
71
			'winnersopensource.herokuapp.com'
72
		);
73
74
		$dominiosWinnersRedirect = array(
75
			'www.winnersdesenvolvimento.com.br',
76
			'winnersdesenvolvimento.com.br',
77
		);
78
79
		$varDominio = $_SERVER['SERVER_NAME'];
80
		
81
		if (array_search($varDominio, $dominiosWinnersRedirect) !== false || $varDominio == "ciawn.com.br") {
82
			header('Location: http://www.ciawn.com.br');
83
			exit();
0 ignored issues
show
Coding Style Compatibility introduced by
The function verificar_dominio() contains an exit expression.

An exit expression should only be used in rare cases. For example, if you write a short command line script.

In most cases however, using an exit expression makes the code untestable and often causes incompatibilities with other libraries. Thus, unless you are absolutely sure it is required here, we recommend to refactor your code to avoid its usage.

Loading history...
84
		}
85
86
		if (array_search($varDominio, $dominiosWinners) !== false) {
87
			$retorno['is_winners'] = true;
0 ignored issues
show
Coding Style Comprehensibility introduced by
$retorno was never initialized. Although not strictly required by PHP, it is generally a good practice to add $retorno = array(); before regardless.

Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code.

Let’s take a look at an example:

foreach ($collection as $item) {
    $myArray['foo'] = $item->getFoo();

    if ($item->hasBar()) {
        $myArray['bar'] = $item->getBar();
    }

    // do something with $myArray
}

As you can see in this example, the array $myArray is initialized the first time when the foreach loop is entered. You can also see that the value of the bar key is only written conditionally; thus, its value might result from a previous iteration.

This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop.

Loading history...
88
89
			return $retorno;
90
		}
91
		
92
		if ($varDominio == "fastshipping.ciawn.com.br")
93
		{
94
			header('Location: https://fastshipping.ciawn.com.br');
95
			exit();
0 ignored issues
show
Coding Style Compatibility introduced by
The function verificar_dominio() contains an exit expression.

An exit expression should only be used in rare cases. For example, if you write a short command line script.

In most cases however, using an exit expression makes the code untestable and often causes incompatibilities with other libraries. Thus, unless you are absolutely sure it is required here, we recommend to refactor your code to avoid its usage.

Loading history...
96
		}
97
		
98
		$caminho = APP . 'Config/Domain/' . $varDominio . '.php';
99
		if (!file_exists($caminho))
100
		{
101
			$retorno['is_winners'] = true;
0 ignored issues
show
Coding Style Comprehensibility introduced by
$retorno was never initialized. Although not strictly required by PHP, it is generally a good practice to add $retorno = array(); before regardless.

Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code.

Let’s take a look at an example:

foreach ($collection as $item) {
    $myArray['foo'] = $item->getFoo();

    if ($item->hasBar()) {
        $myArray['bar'] = $item->getBar();
    }

    // do something with $myArray
}

As you can see in this example, the array $myArray is initialized the first time when the foreach loop is entered. You can also see that the value of the bar key is only written conditionally; thus, its value might result from a previous iteration.

This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop.

Loading history...
102
			return $retorno;
103
		}
104
		
105
		require($caminho);
106
107
		$retorno['is_winners'] = false;
0 ignored issues
show
Coding Style Comprehensibility introduced by
$retorno was never initialized. Although not strictly required by PHP, it is generally a good practice to add $retorno = array(); before regardless.

Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code.

Let’s take a look at an example:

foreach ($collection as $item) {
    $myArray['foo'] = $item->getFoo();

    if ($item->hasBar()) {
        $myArray['bar'] = $item->getBar();
    }

    // do something with $myArray
}

As you can see in this example, the array $myArray is initialized the first time when the foreach loop is entered. You can also see that the value of the bar key is only written conditionally; thus, its value might result from a previous iteration.

This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop.

Loading history...
108
		$retorno['id_usuario'] = $dominio['id_usuario'];
0 ignored issues
show
The variable $dominio does not exist. Did you mean $dominiosWinners?

This check looks for variables that are accessed but have not been defined. It raises an issue if it finds another variable that has a similar name.

The variable may have been renamed without also renaming all references.

Loading history...
109
		$retorno['controller'] = $dominio['controller'];
0 ignored issues
show
The variable $dominio does not exist. Did you mean $dominiosWinners?

This check looks for variables that are accessed but have not been defined. It raises an issue if it finds another variable that has a similar name.

The variable may have been renamed without also renaming all references.

Loading history...
110
		$retorno['funcao']	   = $dominio['funcao'];
0 ignored issues
show
The variable $dominio does not exist. Did you mean $dominiosWinners?

This check looks for variables that are accessed but have not been defined. It raises an issue if it finds another variable that has a similar name.

The variable may have been renamed without also renaming all references.

Loading history...
111
112
		return $retorno;
113
	}