Issues (92)

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/Models/Photo.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
3
namespace App\Models;
4
5
use Sofa\Eloquence\Eloquence;
6
use Sofa\Eloquence\Mappable;
7
8
/**
9
 * Class Photo.
10
 */
11
class Photo extends ChocolateyModel
12
{
13
    use Eloquence, Mappable;
14
15
    /**
16
     * The table associated with the model.
17
     *
18
     * @var string
19
     */
20
    protected $table = 'camera_web';
21
22
    /**
23
     * Primary Key of the Table.
24
     *
25
     * @var string
26
     */
27
    protected $primaryKey = 'id';
28
29
    /**
30
     * The attributes that will be mapped.
31
     *
32
     * @var array
33
     */
34
    protected $maps = ['creator_id' => 'user_id', 'previewUrl' => 'url', 'creator_uniqueId' => 'user_id', 'time' => 'timestamp'];
35
36
    /**
37
     * The Appender(s) of the Model.
38
     *
39
     * @var array
40
     */
41
    protected $appends = ['creator_uniqueId', 'version', 'previewUrl', 'creator_id', 'likes', 'tags', 'version', 'type', 'room_id', 'creator_name'];
42
43
    /**
44
     * The attributes that should be casted to native types.
45
     *
46
     * @var array
47
     */
48
    protected $casts = ['tags' => 'array', 'creator_uniqueId' => 'string'];
49
50
    /**
51
     * Get the Unique Id of the Photo.
52
     *
53
     * @return string
54
     */
55
    public function getIdAttribute(): string
56
    {
57
        return (string) $this->attributes['id'];
58
    }
59
60
    /**
61
     * Get the URL of the Photo.
62
     *
63
     * @return string
64
     */
65
    public function getUrlAttribute(): string
66
    {
67
        return str_replace('http:', '', str_replace('https:', '', $this->attributes['url']));
68
    }
69
70
    /**
71
     * Get the Version Attribute.
72
     *
73
     * @return int
74
     */
75
    public function getVersionAttribute(): int
76
    {
77
        return 1;
78
    }
79
80
    /**
81
     * Get All Tags
82
     * Transforming it on an Array.
83
     *
84
     * @return array(string)
0 ignored issues
show
The doc-type array(string) could not be parsed: Expected "|" or "end of type", but got "(" at position 5. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
85
     */
86
    public function getTagsAttribute(): array
87
    {
88
        return [];
89
    }
90
91
    /**
92
     * Get Formatted Time
93
     * Convert Date to UNIX Timestamp.
94
     *
95
     * @return int
96
     */
97
    public function getTimeAttribute(): int
98
    {
99
        return strtotime($this->attributes['timestamp']) * 1000;
100
    }
101
102
    /**
103
     * Get Photo Likes Directly as Username.
104
     *
105
     * @return array
106
     */
107
    public function getLikesAttribute(): array
108
    {
109
        return array_map(function (array $item) {
110
            return $item['username'];
111
        }, PhotoLike::query()->select('username')->where('photo_id', $this->attributes['id'])->get(['username'])->toArray());
0 ignored issues
show
The method select() does not exist on Illuminate\Database\Eloquent\Builder. Did you maybe mean createSelectWithConstraint()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
112
    }
113
114
    /**
115
     * Get the Photo Type Attribute.
116
     *
117
     * @return string
118
     */
119
    public function getTypeAttribute(): string
120
    {
121
        return 'PHOTO';
122
    }
123
124
    /**
125
     * Get Room Id.
126
     *
127
     * @TODO: Add real RoomID
128
     *
129
     * @return int
130
     */
131
    public function getRoomIdAttribute(): int
132
    {
133
        return 1;
134
    }
135
136
    /**
137
     * Get User Name.
138
     *
139
     * @return string
140
     */
141
    public function getCreatorNameAttribute(): string
142
    {
143
        return User::find($this->attributes['user_id'])->name;
144
    }
145
}
146