Issues (31)

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/AppBundle/Entity/Project.php (3 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 declare(strict_types=1);
2
3
/**
4
 * This file is part of Packy.
5
 *
6
 * (c) Peter Nijssen
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace AppBundle\Entity;
13
14
use Doctrine\Common\Collections\ArrayCollection;
15
use Doctrine\Common\Collections\Collection;
16
17
class Project
18
{
19
    /**
20
     * @var int
21
     */
22
    private $id;
23
24
    /**
25
     * @var string
26
     */
27
    private $name;
28
29
    /**
30
     * @var string
31
     */
32
    private $description;
33
34
    /**
35
     * @var string
36
     */
37
    private $repositoryUrl;
38
39
    /**
40
     * @var string
41
     */
42
    private $repositoryType;
43
44
    /**
45
     * @var string
46
     */
47
    private $vendorName;
48
49
    /**
50
     * @var string
51
     */
52
    private $packageName;
53
54
    /**
55
     * @var string
56
     */
57
    private $branch;
58
59
    /**
60
     * @var \DateTime
61
     */
62
    private $createdAt;
63
64
    /**
65
     * @var \DateTime
66
     */
67
    private $updatedAt;
68
69
    /**
70
     * @var \DateTime
71
     */
72
    private $deletedAt;
73
74
    /**
75
     * @var Collection
76
     */
77
    private $dependencies;
78
79
    /**
80
     * Constructor.
81
     */
82
    public function __construct()
83
    {
84
        $this->dependencies = new ArrayCollection();
85
    }
86
87
    /**
88
     * Get id.
89
     *
90
     * @return int
91
     */
92
    public function getId(): int
93
    {
94
        return $this->id;
95
    }
96
97
    /**
98
     * Set name.
99
     *
100
     * @param string $name
101
     */
102
    public function setName(string $name)
103
    {
104
        $this->name = $name;
105
    }
106
107
    /**
108
     * Get name.
109
     *
110
     * @return string
111
     */
112
    public function getName(): string
113
    {
114
        return $this->name;
115
    }
116
117
    /**
118
     * Set description.
119
     *
120
     * @param string $description
121
     */
122
    public function setDescription(string $description)
123
    {
124
        $this->description = $description;
125
    }
126
127
    /**
128
     * Get description.
129
     *
130
     * @return string
131
     */
132
    public function getDescription(): string
133
    {
134
        return $this->description;
135
    }
136
137
    /**
138
     * Set repositoryUrl.
139
     *
140
     * @param string $repositoryUrl
141
     */
142
    public function setRepositoryUrl(string $repositoryUrl)
143
    {
144
        $this->repositoryUrl = $repositoryUrl;
145
    }
146
147
    /**
148
     * Get repositoryUrl.
149
     *
150
     * @return string
151
     */
152
    public function getRepositoryUrl(): string
153
    {
154
        return $this->repositoryUrl;
155
    }
156
157
    /**
158
     * Add dependencies.
159
     *
160
     * @TODO: Refactor
161
     *
162
     * @param Dependency $dependency
163
     */
164
    public function addDependency(Dependency $dependency)
165
    {
166
        $dependency->setProject($this);
167
168
        foreach ($this->dependencies as $k => $dep) {
169
            if ($dep->getPackage()->getName() == $dependency->getPackage()->getName()) {
170
                $dep->setCurrentVersion($dependency->getCurrentVersion());
171
                $dep->setRawVersion($dependency->getRawVersion());
172
                $dep->setRawVersion($dependency->getRawVersion());
173
174
                return $this;
175
            }
176
        }
177
178
        $this->dependencies[] = $dependency;
179
    }
180
181
    /**
182
     * Remove dependencies.
183
     *
184
     * @param Dependency $dependency
185
     */
186
    public function removeDependency(Dependency $dependency)
187
    {
188
        $this->dependencies->removeElement($dependency);
189
    }
190
191
    /**
192
     * Get dependencies.
193
     *
194
     * @return Collection
195
     */
196
    public function getDependencies(): Collection
197
    {
198
        return $this->dependencies;
199
    }
200
201
    /**
202
     * Set repositoryType.
203
     *
204
     * @param string $repositoryType
205
     */
206
    public function setRepositoryType(string $repositoryType)
207
    {
208
        $this->repositoryType = $repositoryType;
209
    }
210
211
    /**
212
     * Get repositoryType.
213
     *
214
     * @return string
215
     */
216
    public function getRepositoryType(): string
217
    {
218
        return $this->repositoryType;
219
    }
220
221
    /**
222
     * Set vendorName.
223
     *
224
     * @param string $vendorName
225
     */
226
    public function setVendorName($vendorName)
227
    {
228
        $this->vendorName = $vendorName;
229
    }
230
231
    /**
232
     * Get vendorName.
233
     *
234
     * @return string
235
     */
236
    public function getVendorName(): string
237
    {
238
        return $this->vendorName;
239
    }
240
241
    /**
242
     * Set packageName.
243
     *
244
     * @param string $packageName
245
     */
246
    public function setPackageName(string $packageName)
247
    {
248
        $this->packageName = $packageName;
249
    }
250
251
    /**
252
     * Get packageName.
253
     *
254
     * @return string
255
     */
256
    public function getPackageName(): string
257
    {
258
        return $this->packageName;
259
    }
260
261
    /**
262
     * Set branch.
263
     *
264
     * @param string $branch
265
     */
266
    public function setBranch(string $branch)
267
    {
268
        $this->branch = $branch;
269
    }
270
271
    /**
272
     * Get branch.
273
     *
274
     * @return string
275
     */
276
    public function getBranch(): string
277
    {
278
        return $this->branch;
279
    }
280
281
    /**
282
     * Get the total stats.
283
     *
284
     * @todo: Refactor into a service
285
     *
286
     * @return array
287
     */
288
    public function getTotalStats(): array
289
    {
290
        $stats = ['unstable' => 0, 'stable' => 0, 'outdated' => 0];
291
292
        foreach ($this->getDependencies() as $dependency) {
293
            $stats[$dependency->getStatus()] += 1;
294
        }
295
296
        return $stats;
297
    }
298
299
    /**
300
     * Set createdAt.
301
     *
302
     * @param \DateTimeInterface $createdAt
303
     */
304
    public function setCreatedAt(\DateTimeInterface $createdAt)
305
    {
306
        $this->createdAt = $createdAt;
0 ignored issues
show
Documentation Bug introduced by
$createdAt is of type object<DateTimeInterface>, but the property $createdAt was declared to be of type object<DateTime>. Are you sure that you always receive this specific sub-class here, or does it make sense to add an instanceof 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 given class or a super-class is assigned to a property that is type hinted more strictly.

Either this assignment is in error or an instanceof check should be added for that assignment.

class Alien {}

class Dalek extends Alien {}

class Plot
{
    /** @var  Dalek */
    public $villain;
}

$alien = new Alien();
$plot = new Plot();
if ($alien instanceof Dalek) {
    $plot->villain = $alien;
}
Loading history...
307
    }
308
309
    /**
310
     * Get createdAt.
311
     *
312
     * @return \DateTimeInterface
313
     */
314
    public function getCreatedAt(): \DateTimeInterface
315
    {
316
        return $this->createdAt;
317
    }
318
319
    /**
320
     * Set updatedAt.
321
     *
322
     * @param \DateTimeInterface $updatedAt
323
     *
324
     * @return Project
325
     */
326
    public function setUpdatedAt(\DateTimeInterface $updatedAt)
327
    {
328
        $this->updatedAt = $updatedAt;
0 ignored issues
show
Documentation Bug introduced by
$updatedAt is of type object<DateTimeInterface>, but the property $updatedAt was declared to be of type object<DateTime>. Are you sure that you always receive this specific sub-class here, or does it make sense to add an instanceof 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 given class or a super-class is assigned to a property that is type hinted more strictly.

Either this assignment is in error or an instanceof check should be added for that assignment.

class Alien {}

class Dalek extends Alien {}

class Plot
{
    /** @var  Dalek */
    public $villain;
}

$alien = new Alien();
$plot = new Plot();
if ($alien instanceof Dalek) {
    $plot->villain = $alien;
}
Loading history...
329
    }
330
331
    /**
332
     * Get updatedAt.
333
     *
334
     * @return \DateTimeInterface
335
     */
336
    public function getUpdatedAt(): \DateTimeInterface
337
    {
338
        return $this->updatedAt;
339
    }
340
341
    /**
342
     * Set deletedAt.
343
     *
344
     * @param \DateTimeInterface $deletedAt
345
     */
346
    public function setDeletedAt(\DateTimeInterface $deletedAt = null)
347
    {
348
        $this->deletedAt = $deletedAt;
0 ignored issues
show
Documentation Bug introduced by
It seems like $deletedAt can also be of type object<DateTimeInterface>. However, the property $deletedAt is declared as type object<DateTime>. 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...
349
    }
350
351
    /**
352
     * Get deletedAt.
353
     *
354
     * @return \DateTimeInterface|null
355
     */
356
    public function getDeletedAt(): ?\DateTimeInterface
357
    {
358
        return $this->deletedAt;
359
    }
360
}
361