Issues (70)

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/AppBundle/Entity/FormRequest.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 AppBundle\Entity;
4
5
use Doctrine\ORM\Mapping as ORM;
6
use Knp\DoctrineBehaviors\Model as ORMBehaviors;
7
use Symfony\Component\Serializer\Annotation\Groups;
8
use Symfony\Component\Validator\Constraints as Assert;
9
10
/**
11
 * FormRequest.
12
 *
13
 * @ORM\Entity(repositoryClass="AppBundle\Repository\FormRequestRepository")
14
 */
15
class FormRequest
16
{
17
    use ORMBehaviors\Timestampable\Timestampable;
18
19
    const STATUS = ['pending', 'approved', 'rejected'];
20
    const TYPE = ['personal day', 'overnight guest', 'sick day'];
21
22
    /**
23
     * @var int
24
     *
25
     * @ORM\Column(name="id", type="integer")
26
     * @ORM\Id
27
     * @ORM\GeneratedValue(strategy="AUTO")
28
     */
29
    private $id;
30
31
    /**
32
     * @var string
33
     * @Assert\NotBlank()
34
     * @Assert\Choice(FormRequest::TYPE)
35
     * @ORM\Column(type="string", length=25)
36
     * @Groups({"Detail"})
37
     */
38
    private $type;
39
40
    /**
41
     * @var string
42
     * @Assert\NotBlank()
43
     * @Assert\Type("string")
44
     * @Assert\Length(
45
     *      max = 255
46
     * )
47
     * @ORM\Column(type="string", length=255)
48
     * @Groups({"Detail"})
49
     */
50
    private $status;
51
52
    /**
53
     * @var User
54
     * @Assert\Type("object")
55
     * @Assert\Valid
56
     * @ORM\ManyToOne(targetEntity="User", inversedBy="formRequests")
57
     */
58
    private $user;
59
60
    /**
61
     * @var \DateTime
62
     * @Assert\DateTime()
63
     * @ORM\Column(type="datetime")
64
     * @Assert\GreaterThan("+2 days")
65
     * @Groups({"Detail"})
66
     */
67
    private $date;
68
69
    /**
70
     * @var string
71
     *
72
     * @ORM\Column(type="string", nullable=true)
73
     * @Assert\Length(min="5", max="100")
74
     * @Groups({"Detail"})
75
     */
76
    private $reason;
77
78
    public function __construct()
79
    {
80
        $this->setStatus('pending');
81
    }
82
83
    /**
84
     * Get id.
85
     *
86
     * @return int
87
     */
88 1
    public function getId()
89
    {
90 1
        return $this->id;
91
    }
92
93
    /**
94
     * Set type.
95
     *
96
     * @param $type
97
     *
98
     * @return FormRequest
99
     */
100
    public function setType($type)
101
    {
102
        if (in_array($type, self::TYPE)) {
103
            $this->type = $type;
104
        }
105
106
        return $this;
107
    }
108
109
    /**
110
     * Get type.
111
     *
112
     * @return string
113
     */
114 1
    public function getType()
115
    {
116 1
        return $this->type;
117
    }
118
119
    /**
120
     * Set status.
121
     *
122
     * @param string $status
123
     *
124
     * @return FormRequest
125
     */
126
    public function setStatus($status)
127
    {
128
        if (in_array($status, self::STATUS)) {
129
            $this->status = $status;
130
        }
131
132
        return $this;
133
    }
134
135
    /**
136
     * Get status.
137
     *
138
     * @return string
139
     */
140 1
    public function getStatus()
141
    {
142 1
        return $this->status;
143
    }
144
145
    /**
146
     * Set user.
147
     *
148
     * @param User $user
149
     *
150
     * @return FormRequest
151
     */
152
    public function setUser(User $user)
153
    {
154
        $this->user = $user;
155
156
        return $this;
157
    }
158
159
    /**
160
     * Get user.
161
     *
162
     * @return User
163
     */
164
    public function getUser()
165
    {
166
        return $this->user;
167
    }
168
169
    /**
170
     * Set date.
171
     *
172
     * @param \DateTime $date
173
     *
174
     * @return FormRequest
175
     */
176
    public function setDate($date)
177
    {
178
        try {
179
            $this->date = date_create_from_format(\DATE_RFC3339, $date);
180
        } catch (\Exception $e) {
181
            $this->date = false;
0 ignored issues
show
Documentation Bug introduced by
It seems like false of type false is incompatible with the declared type object<DateTime> of property $date.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
182
        }
183
184
        return $this;
185
    }
186
    /**
187
     * Get date.
188
     *
189
     * @return \DateTime
190
     */
191 1
    public function getDate()
192
    {
193 1
        return $this->date;
194
    }
195
196
    /**
197
     * @return string
198
     */
199 1
    public function getReason()
200
    {
201 1
        return $this->reason;
202
    }
203
204
    /**
205
     * @param string $reason
206
     *
207
     * @return $this
208
     */
209
    public function setReason($reason)
210
    {
211
        $this->reason = $reason;
212
213
        return $this;
214
    }
215
}
216