Issues (13)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  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.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  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.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  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.
  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.
  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.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
  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.
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  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.
  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.
  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.
  Header Injection
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.

default/app/models/user.php (1 issue)

1
<?php
2
3
/**
4
 * Clase para manejar los datos del usuario, tabla 'user'
5
 */
6
class User extends ActiveRecord
7
{
8
9
    /**
10
     * Guarda un usuario y sube la foto de un usuario.
11
     *
12
     * @param array $data Arreglo con los datos de usuario
13
     * @return boolean
14
     * @throws Exception
15
     */
16
    public function saveWithPhoto($data)
17
    {
18
        //Inicia la transacción
19
        $this->begin();
20
        //Intenta crear el usuario con los datos pasados
21
        if ($this->create($data)) {
22
            //Intenta subit y actualizar la foto
23
            if ($this->updatePhoto()) {
24
                //Se confirma la transacción
25
                $this->commit();
26
                return true;
27
            }
28
        }
29
30
        //Si alga falla se regresa la transacción
31
        $this->rollback();
32
        return false;
33
    }
34
35
    /**
36
     * Sube y actualiza la foto del usuario.
37
     *
38
     * @return boolean|null
39
     */
40
    public function updatePhoto()
41
    {
42
        //Intenta subir la foto que viene en el campo 'photo'
43
        if ($photo = $this->uploadPhoto('photo')) {
44
            //Modifica el campo photo del usuario y lo intenta actualizar
45
            $this->photo = $photo;
0 ignored issues
show
Bug Best Practice introduced by
The property photo does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
46
            return $this->update();
47
        }
48
    }
49
50
    /**
51
     * Sube la foto y retorna el nombre del archivo generado.
52
     *
53
     * @param string $imageField Nombre de archivo recibido por POST
54
     * @return string|false
55
     */
56
    public function uploadPhoto($imageField)
57
    {
58
        //Usamos el adapter 'image'
59
        $file = Upload::factory($imageField, 'image');
60
        //le asignamos las extensiones a permitir
61
        $file->setExtensions(array('jpg', 'png', 'gif', 'jpeg'));
62
        //Intenta subir el archivo
63
        if ($file->isUploaded()) {
64
            //Lo guarda usando un nombre de archivo aleatorio y lo retorna.
65
            return $file->saveRandom();
66
        }
67
        //Si falla al subir
68
        return false;
69
    }
70
}
71