Issues (5)

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/Entities/Video.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 Realshadow\Redtube\Entities;
4
5
use Illuminate\Support\Collection;
6
use JMS\Serializer\Annotation as JMS;
7
8
9
/**
10
 * Video
11
 *
12
 * @package Realshadow\Redtube\Entities
13
 * @author Lukáš Homza <[email protected]>
14
 *
15
 * @JMS\XmlRoot("video")
16
 */
17
class Video
18
{
19
20
    /**
21
     * @var int $id
22
     *
23
     * @JMS\XmlAttribute()
24
     * @JMS\Type("integer")
25
     * @JMS\SerializedName("video_id")
26
     */
27
    private $id;
28
29
    /**
30
     * @var string $duration
31
     *
32
     * @JMS\XmlAttribute()
33
     * @JMS\Type("string")
34
     * @JMS\SerializedName("duration")
35
     */
36
    private $duration;
37
38
    /**
39
     * @var int $views
40
     *
41
     * @JMS\XmlAttribute()
42
     * @JMS\Type("integer")
43
     * @JMS\SerializedName("views")
44
     */
45
    private $views;
46
47
    /**
48
     * @var int $rating
49
     *
50
     * @JMS\XmlAttribute()
51
     * @JMS\Type("double")
52
     * @JMS\SerializedName("rating")
53
     */
54
    private $rating;
55
56
    /**
57
     * @var int $ratings
58
     *
59
     * @JMS\XmlAttribute()
60
     * @JMS\Type("integer")
61
     * @JMS\SerializedName("ratings")
62
     */
63
    private $ratings;
64
65
    /**
66
     * @var string $url
67
     *
68
     * @JMS\XmlAttribute()
69
     * @JMS\Type("string")
70
     * @JMS\SerializedName("url")
71
     */
72
    private $url;
73
74
    /**
75
     * @var string $embedUrl
76
     *
77
     * @JMS\XmlAttribute()
78
     * @JMS\Type("string")
79
     * @JMS\SerializedName("embed_url")
80
     */
81
    private $embedUrl;
82
83
    /**
84
     * @var null|\DateTimeImmutable $publishDate
85
     *
86
     * @JMS\XmlAttribute()
87
     * @JMS\Type("string")
88
     * @JMS\SerializedName("publish_date")
89
     */
90
    private $publishDate;
91
92
    /**
93
     * @var string $title
94
     *
95
     * @JMS\XmlElement(cdata=true)
96
     * @JMS\Type("string")
97
     * @JMS\SerializedName("title")
98
     */
99
    private $title;
100
101
    /**
102
     * @var string $thumb
103
     *
104
     * @JMS\XmlAttribute()
105
     * @JMS\Type("string")
106
     * @JMS\SerializedName("thumb")
107
     */
108
    private $thumb;
109
110
    /**
111
     * @var string $defaultThumb
112
     *
113
     * @JMS\XmlAttribute()
114
     * @JMS\Type("string")
115
     * @JMS\SerializedName("default_thumb")
116
     */
117
    private $defaultThumb;
118
119
    /**
120
     * @var Collection $tags
121
     *
122
     * @JMS\Type("Realshadow\Redtube\Entities\Tags")
123
     * @JMS\SerializedName("tags")
124
     */
125
    private $tags;
126
127
    /**
128
     * @var Collection $stars
129
     *
130
     * @JMS\Type("Realshadow\Redtube\Entities\Stars")
131
     * @JMS\SerializedName("stars")
132
     */
133
    private $stars;
134
135
    /**
136
     * @var Collection $thumbnails
137
     *
138
     * @JMS\Type("Realshadow\Redtube\Entities\Thumbnails")
139
     * @JMS\SerializedName("thumbs")
140
     */
141
    private $thumbnails;
142
143
    /**
144
     * Normalizes nested data
145
     *
146
     * @JMS\PostDeserialize()
147
     */
148
    public function onPostDeserialize()
149
    {
150
        $this->publishDate = $this->publishDate !== '' ? new \DateTime($this->publishDate) : null;
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->publishDate !== '...is->publishDate) : null can also be of type object<DateTime>. However, the property $publishDate is declared as type null|object<DateTimeImmutable>. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
151
        $this->tags = $this->tags ? $this->tags->flatten() : new Collection;
152
        $this->stars = $this->stars ? $this->stars->flatten() : new Collection;
153
        $this->thumbnails = $this->thumbnails ? $this->thumbnails->flatten() : new Collection;
154
    }
155
156
    /**
157
     * @return int
158
     */
159
    public function getId()
160
    {
161
        return $this->id;
162
    }
163
164
    /**
165
     * @return string
166
     */
167
    public function getDuration()
168
    {
169
        return $this->duration;
170
    }
171
172
    /**
173
     * @return int
174
     */
175
    public function getViews()
176
    {
177
        return $this->views;
178
    }
179
180
    /**
181
     * @return int
182
     */
183
    public function getRating()
184
    {
185
        return $this->rating;
186
    }
187
188
    /**
189
     * @return int
190
     */
191
    public function getRatings()
192
    {
193
        return $this->ratings;
194
    }
195
196
    /**
197
     * @return string
198
     */
199
    public function getUrl()
200
    {
201
        return $this->url;
202
    }
203
204
    /**
205
     * @return string
206
     */
207
    public function getEmbedUrl()
208
    {
209
        return $this->embedUrl;
210
    }
211
212
    /**
213
     * @return \DateTimeImmutable|null
214
     */
215
    public function getPublishDate()
216
    {
217
        return $this->publishDate;
218
    }
219
220
    /**
221
     * @return string
222
     */
223
    public function getTitle()
224
    {
225
        return $this->title;
226
    }
227
228
    /**
229
     * @return string
230
     */
231
    public function getThumb()
232
    {
233
        return $this->thumb;
234
    }
235
236
    /**
237
     * @return string
238
     */
239
    public function getDefaultThumb()
240
    {
241
        return $this->defaultThumb;
242
    }
243
244
    /**
245
     * @return Collection
246
     */
247
    public function getTags()
248
    {
249
        return $this->tags;
250
    }
251
252
    /**
253
     * @return Collection
254
     */
255
    public function getStars()
256
    {
257
        return $this->stars;
258
    }
259
260
    /**
261
     * @return Collection
262
     */
263
    public function getThumbnails()
264
    {
265
        return $this->thumbnails;
266
    }
267
268
}
269