Issues (19)

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.

src/Application.php (2 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
namespace samsoncms\app\user;
3
4
use samson\activerecord\user;
5
6
/**
7
 * Class Application
8
 * @package samson\cms\web\user
9
 */
10
class Application extends \samsoncms\Application
11
{
12
    /** @var string Application name */
13
    public $name = 'Пользователь';
14
15
    /** Application description */
16
    public $description = 'Пользователи системы';
17
18
    /** @var string Application icon */
19
    public $icon = 'user';
20
21
    /** @var string Module identifier */
22
    protected $id = 'user';
23
24
    /** @var string Module identifier */
25
    protected $entity = '\samson\activerecord\user';
26
27
    /** @var string Form class */
28
    protected $formClassName = '\samsoncms\app\user\form\Form';
29
30
    /** Module initialization */
31
    public function init(array $params = array())
32
    {
33
        // Subscribe to input change event
34
        \samsonphp\event\Event::subscribe('samson.cms.input.change', array($this, 'inputUpdateHandler'));
35
    }
36
37
    /**
38
     * New entity creation generic controller action
39
     * @param int $parentID Parent identifier
40
     */
41
    public function __new($parentID = null)
42
    {
43
        /** @var user $entity */
44
        $entity = new $this->entity();
45
46
        // Persist
47
        $entity->group_id = 1;
48
        $entity->active = 1;
49
        $entity->confirmed = 1;
50
        $entity->save();
51
52
        // Go to correct form URL
53
        url()->redirect($this->system->module('cms')->baseUrl.'/'.$this->id . '/form/' . $entity->id);
54
    }
55
56
    /**
57
     * Input field saving handler
58
     * @param \samsonframework\orm\Record $object
59
     * @param string $param Field
60
     * @param string $previousValue Previous object field value
61
     * @param string $response Response
62
     */
63
    public function inputUpdateHandler(& $object, $param, $previousValue, $response = null)
0 ignored issues
show
The parameter $previousValue 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...
The parameter $response 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...
64
    {
65
        // Work only when event fired for User database record
66
        if ($object instanceof \samson\activerecord\user) {
67
            $social = $this->system->module('socialemail');
68
            $object->md5_email  = $param == 'email' ? md5($object->email) : $object->md5_email;
69
            $object->hash_email = $param == 'email' ? $social->hash($object->email) : $object->hash_email;
70
71
            $object->md5_password  = $param == 'hash_password' ? md5($object->hash_password) : $object->md5_password;
72
            $object->hash_password = $param == 'hash_password' ? $social->hash($object->hash_password) : $object->hash_password;
73
74
            // Refresh session user object on any field change
75
            /*$auth_user_id = unserialize($_SESSION[m('socialemail')->identifier()]);
76
            if ($auth_user_id['user_id'] == $object['user_id']) {
77
                m('socialemail')->update($object);
78
            }*/
79
        }
80
    }
81
    
82
    /**
83
     * User entity delete controller action
84
     * @param int $identifier Entity identifier
85
     * @return array Asynchronous response array
86
     */
87
    public function __async_remove2($identifier)
88
    {
89
        if (!dbQuery('material')->cond('UserID', $identifier)->cond('Active', 1)->first()) {
90
            return parent::__async_remove2($identifier);
91
        }
92
        else {
93
            return array('status' => 1, 'error_message' => t('Пока у этого пользователя есть материалы, его удаление невозможно.', true));
94
        }
95
    }
96
}
97