Issues (5)

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.

Model/ShariffConfig.php (4 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
namespace CedricZiel\ShariffBundle\Model;
4
5
/**
6
 * Configures the shariff backend
7
 *
8
 * @package CedricZiel\ShariffBundle
9
 */
10
class ShariffConfig
11
{
12
    /**
13
     * @var string
14
     */
15
    protected $domain;
16
17
    /**
18
     * @var string
19
     */
20
    protected $forceProtocol;
21
22
    /**
23
     * @var string
24
     */
25
    protected $cacheDir;
26
27
    /**
28
     * @var int
29
     */
30
    protected $cacheTtl;
31
32
    /**
33
     * @var array
34
     */
35
    protected $services;
36
37
    /**
38
     * @var array
39
     */
40
    protected $serviceConfig = [];
41
42
    /**
43
     * @var string
44
     */
45
    protected $adapter;
46
47
    /**
48
     * @var array
49
     */
50
    protected $adapterOptions;
51
52
    /**
53
     * @var array
54
     */
55
    protected $client;
56
57
    /**
58
     * @param string  $domain
59
     * @param boolean $forceProtocol
60
     * @param array   $services
61
     * @param string  $cache
62
     * @param string  $client
63
     */
64
    public function __construct($domain, $forceProtocol, $services, $cache, $client)
65
    {
66
        $this->domain = $domain;
67
        $this->forceProtocol = $forceProtocol;
0 ignored issues
show
Documentation Bug introduced by
The property $forceProtocol was declared of type string, but $forceProtocol is of type boolean. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
68
        $this->services = array_keys($services);
69
        $this->cacheTtl = $cache['ttl'];
0 ignored issues
show
Documentation Bug introduced by
The property $cacheTtl was declared of type integer, but $cache['ttl'] is of type string. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
70
        $this->cacheDir = isset($cache['cacheDir']) ? $cache['cacheDir'] : null;
71
        $this->adapter = isset($cache['adapter']) ? $cache['adapter'] : null;
72
        $this->adapterOptions = isset($cache['adapterOptions']) ? $cache['adapterOptions'] : null;
0 ignored issues
show
Documentation Bug introduced by
It seems like isset($cache['adapterOpt...adapterOptions'] : null of type string or null is incompatible with the declared type array of property $adapterOptions.

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...
73
74
        foreach ($services as $name => $serviceConfig) {
75
            if (null !== $serviceConfig) {
76
                $this->serviceConfig[$name] = $serviceConfig;
77
            }
78
        }
79
        $this->client = $client;
0 ignored issues
show
Documentation Bug introduced by
It seems like $client of type string is incompatible with the declared type array of property $client.

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...
80
    }
81
82
    /**
83
     * @return string
84
     */
85
    public function getCacheDir()
86
    {
87
        return $this->cacheDir;
88
    }
89
90
    /**
91
     * @param string $cacheDir
92
     */
93
    public function setCacheDir($cacheDir)
94
    {
95
        $this->cacheDir = $cacheDir;
96
    }
97
98
    /**
99
     * @return int
100
     */
101
    public function getCacheTtl()
102
    {
103
        return $this->cacheTtl;
104
    }
105
106
    /**
107
     * @param int $cacheTtl
108
     */
109
    public function setCacheTtl($cacheTtl)
110
    {
111
        $this->cacheTtl = $cacheTtl;
112
    }
113
114
    /**
115
     * @return string
116
     */
117
    public function getDomain()
118
    {
119
        return $this->domain;
120
    }
121
122
    /**
123
     * @param string $domain
124
     */
125
    public function setDomain($domain)
126
    {
127
        $this->domain = $domain;
128
    }
129
130
    /**
131
     * @return string
132
     */
133
    public function getForceProtocol()
134
    {
135
        return $this->forceProtocol;
136
    }
137
138
    /**
139
     * @param string $forceProtocol
140
     */
141
    public function setForceProtocol($forceProtocol)
142
    {
143
        $this->forceProtocol = $forceProtocol;
144
    }
145
146
    /**
147
     * @return array
148
     */
149
    public function getServices()
150
    {
151
        return $this->services;
152
    }
153
154
    /**
155
     * @param array $services
156
     */
157
    public function setServices($services)
158
    {
159
        $this->services = $services;
160
    }
161
162
    /**
163
     * @return string
164
     */
165
    public function getAdapter()
166
    {
167
        return $this->adapter;
168
    }
169
170
    /**
171
     * @param string $adapter
172
     */
173
    public function setAdapter($adapter)
174
    {
175
        $this->adapter = $adapter;
176
    }
177
178
    /**
179
     * @return array
180
     */
181
    public function getAdapterOptions()
182
    {
183
        return $this->adapterOptions;
184
    }
185
186
    /**
187
     * @param array $adapterOptions
188
     */
189
    public function setAdapterOptions($adapterOptions)
190
    {
191
        $this->adapterOptions = $adapterOptions;
192
    }
193
194
    /**
195
     * @return array
196
     */
197
    public function toArray()
198
    {
199
        $result = [];
200
        $result['domains'][] = $this->domain;
201
        $result['force_protocol'] = $this->forceProtocol;
202
        $result['services'] = $this->services;
203
        $result = array_merge($result, $this->serviceConfig);
204
205
        $result['services'] = array_filter(
206
            $result['services'],
207
            function ($v) {
208
                return 'Twitter' != $v && 'Mail' != $v;
209
            }
210
        );
211
212
        $result['cache'] = ['ttl' => $this->cacheTtl];
213
        if (null !== $this->cacheDir) {
214
            $result['cache']['cacheDir'] = $this->cacheDir;
215
        }
216
        if (null !== $this->adapter) {
217
            $result['cache']['adapter'] = $this->adapter;
218
        }
219
        if (null !== $this->adapterOptions) {
220
            $result['cache']['adapterOptions'] = $this->adapterOptions;
221
        }
222
223
        if (null !== $this->client && count($this->client)) {
224
            $result['client'] = $this->client;
225
        }
226
227
        return $result;
228
    }
229
}
230