GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (699)

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.

Sistema/Ayudantes/CFPHPSeguridad.php (7 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
/*
4
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
5
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
6
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
7
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
8
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
9
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
10
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
11
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
12
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
13
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
14
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15
 *
16
 * This software consists of voluntary contributions made by many individuals
17
 * and is licensed under the MIT license. For more information, see
18
 * @category   
19
 * @package    sistema/ayudantes
20
 * @copyright  Copyright (c) 2006 - 2014 webcol.net (http://www.webcol.net/calima)
21
 * @license	https://github.com/webcol/Calima/blob/master/LICENSE	MIT
22
 * @version	##BETA 1.0##, ##2014 - 2015##
23
 * <http://www.calimaframework.com>.
24
 */
25
26
namespace Sistema\Ayudantes;
27
28
class CFPHPSeguridad {
29
30
//Seguridad
31
    
32
    //xss funciones de mitigacion
33
    function xsseguro($texto,$encoding='UTF-8'){
34
       return htmlspecialchars($texto,ENT_QUOTES | ENT_HTML401,$encoding);
35
    }
36
    function xecho($texto){
37
       echo xsseguro($texto);
38
    }
39
    
40
    public function filtrarTexto($texto){
41
        return strip_tags($texto);
42
    }
43
    
44
     
45
    
46
    public function filtrarCaracteresEspeciales($texto){
47
        return htmlspecialchars($texto, ENT_QUOTES);
48
    }
49
    
50
    
51
    // Genracion de Cadenas Aleatorias
52
    function generarCadenaAleatoria($longitud = 10) {
0 ignored issues
show
The parameter $longitud is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
53
        $caracteres = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
54
        $longitudCaracteres = strlen($caracteres);
55
        $cadenaAleatoria = '';
56
        for ($i = 0; $i < $length; $i++) {
0 ignored issues
show
The variable $length does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
57
             $cadenaAleatoria .= $caracteres[rand(0, $longitudCaracteres - 1)];
58
        }
59
        return $cadenaAleatoria;
60
    }
61
    // encriptacion
62
    function cifrado($clave){
63
        $cfi=sha1(md5($clave));
64
        return $clave=Cf_KEY_MD5.$cfi;
65
    }
66
    // Protecion CSRF
67 View Code Duplication
    public function generoTokenDeFormulario($formulario) {
68
        $secreta =  Cf_CSRF_SECRET.$this->generarCadenaAleatoria();
69
        $sid = session_id();
70
        $token = md5($secreta.$sid.$formulario);
71
        return $token;
72
    }
73
    
74 View Code Duplication
    public function verificoTokenDeFormulario($formulario, $token) {
75
        $secreta =  Cf_CSRF_SECRET.$this->generarCadenaAleatoria();
76
        $sid = session_id();
77
        $correcta = md5($secreta.$sid.$formulario);
78
        return ($token == $correcta);
79
    }
80
    
81
    function obtenerDireccionIP(){
0 ignored issues
show
obtenerDireccionIP 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...
82
    if (!empty($_SERVER ['HTTP_CLIENT_IP'] ))
83
      $ip=$_SERVER ['HTTP_CLIENT_IP'];
84
    elseif (!empty($_SERVER ['HTTP_X_FORWARDED_FOR'] ))
85
      $ip=$_SERVER ['HTTP_X_FORWARDED_FOR'];
86
    else
87
      $ip=$_SERVER ['REMOTE_ADDR'];
88
89
    return $ip;
90
	}
91
	
92
    function restringirIp($ip){
93
        $ipCliente = $this->obtenerDireccionIP();
94
95
        if($ipCliente == $ip){
96
        return true;
97
        }
98
        else{
99
        header('location: http://www.tusitioweb/redireccion');
100
        exit;
0 ignored issues
show
Coding Style Compatibility introduced by
The method restringirIp() 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...
101
        }
102
    }
103
	
104
	function restringirConjuntoIps($ips){
105
    $ipCliente = obtenerDireccionIP();
106
107
    if (in_array($ipCliente,$ips)){
108
        return true;
109
    }
110
    else{
111
        header('location: http://direccion_envio_salida');
112
        exit;
0 ignored issues
show
Coding Style Compatibility introduced by
The method restringirConjuntoIps() 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...
113
    }
114
	}
115
	
116
	function restringirRango(){
117
    $ipCliente = obtenerDireccionIP();
118
119
    if(substr($ipCliente, 0, 8 ) == "150.214."){
120
        return true;
121
    }
122
    else{
123
        header('location: http://direccion_envio_salida');
124
        exit;
0 ignored issues
show
Coding Style Compatibility introduced by
The method restringirRango() 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...
125
    }
126
	}
127
        
128
        
129
    /**
130
 *
131
 * @strip injection chars from email headers
132
 *
133
 * @param string $string
0 ignored issues
show
There is no parameter named $string. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
134
 *
135
 * return string
136
 *
137
 */
138
function emailSeguro($cadena) {
139
     return  preg_replace( '((?:\n|\r|\t|%0A|%0D|%08|%09)+)i' , '', $cadena );
140
}
141
142
/*** example usage 
143
$from = "[email protected]
144
Cc:[email protected]";
145
146
if(strlen($from) < 100)
147
{
148
    $from = emailSeguro($from);
149
}***/
150
    
151
}