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/Dependency.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 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 Composer\Semver\Comparator;
15
16
class Dependency
17
{
18
    /**
19
     * @var int
20
     */
21
    private $id;
22
23
    /**
24
     * @var string
25
     */
26
    private $rawVersion;
27
28
    /**
29
     * @var string
30
     */
31
    private $currentVersion;
32
33
    /**
34
     * @var \DateTime
35
     */
36
    private $createdAt;
37
38
    /**
39
     * @var \DateTime
40
     */
41
    private $updatedAt;
42
43
    /**
44
     * @var Project
45
     */
46
    private $project;
47
48
    /**
49
     * @var Package
50
     */
51
    private $package;
52
53
    /**
54
     * Get id.
55
     *
56
     * @return int
57
     */
58
    public function getId(): int
59
    {
60
        return $this->id;
61
    }
62
63
    /**
64
     * Set rawVersion.
65
     *
66
     * @param string $rawVersion
67
     */
68
    public function setRawVersion(string $rawVersion)
69
    {
70
        $this->rawVersion = $rawVersion;
71
    }
72
73
    /**
74
     * Get rawVersion.
75
     *
76
     * @return string
77
     */
78
    public function getRawVersion(): string
79
    {
80
        return $this->rawVersion;
81
    }
82
83
    /**
84
     * Set currentVersion.
85
     *
86
     * @param string $currentVersion
87
     */
88
    public function setCurrentVersion(string $currentVersion)
89
    {
90
        $this->currentVersion = $currentVersion;
91
    }
92
93
    /**
94
     * Get currentVersion.
95
     *
96
     * @return string
97
     */
98
    public function getCurrentVersion(): string
99
    {
100
        return $this->currentVersion;
101
    }
102
103
    /**
104
     * Set project.
105
     *
106
     * @param Project $project
107
     */
108
    public function setProject(Project $project = null)
109
    {
110
        $this->project = $project;
111
    }
112
113
    /**
114
     * Get project.
115
     *
116
     * @return Project
117
     */
118
    public function getProject(): ?Project
119
    {
120
        return $this->project;
121
    }
122
123
    /**
124
     * Set package.
125
     *
126
     * @param Package $package
127
     */
128
    public function setPackage(Package $package = null)
129
    {
130
        $this->package = $package;
131
    }
132
133
    /**
134
     * Get package.
135
     *
136
     * @return Package
137
     */
138
    public function getPackage(): ?Package
139
    {
140
        return $this->package;
141
    }
142
143
    /**
144
     * Get status.
145
     *
146
     * @return string
147
     */
148
    public function getStatus(): string
149
    {
150
        if (preg_match('/[a-zA-Z]+$/', $this->getRawVersion())) {
151
            return 'unstable';
152
        }
153
154
        if (Comparator::greaterThanOrEqualTo($this->getCurrentVersion(), $this->package->getLatestVersion())) {
155
            return 'stable';
156
        }
157
158
        return 'outdated';
159
    }
160
161
    /**
162
     * Set createdAt.
163
     *
164
     * @param \DateTimeInterface $createdAt
165
     */
166
    public function setCreatedAt(\DateTimeInterface $createdAt)
167
    {
168
        $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...
169
    }
170
171
    /**
172
     * Get createdAt.
173
     *
174
     * @return \DateTimeInterface
175
     */
176
    public function getCreatedAt(): \DateTimeInterface
177
    {
178
        return $this->createdAt;
179
    }
180
181
    /**
182
     * Set updatedAt.
183
     *
184
     * @param \DateTimeInterface $updatedAt
185
     */
186
    public function setUpdatedAt(\DateTimeInterface $updatedAt)
187
    {
188
        $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...
189
    }
190
191
    /**
192
     * Get updatedAt.
193
     *
194
     * @return \DateTimeInterface
195
     */
196
    public function getUpdatedAt(): \DateTimeInterface
197
    {
198
        return $this->updatedAt;
199
    }
200
}
201