Issues (80)

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/Models/Digital/Account.php (1 issue)

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
namespace Telefonica\Models\Digital;
4
5
use Pedreiro\Models\Base;
6
use Muleta\Traits\Models\ComplexRelationamentTrait;
7
use Integrations\Models\Integration;
8
use Telefonica\Models\Actors\Business;
9
10
class Account extends Base
11
{
12
    // use ComplexRelationamentTrait;
13
    
14
    // protected static $COMPLEX_RELATIONAMENT_MODELS = [
15
    //     \App\Models\Photo::class,
16
    //     \App\Models\Video::class
17
    // ];
18
19
    /**
20
     * The attributes that are mass assignable.
21
     *
22
     * @var array
23
     */
24
    protected $fillable = [
25
        'username',
26
        'password',
27
        'email',
28
        'customize_url',
29
        'status',
30
        'integration_id',
31
        'obs',
32
    ];
33
34
    protected $mappingProperties = array(
35
        'username' => [
36
            'type' => 'string',
37
            "analyzer" => "standard",
38
        ],
39
        'password' => [
40
            'type' => 'string',
41
            "analyzer" => "standard",
42
        ],
43
        'email' => [
44
            'type' => 'string',
45
            "analyzer" => "standard",
46
        ],
47
        'customize_url' => [
48
            'type' => 'string',
49
            "analyzer" => "standard",
50
        ],
51
        'integration_id' => [
52
            'type' => 'string',
53
            "analyzer" => "standard",
54
        ],
55
    );
56
    public $formFields = [
57
        [
58
            'name' => 'username',
59
            'label' => 'username',
60
            'type' => 'text'
61
        ],
62
        [
63
            'name' => 'password',
64
            'label' => 'password',
65
            'type' => 'text'
66
        ],
67
        [
68
            'name' => 'email',
69
            'label' => 'email',
70
            'type' => 'text'
71
        ],
72
        [
73
            'name' => 'customize_url',
74
            'label' => 'customize_url',
75
            'type' => 'text'
76
        ],
77
        // ['name' => 'init', 'label' => 'Inicio', 'type' => 'date'],
78
        // ['name' => 'end', 'label' => 'End', 'type' => 'date'],
79
        // [
80
        //     'name' => 'status',
81
        //     'label' => 'Status',
82
        //     'type' => 'checkbox'
83
        // ],
84
        [
85
            'name' => 'obs',
86
            'label' => 'Observations',
87
            'type' => 'textarea'
88
        ],
89
        ['name' => 'integration_id', 'label' => 'Integração', 'type' => 'select', 'relationship' => 'integration'],
90
        // ['name' => 'tags', 'label' => 'Tags', 'type' => 'select_multiple', 'relationship' => 'tags'],
91
    ];
92
93
    public $indexFields = [
94
        'username',
95
        'description',
96
        'password',
97
        'email',
98
        'customize_url',
99
        'integration_id',
100
        'obs'
101
    ];
102
    
103
    public function getUser()
104
    {
105
        return $this->username;
106
        return $this->email; // @todo
0 ignored issues
show
return $this->email; does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
107
    }
108
109
    public function getPassword()
110
    {
111
        return $this->password;
112
    }
113
114
115
    /**
116
     * Get all of the business that are assigned this tag.
117
     */
118
    public function business()
119
    {
120
        return $this->businesses();
121
    }
122
123
    /**
124
     * Get all of the businesses that are assigned this item.
125
     */
126
    public function businesses()
127
    {
128
        return $this->morphedByMany(\Illuminate\Support\Facades\Config::get('sitec-tools.models.business', \Telefonica\Models\Actors\Business::class), 'accountable');
129
    }
130
131
    /**
132
     * Get all of the users that are assigned this tag.
133
     */
134
    public function users()
135
    {
136
        return $this->morphedByMany(\Illuminate\Support\Facades\Config::get('sitec.core.models.user', \App\Models\User::class), 'accountable');
137
    }
138
139
    /**
140
     * Get all of the persons that are assigned this tag.
141
     */
142
    public function persons()
143
    {
144
        return $this->morphedByMany(\Illuminate\Support\Facades\Config::get('sitec.core.models.person', \Telefonica\Models\Actors\Person::class), 'accountable');
145
    }
146
147
    /**
148
     * Relation for the user that created this entity.
149
     *
150
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
151
     */
152
    public function integration()
153
    {
154
        return $this->belongsTo(Integration::class);
155
    }
156
157
158
    public function save(array $options = [])
159
    {
160
        // If no author has been assigned, assign the current user's id as the author of the post
161
        if (!$this->username || empty($this->username)) {
162
            $this->username = $this->email;
163
        }
164
165
        parent::save();
166
    }
167
168
    /**
169
     * Get all of the passwords that are assigned this tag.
170
     */
171
    public function passwords()
172
    {
173
        return $this->morphToMany(Password::class, 'passwordable');
174
    }
175
176
    public static function boot()
177
    {
178
        parent::boot();
179
180
        self::created(
181
            function ($model) {
182
                $pass = Password::firstOrCreate([
183
                    'value' => $model->password,
184
                ]);
185
                $model->passwords()->attach($pass);
186
            }
187
        );
188
189
    }
190
}
191