Issues (1039)

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.

src/Entity/Entry.php (3 issues)

Severity

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 PlaygroundGame\Entity;
3
4
use Doctrine\ORM\Mapping as ORM;
5
use Doctrine\ORM\Mapping\HasLifecycleCallbacks;
6
use Doctrine\ORM\Mapping\PrePersist;
7
use Doctrine\ORM\Mapping\PreUpdate;
8
9
/**
10
 * An entry represent a game session.
11
 * @ORM\Entity @HasLifecycleCallbacks
12
 * @ORM\Table(name="game_entry")
13
 */
14
class Entry implements \JsonSerializable
15
{
16
    /**
17
     * @ORM\Id
18
     * @ORM\Column(type="integer");
19
     * @ORM\GeneratedValue(strategy="AUTO")
20
     */
21
    protected $id;
22
23
    /**
24
     * @ORM\ManyToOne(targetEntity="Game", cascade={"persist","remove"})
25
     * @ORM\JoinColumn(name="game_id", referencedColumnName="id", onDelete="CASCADE")
26
     **/
27
    protected $game;
28
29
    /**
30
     * @ORM\ManyToOne(targetEntity="PlaygroundUser\Entity\User")
31
     * @ORM\JoinColumn(name="user_id", referencedColumnName="user_id", onDelete="CASCADE")
32
     **/
33
    protected $user;
34
35
    /**
36
     * @ORM\Column(type="boolean", nullable=true)
37
     */
38
    protected $active = 1;
39
40
    /**
41
     * Has this entry been paid
42
     * @ORM\Column(type="boolean", nullable=true)
43
     */
44
    protected $paid = false;
45
46
    /**
47
     * The amount paid for this entry
48
     * @ORM\Column(name="paid_amount", type="integer", nullable=true)
49
     */
50
    protected $paidAmount = 0;
51
52
    /**
53
     * An entry marked as bonus means that it's not taken into account
54
     * in the limit calculation. It's offered, for example, when you share the game to a friend.
55
     *
56
     * @ORM\Column(type="boolean", nullable=true)
57
     */
58
    protected $bonus = 0;
59
60
    /**
61
     * @ORM\Column(type="integer", nullable=true)
62
     */
63
    protected $points;
64
    
65
    /**
66
     * @ORM\Column(type="string", length=255, nullable=true)
67
     */
68
    protected $ip;
69
70
    /**
71
     * @ORM\Column(type="string", length=255, nullable=true)
72
     */
73
    protected $geoloc;
74
    
75
    /**
76
     * @ORM\Column(name="anonymous_id", type="string", length=255, nullable=true)
77
     */
78
    protected $anonymousId;
79
    
80
    /**
81
     * This column hosts an id chosen by the admin in case of a game with "anonymous" participation :
82
     * This is a value chosen from the playerData (generally "email").
83
     *
84
     * @ORM\Column(name="anonymous_identifier", type="string", length=255, nullable=true)
85
     */
86
    protected $anonymousIdentifier;
87
    
88
    /**
89
     * @ORM\Column(name="player_data", type="text", nullable=true)
90
     */
91
    protected $playerData;
92
93
    /**
94
     * @ORM\Column(name="social_shares", type="text", nullable=true)
95
     */
96
    protected $socialShares;
97
    
98
    /**
99
     * Is this entry a winning one ?
100
     * @ORM\Column(type="boolean", nullable=true)
101
     */
102
    protected $winner = 0;
103
    
104
    /**
105
     * Is there a termsOptin on this entry ?
106
     * @ORM\Column(name="terms_optin", type="boolean", nullable=true)
107
     */
108
    protected $termsOptin;
109
    
110
    /**
111
     * Is this entry eligible to draw ?
112
     * @ORM\Column(type="boolean", nullable=true)
113
     */
114
    protected $drawable = 0;
115
116
    /**
117
     * @ORM\Column(type="datetime")
118
     */
119
    protected $created_at;
120
    
121
    /**
122
     * The step in the play (in a quiz for example : the nth question)
123
     * @ORM\Column(type="integer", nullable=true)
124
     */
125
    protected $step = 0;
126
127
    /**
128
     * @ORM\Column(type="datetime")
129
     */
130
    protected $updated_at;
131
132
    public function __construct()
133
    {
134
    }
135
136
    /** @PrePersist */
137
    public function createChrono()
138
    {
139
        $this->created_at = new \DateTime("now");
140
        $this->updated_at = new \DateTime("now");
141
    }
142
143
    /** @PreUpdate */
144
    public function updateChrono()
145
    {
146
        $this->updated_at = new \DateTime("now");
147
    }
148
149
    /**
150
     *
151
     * @return the $id
152
     */
153
    public function getId()
154
    {
155
        return $this->id;
156
    }
157
158
    /**
159
     *
160
     * @param field_type $id
161
     */
162
    public function setId($id)
163
    {
164
        $this->id = $id;
165
        
166
        return $this;
167
    }
168
169
    /**
170
     * @return the $game
171
     */
172
    public function getGame()
173
    {
174
        return $this->game;
175
    }
176
177
    /**
178
     * @param field_type $game
179
     */
180
    public function setGame($game)
181
    {
182
        $this->game = $game;
183
        
184
        return $this;
185
    }
186
187
    /**
188
     * @return the $user
189
     */
190
    public function getUser()
191
    {
192
        return $this->user;
193
    }
194
195
    /**
196
     * @param field_type $user
197
     */
198
    public function setUser($user)
199
    {
200
        $this->user = $user;
201
        
202
        return $this;
203
    }
204
205
    /**
206
     * @return integer $points
207
     */
208
    public function getPoints()
209
    {
210
        return $this->points;
211
    }
212
213
    /**
214
     * @param integer $points
215
     */
216
    public function setPoints($points)
217
    {
218
        $this->points = $points;
219
        
220
        return $this;
221
    }
222
223
    /**
224
     * @return the $ip
225
     */
226
    public function getIp()
227
    {
228
        return $this->ip;
229
    }
230
231
    /**
232
     * @param field_type $ip
233
     */
234
    public function setIp($ip)
235
    {
236
        $this->ip = $ip;
237
        
238
        return $this;
239
    }
240
241
    /**
242
     * @return the $geoloc
243
     */
244
    public function getGeoloc()
245
    {
246
        return $this->geoloc;
247
    }
248
249
    /**
250
     * @param field_type $geoloc
251
     */
252
    public function setGeoloc($geoloc)
253
    {
254
        $this->geoloc = $geoloc;
255
        
256
        return $this;
257
    }
258
259
    /**
260
     * @return the $anonymousId
261
     */
262
    public function getAnonymousId()
263
    {
264
        return $this->anonymousId;
265
    }
266
267
    /**
268
     * @param field_type $anonymousId
269
     */
270
    public function setAnonymousId($anonymousId)
271
    {
272
        $this->anonymousId = $anonymousId;
273
        
274
        return $this;
275
    }
276
277
    /**
278
     * @return the $anonymousIdentifier
279
     */
280
    public function getAnonymousIdentifier()
281
    {
282
        return $this->anonymousIdentifier;
283
    }
284
285
    /**
286
     * @param field_type $anonymousIdentifier
287
     */
288
    public function setAnonymousIdentifier($anonymousIdentifier)
289
    {
290
        $this->anonymousIdentifier = $anonymousIdentifier;
291
    }
292
293
    /**
294
     * @return the $playerData
295
     */
296
    public function getPlayerData()
297
    {
298
        return $this->playerData;
299
    }
300
301
    /**
302
     * @param field_type $playerData
303
     */
304
    public function setPlayerData($playerData)
305
    {
306
        $this->playerData = $playerData;
307
        
308
        return $this;
309
    }
310
311
    /**
312
     * @return the $socialShares
313
     */
314
    public function getSocialShares()
315
    {
316
        return $this->socialShares;
317
    }
318
319
    /**
320
     * @param field_type $socialShares
321
     */
322
    public function setSocialShares($socialShares)
323
    {
324
        $this->socialShares = $socialShares;
325
    }
326
327
    /**
328
     * @return boolean active
329
     */
330
    public function getActive()
331
    {
332
        return $this->active;
333
    }
334
335
    /**
336
     * @param boolean $active
337
     */
338
    public function setActive($active)
339
    {
340
        $this->active = $active;
0 ignored issues
show
Documentation Bug introduced by
The property $active was declared of type integer, but $active is of type boolean. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
341
        
342
        return $this;
343
    }
344
345
    /**
346
     * @return boolean paid
347
     */
348
    public function getPaid()
349
    {
350
        return $this->paid;
351
    }
352
353
    /**
354
     * @param boolean $paid
355
     */
356
    public function setPaid($paid)
357
    {
358
        $this->paid = $paid;
359
        
360
        return $this;
361
    }
362
363
    /**
364
     * @return integer paidAmount
365
     */
366
    public function getPaidAmount()
367
    {
368
        return $this->paidAmount;
369
    }
370
371
    /**
372
     * @param integer $paidAmount
373
     */
374
    public function setPaidAmount($paidAmount)
375
    {
376
        $this->paidAmount = $paidAmount;
377
        
378
        return $this;
379
    }
380
381
    /**
382
     * @return integer $step
383
     */
384
    public function getStep()
385
    {
386
        return $this->step;
387
    }
388
389
    /**
390
     * @param number $step
391
     */
392
    public function setStep($step)
393
    {
394
        $this->step = $step;
0 ignored issues
show
Documentation Bug introduced by
It seems like $step can also be of type double. However, the property $step is declared as type integer. 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...
395
    }
396
397
    /**
398
     * @return integer bonus
399
     */
400
    public function getBonus()
401
    {
402
        return $this->bonus;
403
    }
404
405
    /**
406
     * @param integer $bonus
407
     */
408
    public function setBonus($bonus)
409
    {
410
        $this->bonus = $bonus;
411
        
412
        return $this;
413
    }
414
415
    /**
416
     * @return integer status
417
     */
418
    public function getWinner()
419
    {
420
        return $this->winner;
421
    }
422
423
    /**
424
     * @param integer $winner
425
     */
426
    public function setWinner($winner)
427
    {
428
        $this->winner = $winner;
429
        
430
        return $this;
431
    }
432
    
433
    /**
434
     * @return integer $drawable
435
     */
436
    public function getDrawable()
437
    {
438
        return $this->drawable;
439
    }
440
441
    /**
442
     * @param number $drawable
443
     */
444
    public function setDrawable($drawable)
445
    {
446
        $this->drawable = $drawable;
0 ignored issues
show
Documentation Bug introduced by
It seems like $drawable can also be of type double. However, the property $drawable is declared as type integer. 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...
447
        
448
        return $this;
449
    }
450
451
    /**
452
     * @return the termsOptin
453
     */
454
    public function getTermsOptin()
455
    {
456
        return $this->termsOptin;
457
    }
458
    
459
    /**
460
     * @param field_type $termsOptin
461
     */
462
    public function setTermsOptin($termsOptin)
463
    {
464
        $this->termsOptin = $termsOptin;
465
        
466
        return $this;
467
    }
468
469
    /**
470
     * @return \DateTime $created_at
471
     */
472
    public function getCreatedAt()
473
    {
474
        return $this->created_at;
475
    }
476
477
    /**
478
     * @param \DateTime $created_at
479
     */
480
    public function setCreatedAt($created_at)
481
    {
482
        $this->created_at = $created_at;
483
        
484
        return $this;
485
    }
486
487
    /**
488
     * @return \DateTime $updated_at
489
     */
490
    public function getUpdatedAt()
491
    {
492
        return $this->updated_at;
493
    }
494
495
    /**
496
     * @param \DateTime $updated_at
497
     */
498
    public function setUpdatedAt($updated_at)
499
    {
500
        $this->updated_at = $updated_at;
501
        
502
        return $this;
503
    }
504
505
    /**
506
     * Convert the object to an array.
507
     *
508
     * @return array
509
     */
510
    public function getArrayCopy()
511
    {
512
        return get_object_vars($this);
513
    }
514
515
    /**
516
    * Convert the object to json.
517
    *
518
    * @return array
519
    */
520
    public function jsonSerialize()
521
    {
522
        return $this->getArrayCopy();
523
    }
524
525
    /**
526
     * Populate from an array.
527
     *
528
     * @param array $data
529
     */
530
    public function populate($data = array())
531
    {
532
    }
533
}
534