Issues (116)

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.

WellCommerce/Bundle/AppBundle/Entity/Client.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
 * WellCommerce Open-Source E-Commerce Platform
4
 *
5
 * This file is part of the WellCommerce package.
6
 *
7
 * (c) Adam Piotrowski <[email protected]g>
8
 *
9
 * For the full copyright and license information,
10
 * please view the LICENSE file that was distributed with this source code.
11
 */
12
namespace WellCommerce\Bundle\AppBundle\Entity;
13
14
use Doctrine\Common\Collections\ArrayCollection;
15
use Doctrine\Common\Collections\Collection;
16
use Knp\DoctrineBehaviors\Model\Blameable\Blameable;
17
use Knp\DoctrineBehaviors\Model\Timestampable\Timestampable;
18
use Symfony\Component\Security\Core\Encoder\EncoderAwareInterface;
19
use Symfony\Component\Security\Core\User\AdvancedUserInterface;
20
use Symfony\Component\Security\Core\User\EquatableInterface;
21
use Symfony\Component\Security\Core\User\UserInterface;
22
use WellCommerce\Bundle\CoreBundle\Doctrine\Behaviours\Enableable;
23
use WellCommerce\Bundle\CoreBundle\Doctrine\Behaviours\Identifiable;
24
use WellCommerce\Bundle\CoreBundle\Entity\EntityInterface;
25
use WellCommerce\Bundle\OrderBundle\Entity\Order;
26
use WellCommerce\Extra\AppBundle\Entity\ClientExtraTrait;
27
28
/**
29
 * Class Client
30
 *
31
 * @author  Adam Piotrowski <[email protected]>
32
 */
33
class Client implements EntityInterface, \Serializable, UserInterface, EquatableInterface, EncoderAwareInterface, AdvancedUserInterface
34
{
35
    const ROLE_CLIENT = 'ROLE_CLIENT';
36
    
37
    use Identifiable;
38
    use Enableable;
39
    use Timestampable;
40
    use Blameable;
41
    use ShopAwareTrait;
42
    use ClientExtraTrait;
43
    
44
    /**
45
     * @var Collection
46
     */
47
    protected $orders;
48
    
49
    /**
50
     * @var ClientDetails
51
     */
52
    protected $clientDetails;
53
    
54
    /**
55
     * @var ClientContactDetails
56
     */
57
    protected $contactDetails;
58
    
59
    /**
60
     * @var ClientBillingAddress
61
     */
62
    protected $billingAddress;
63
    
64
    /**
65
     * @var ClientShippingAddress
66
     */
67
    protected $shippingAddress;
68
    
69
    /**
70
     * @var ClientGroup
71
     */
72
    protected $clientGroup;
73
    
74
    /**
75
     * @var MinimumOrderAmount
76
     */
77
    protected $minimumOrderAmount;
78
    
79
    public function __construct()
80
    {
81
        $this->orders             = new ArrayCollection();
82
        $this->clientDetails      = new ClientDetails();
83
        $this->contactDetails     = new ClientContactDetails();
84
        $this->billingAddress     = new ClientBillingAddress();
85
        $this->shippingAddress    = new ClientShippingAddress();
86
        $this->minimumOrderAmount = new MinimumOrderAmount();
87
    }
88
    
89
    public function getPassword()
90
    {
91
        return $this->clientDetails->getPassword();
92
    }
93
    
94
    public function getSalt()
95
    {
96
        return null;
97
    }
98
    
99
    public function getUsername()
100
    {
101
        return $this->clientDetails->getUsername();
102
    }
103
    
104
    public function eraseCredentials()
105
    {
106
    }
107
    
108
    public function getRoles()
109
    {
110
        return [
111
            self::ROLE_CLIENT,
112
        ];
113
    }
114
    
115
    public function serialize()
116
    {
117
        return serialize([$this->id, $this->getUsername(), $this->getPassword(), $this->isEnabled()]);
118
    }
119
    
120
    public function unserialize($serialized)
121
    {
122
        list($this->id, $username, $password, $enabled) = unserialize($serialized);
0 ignored issues
show
The assignment to $enabled is unused. Consider omitting it like so list($first,,$third).

This checks looks for assignemnts to variables using the list(...) function, where not all assigned variables are subsequently used.

Consider the following code example.

<?php

function returnThreeValues() {
    return array('a', 'b', 'c');
}

list($a, $b, $c) = returnThreeValues();

print $a . " - " . $c;

Only the variables $a and $c are used. There was no need to assign $b.

Instead, the list call could have been.

list($a,, $c) = returnThreeValues();
Loading history...
123
        if (!$this->clientDetails instanceof ClientDetails) {
124
            $this->clientDetails = new ClientDetails();
125
        }
126
        $this->clientDetails->setUsername($username);
127
        $this->clientDetails->setPassword($password);
128
    }
129
    
130
    public function isEqualTo(UserInterface $user)
131
    {
132
        if (!$user instanceof Client) {
133
            return false;
134
        }
135
        
136
        if ($this->getPassword() !== $user->getPassword()) {
137
            return false;
138
        }
139
        
140
        if ($this->getUsername() !== $user->getUsername()) {
141
            return false;
142
        }
143
        
144
        return true;
145
    }
146
    
147
    public function getOrders(): Collection
148
    {
149
        return $this->orders->filter(function (Order $order) {
150
            return $order->isConfirmed();
151
        });
152
    }
153
    
154
    public function getClientDetails(): ClientDetails
155
    {
156
        return $this->clientDetails;
157
    }
158
    
159
    public function setClientDetails(ClientDetails $clientDetails)
160
    {
161
        $this->clientDetails = $clientDetails;
162
    }
163
    
164
    public function getContactDetails(): ClientContactDetails
165
    {
166
        return $this->contactDetails;
167
    }
168
    
169
    public function setContactDetails(ClientContactDetails $contactDetails)
170
    {
171
        $this->contactDetails = $contactDetails;
172
    }
173
    
174
    public function getBillingAddress(): ClientBillingAddress
175
    {
176
        return $this->billingAddress;
177
    }
178
    
179
    public function setBillingAddress(ClientBillingAddress $billingAddress)
180
    {
181
        $this->billingAddress = $billingAddress;
182
    }
183
    
184
    public function getShippingAddress(): ClientShippingAddress
185
    {
186
        return $this->shippingAddress;
187
    }
188
    
189
    public function setShippingAddress(ClientShippingAddress $shippingAddress)
190
    {
191
        $this->shippingAddress = $shippingAddress;
192
    }
193
    
194
    public function getEncoderName()
195
    {
196
        return $this->clientDetails->getLegacyPasswordEncoder() ?? null;
197
    }
198
    
199
    public function getClientGroup()
200
    {
201
        return $this->clientGroup;
202
    }
203
    
204
    public function setClientGroup(ClientGroup $clientGroup = null)
205
    {
206
        $this->clientGroup = $clientGroup;
207
    }
208
    
209
    public function getMinimumOrderAmount(): MinimumOrderAmount
210
    {
211
        return $this->minimumOrderAmount;
212
    }
213
    
214
    public function setMinimumOrderAmount(MinimumOrderAmount $minimumOrderAmount)
215
    {
216
        $this->minimumOrderAmount = $minimumOrderAmount;
217
    }
218
219
    public function isAccountNonExpired()
220
    {
221
        return true;
222
    }
223
224
    public function isAccountNonLocked()
225
    {
226
        return true;
227
    }
228
229
    public function isCredentialsNonExpired()
230
    {
231
        return true;
232
    }
233
}
234