Issues (47)

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/Access/User.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
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the zibios/sharep.
7
 *
8
 * (c) Zbigniew Ślązak
9
 */
10
11
namespace App\Entity\Access;
12
13
use App\Entity\EntityInterface;
14
use App\Entity\Parking\Member;
15
use App\Entity\Traits;
16
use Doctrine\ORM\Mapping as ORM;
17
use PascalDeVink\ShortUuid\ShortUuid;
18
use Symfony\Bridge\Doctrine\Validator\Constraints as OrmAssert;
19
use Symfony\Component\Security\Core\User\UserInterface;
20
use Symfony\Component\Validator\Constraints as Assert;
21
22
/**
23
 * @ORM\Entity(repositoryClass="App\Repository\Entity\Account\UserRepository")
24
 * @ORM\Table(name="access_users")
25
 * @OrmAssert\UniqueEntity(fields={"email"}, errorPath="email", message="Email already exist")
26
 * @OrmAssert\UniqueEntity(fields={"member"}, errorPath="member", message="Member already exist")
27
 */
28
class User implements UserInterface, EntityInterface
29
{
30
    use Traits\PropertyIdGeneratedTrait;
31
32
    /**
33
     * @var string|null
34
     * @ORM\Column(name="email", type="string", length=255, nullable=false, unique=true)
35
     *
36
     * @Assert\NotBlank()
37
     * @Assert\Email()
38
     * @Assert\Length(min="1", max="255")
39
     */
40
    private $email;
41
42
    //-------------------------------------------------------------------------------------------
43
44
    /**
45
     * @var GoogleIdentity|null
46
     * @ORM\OneToOne(targetEntity="App\Entity\Access\GoogleIdentity", mappedBy="user", cascade={"persist"})
47
     */
48
    private $googleIdentity;
49
50
    /**
51
     * @var SlackIdentity|null
52
     * @ORM\OneToOne(targetEntity="App\Entity\Access\SlackIdentity", mappedBy="user", cascade={"persist"})
53
     */
54
    private $slackIdentity;
55
56
    /**
57
     * @var Member|null
58
     * @ORM\OneToOne(targetEntity="App\Entity\Parking\Member", mappedBy="user", cascade={"persist"})
59
     */
60
    private $member;
61
62
    //-------------------------------------------------------------------------------------------
63
64 14
    public function __construct()
65
    {
66 14
        $this->id = ShortUuid::uuid4();
67 14
    }
68
69
    //-------------------------------------------------------------------------------------------
70
71 17
    public function getEmail(): ?string
72
    {
73 17
        return $this->email;
74
    }
75
76 13
    public function setEmail(string $email): self
77
    {
78 13
        $this->email = trim($email);
79
80 13
        return $this;
81
    }
82
83
    //-------------------------------------------------------------------------------------------
84
85
    public function getGoogleIdentity(): ?GoogleIdentity
86
    {
87
        return $this->googleIdentity;
88
    }
89
90
    public function setGoogleIdentity(GoogleIdentity $googleIdentity): self
91
    {
92
        $this->googleIdentity = $googleIdentity;
93
94
        return $this;
95
    }
96
97 3
    public function getSlackIdentity(): ?SlackIdentity
98
    {
99 3
        return $this->slackIdentity;
100
    }
101
102
    public function setSlackIdentity(?GoogleIdentity $slackIdentity): self
103
    {
104
        $this->slackIdentity = $slackIdentity;
105
106
        return $this;
107
    }
108
109 16
    public function getMember(): ?Member
110
    {
111 16
        return $this->member;
112
    }
113
114
    public function setMember(Member $member): self
115
    {
116
        $this->member = $member;
117
118
        return $this;
119
    }
120
121
    //-------------------------------------------------------------------------------------------
122
123
    /**
124
     * Returns the roles granted to the user.
125
     *
126
     * <code>
127
     * public function getRoles()
128
     * {
129
     *     return array('ROLE_USER');
130
     * }
131
     * </code>
132
     *
133
     * Alternatively, the roles might be stored on a ``roles`` property,
134
     * and populated in any number of different ways when the user object
135
     * is created.
136
     *
137
     * @return string[] The user roles
138
     */
139 17
    public function getRoles(): array
140
    {
141 17
        return ['ROLE_USER'];
142
    }
143
144
    /**
145
     * Returns the password used to authenticate the user.
146
     *
147
     * This should be the encoded password. On authentication, a plain-text
148
     * password will be salted, encoded, and then compared to this value.
149
     *
150
     * @return string The password
0 ignored issues
show
Should the return type not be string|null?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
151
     */
152 17
    public function getPassword(): ?string
153
    {
154 17
        return null;
155
    }
156
157
    /**
158
     * Returns the salt that was originally used to encode the password.
159
     *
160
     * This can return null if the password was not encoded using a salt.
161
     *
162
     * @return string|null The salt
163
     */
164 17
    public function getSalt(): ?string
165
    {
166 17
        return null;
167
    }
168
169
    /**
170
     * Returns the username used to authenticate the user.
171
     *
172
     * @return string The username
0 ignored issues
show
Should the return type not be string|null?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
173
     */
174 17
    public function getUsername(): ?string
175
    {
176 17
        return $this->getEmail();
177
    }
178
179
    /**
180
     * Removes sensitive data from the user.
181
     *
182
     * This is important if, at any given point, sensitive information like
183
     * the plain-text password is stored on this object.
184
     */
185
    public function eraseCredentials(): void
186
    {
187
    }
188
}
189