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.

src/WellCommerce/Bundle/CmsBundle/Entity/Page.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]>
8
 *
9
 * For the full copyright and license information,
10
 * please view the LICENSE file that was distributed with this source code.
11
 */
12
13
namespace WellCommerce\Bundle\CmsBundle\Entity;
14
15
use Doctrine\Common\Collections\ArrayCollection;
16
use Doctrine\Common\Collections\Collection;
17
use Knp\DoctrineBehaviors\Model\Blameable\Blameable;
18
use Knp\DoctrineBehaviors\Model\Timestampable\Timestampable;
19
use Knp\DoctrineBehaviors\Model\Translatable\Translatable;
20
use WellCommerce\Bundle\AppBundle\Entity\ShopCollectionAwareTrait;
21
use WellCommerce\Bundle\CoreBundle\Doctrine\Behaviours\Identifiable;
22
use WellCommerce\Bundle\CoreBundle\Doctrine\Behaviours\Sortable;
23
use WellCommerce\Bundle\CoreBundle\Entity\EntityInterface;
24
use WellCommerce\Extra\CmsBundle\Entity\PageExtraTrait;
25
26
/**
27
 * Class Page
28
 *
29
 * @author  Adam Piotrowski <[email protected]>
30
 */
31
class Page implements EntityInterface
32
{
33
    use Identifiable;
34
    use Sortable;
35
    use Translatable;
36
    use Timestampable;
37
    use Blameable;
38
    use ShopCollectionAwareTrait;
39
    use PageExtraTrait;
40
    
41
    protected $publish       = true;
42
    protected $section       = '';
43
    protected $redirectType  = 1;
44
    protected $redirectUrl   = '';
45
    protected $redirectRoute = '';
46
    protected $layout        = [];
47
    
48
    /**
49
     * @var Page|null
50
     */
51
    protected $parent;
52
    
53
    /**
54
     * @var Collection
55
     */
56
    protected $clientGroups;
57
    
58
    /**
59
     * @var Collection
60
     */
61
    protected $children;
62
    
63
    public function __construct()
64
    {
65
        $this->clientGroups = new ArrayCollection();
66
        $this->shops        = new ArrayCollection();
67
    }
68
    
69
    public function getPublish(): bool
70
    {
71
        return $this->publish;
72
    }
73
    
74
    public function setPublish(bool $publish)
75
    {
76
        $this->publish = $publish;
77
    }
78
    
79
    public function getParent()
80
    {
81
        return $this->parent;
82
    }
83
    
84
    public function setParent(self $parent = null)
85
    {
86
        $this->parent = $parent;
0 ignored issues
show
Documentation Bug introduced by
It seems like $parent can also be of type object<self>. However, the property $parent is declared as type object<WellCommerce\Bund...undle\Entity\Page>|null. 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...
87
    }
88
    
89
    public function getChildren(): Collection
90
    {
91
        return $this->children;
92
    }
93
    
94
    public function addChild(self $child)
95
    {
96
        $this->children[] = $child;
97
        $child->setParent($this);
98
    }
99
    
100
    public function getRedirectRoute()
101
    {
102
        return $this->redirectRoute;
103
    }
104
    
105
    public function setRedirectRoute($redirectRoute)
106
    {
107
        $this->redirectRoute = $redirectRoute;
108
    }
109
    
110
    public function getRedirectUrl()
111
    {
112
        return $this->redirectUrl;
113
    }
114
    
115
    public function setRedirectUrl($redirectUrl)
116
    {
117
        $this->redirectUrl = $redirectUrl;
118
    }
119
    
120
    public function getClientGroups(): Collection
121
    {
122
        return $this->clientGroups;
123
    }
124
    
125
    public function setClientGroups(Collection $clientGroups)
126
    {
127
        $this->clientGroups = $clientGroups;
128
    }
129
    
130
    public function prePersist()
131
    {
132
        $redirectType = $this->getRedirectType();
133
        switch ($redirectType) {
134
            case 0:
135
                $this->setRedirectRoute(null);
136
                $this->setRedirectUrl(null);
137
                break;
138
            case 1:
139
                $this->setRedirectRoute(null);
140
                break;
141
            case 2:
142
                $this->setRedirectUrl(null);
143
                break;
144
        }
145
    }
146
    
147
    public function getRedirectType(): int
148
    {
149
        return $this->redirectType;
150
    }
151
    
152
    public function setRedirectType(int $redirectType)
153
    {
154
        $this->redirectType = $redirectType;
155
    }
156
    
157
    public function getSection(): string
158
    {
159
        return $this->section;
160
    }
161
    
162
    public function setSection(string $section)
163
    {
164
        $this->section = $section;
165
    }
166
    
167
    public function getLayout(): array
168
    {
169
        return $this->layout;
170
    }
171
    
172
    public function setLayout(array $layout)
173
    {
174
        $this->layout = $layout;
175
    }
176
    
177
    public function translate($locale = null, $fallbackToDefault = true): PageTranslation
178
    {
179
        return $this->doTranslate($locale, $fallbackToDefault);
180
    }
181
}
182