Issues (59)

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.

Document/Setting.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
/*
4
 * This file is part of the ONGR package.
5
 *
6
 * (c) NFQ Technologies UAB <[email protected]>
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 ONGR\SettingsBundle\Document;
13
14
use ONGR\ElasticsearchBundle\Annotation as ES;
15
use ONGR\FilterManagerBundle\SerializableInterface;
16
17
/**
18
 * Stores admin settings.
19
 *
20
 * @ES\Document(type="setting")
21
 */
22
class Setting implements SerializableInterface
23
{
24
    /**
25
     * @var string
26
     *
27
     * @ES\Id()
28
     */
29
    private $id;
30
31
    /**
32
     * @var string
33
     *
34
     * @ES\Property(
35
     *  type="keyword",
36
     *  options={
37
     *    "fields"={
38
     *        "raw"={"type"="keyword", "index"="not_analyzed"},
39
     *        "name"={"type"="keyword"}
40
     *    }
41
     *  }
42
     * )
43
     */
44
    private $name;
45
46
    /**
47
     * @var string
48
     *
49
     * @ES\Property(type="text", options={"analyzer"="standard"})
50
     */
51
    private $description;
52
53
    /**
54
     * @var string
55
     *
56
     * @ES\Property(
57
     *  type="keyword",
58
     *  options={
59
     *    "fields"={
60
     *        "raw"={"type"="keyword", "index"="not_analyzed"},
61
     *        "profile"={"type"="keyword"}
62
     *    }
63
     *  }
64
     * )
65
     */
66
    private $profile = [];
67
68
    /**
69
     * @var string
70
     *
71
     * @ES\Property(type="keyword", options={"index"="not_analyzed"})
72
     */
73
    private $type;
74
75
    /**
76
     * @var string
77
     *
78
     * @ES\Property(type="keyword", options={"index"="not_analyzed"})
79
     */
80
    private $value;
81
82
    /**
83
     * @var string
84
     *
85
     * @ES\Property(type="keyword", options={"index"="not_analyzed"})
86
     */
87
    private $salt;
88
89
    /**
90
     * @var string
91
     *
92
     * @ES\Property(type="date")
93
     */
94
    private $createdAt;
95
96
    /**
97
     * Setting constructor.
98
     */
99
    public function __construct()
100
    {
101
        $this->createdAt = new \DateTime();
0 ignored issues
show
Documentation Bug introduced by
It seems like new \DateTime() of type object<DateTime> is incompatible with the declared type string of property $createdAt.

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...
102
    }
103
104
    /**
105
     * @return string
106
     */
107
    public function getId()
108
    {
109
        return $this->id;
110
    }
111
112
    /**
113
     * @param string $id
114
     */
115
    public function setId($id)
116
    {
117
        $this->id = $id;
118
    }
119
120
    /**
121
     * @return string
122
     */
123
    public function getValue()
124
    {
125
        return $this->value;
126
    }
127
128
    /**
129
     * @param string $value
130
     */
131
    public function setValue($value)
132
    {
133
        $this->value = $value;
134
    }
135
136
    /**
137
     * Get type.
138
     *
139
     * @return string
140
     */
141
    public function getType()
142
    {
143
        return $this->type;
144
    }
145
146
    /**
147
     * Set type.
148
     *
149
     * @param string $type
150
     */
151
    public function setType($type)
152
    {
153
        $this->type = $type;
154
    }
155
156
    /**
157
     * Get profile.
158
     *
159
     * @return string|array
160
     */
161
    public function getProfile()
162
    {
163
        return $this->profile;
164
    }
165
166
    /**
167
     * Set profile.
168
     *
169
     * @param string|array $profile
170
     */
171
    public function setProfile($profile)
172
    {
173
        $this->profile = $profile;
0 ignored issues
show
Documentation Bug introduced by
It seems like $profile can also be of type array. However, the property $profile is declared as type string. 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...
174
    }
175
176
    /**
177
     * Get description.
178
     *
179
     * @return string
180
     */
181
    public function getDescription()
182
    {
183
        return $this->description;
184
    }
185
186
    /**
187
     * Set description.
188
     *
189
     * @param string $description
190
     */
191
    public function setDescription($description)
192
    {
193
        $this->description = $description;
194
    }
195
196
    /**
197
     * Get name.
198
     *
199
     * @return string
200
     */
201
    public function getName()
202
    {
203
        return $this->name;
204
    }
205
206
    /**
207
     * Set name.
208
     *
209
     * @param string $name
210
     */
211
    public function setName($name)
212
    {
213
        $this->name = $name;
214
    }
215
216
    /**
217
     * @return string
218
     */
219
    public function getSalt()
220
    {
221
        return $this->salt;
222
    }
223
224
    /**
225
     * @param string $salt
226
     */
227
    public function setSalt($salt)
228
    {
229
        $this->salt = $salt;
230
    }
231
232
    /**
233
     * @return string
234
     */
235
    public function getCreatedAt()
236
    {
237
        return $this->createdAt;
238
    }
239
240
    /**
241
     * @param string $createdAt
242
     */
243
    public function setCreatedAt($createdAt)
244
    {
245
        $this->createdAt = $createdAt;
246
    }
247
248
    /**
249
     * Specify data which should be serialized to JSON.
250
     *
251
     * @return mixed Data which can be serialized by json_encode.
252
     */
253
    public function getSerializableData()
254
    {
255
        return [
256
            'id' => $this->getId(),
257
            'name' => $this->getName(),
258
            'description' => $this->getDescription(),
259
            'profile' => $this->getProfile(),
260
            'salt' => $this->getSalt(),
261
            'type' => $this->getType(),
262
            'value' => $this->getValue(),
263
        ];
264
    }
265
}
266