GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (17)

Security Analysis    no request data  

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/Resource/AbstractResource.php (1 issue)

Severity

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 m1\vars library
5
 *
6
 * (c) m1 <[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
 * @package     m1/vars
12
 * @version     1.1.0
13
 * @author      Miles Croxford <[email protected]>
14
 * @copyright   Copyright (c) Miles Croxford <[email protected]>
15
 * @license     http://github.com/m1/vars/blob/master/LICENSE
16
 * @link        http://github.com/m1/vars/blob/master/README.MD Documentation
17
 */
18
19
namespace M1\Vars\Resource;
20
21
/**
22
 * Abstract Resource enables normal and dot notation array access on resources
23
 *
24
 * @since 0.1.0
25
 */
26
abstract class AbstractResource implements \ArrayAccess
27
{
28
    /**
29
     * The resource content
30
     *
31
     * @var array
32
     */
33
    protected $content = array();
34
35
    /**
36
     * Sets the resource contents
37
     *
38
     * @param array $content
39
     *
40
     * @return $this
41
     */
42 1
    public function setContent($content)
43
    {
44 1
        $this->content = $content;
45 1
        return $this;
46
    }
47
48
    /**
49
     * Returns the content of the resource
50
     *
51
     * @return array The content
52
     */
53 66
    public function getContent()
54
    {
55 66
        return $this->content;
56
    }
57
58
    /**
59
     * Normal `$example[$key]` access for the array
60
     *
61
     * @param mixed $key The key to get the value for
62
     *
63
     * @return array|bool|null The resource key value
64
     */
65 4
    public function offsetGet($key)
66
    {
67 4
        return $this->internalGet($this->content, $key);
68
    }
69
70
    /**
71
     * Object oriented get access for the array
72
     *
73
     * @param mixed $key The key to get the value for
74
     *
75
     * @return array|bool|null The resource key value
76
     */
77 9
    public function get($key)
78
    {
79 9
        return $this->internalGet($this->content, $key);
80
    }
81
82
    /**
83
     * The internal get function for getting values by their key
84
     *
85
     * @param array $array  The array to use -- will always be $this->content
86
     * @param mixed $key    The key to find the value for
87
     * @param bool  $exists Whether to return null or false dependant on the calling function
88
     *
89
     * @return array|bool|null The resource key value
90
     */
91 9
    private function internalGet(array $array, $key, $exists = false)
92
    {
93 9
        if (isset($array[$key])) {
94 4
            return (!$exists) ? $array[$key] : true;
95
        }
96
97 5
        $parts = explode('.', $key);
98
99 5
        foreach ($parts as $part) {
100 5
            if (!is_array($array) || !isset($array[$part])) {
101 2
                return (!$exists) ? null : false;
102
            }
103
104 4
            $array = $array[$part];
105
        }
106
107 3
        return (!$exists) ? $array : true;
108
    }
109
110
    /**
111
     * Normal `$example[$key] = 'hello'` access for the array
112
     *
113
     * @param mixed $key The key to set the value for
114
     * @param mixed $value The value to set
115
     */
116 2
    public function offsetSet($key, $value)
117
    {
118 2
        $this->internalSet($this->content, $key, $value);
119 2
    }
120
121
    /**
122
     * Object oriented set access for the array
123
     *
124
     * @param string $key The key to set the value for
125
     * @param string $value The value to set
126
     */
127 57
    public function set($key, $value)
128
    {
129 57
        $this->internalSet($this->content, $key, $value);
130 57
    }
131
132
    /**
133
     * Object oriented set access for the array
134
     *
135
     * @param array $array  The array to use -- will always be based on $this->content but can be used recursively
136
     * @param mixed $key    The key to set the value for
137
     * @param mixed $value  The value to set
138
     *
139
     * @return array Returns the modified array
140
     */
141 57
    private function internalSet(array &$array, $key, $value)
142
    {
143 57
        if (is_null($key)) {
144 1
            return $array = $value;
145
        }
146
147 57
        $keys = explode('.', $key);
148
149 57
        while (count($keys) > 1) {
150 15
            $key = array_shift($keys);
151
152 15
            if (! isset($array[$key]) || ! is_array($array[$key])) {
153 15
                $array[$key] = [];
154
            }
155
156 15
            $array = &$array[$key];
157
        }
158
159 57
        $array[array_shift($keys)] = $value;
160
161 57
        return $array;
162
    }
163
164
    /**
165
     * Checks whether the key exists
166
     *
167
     * @param mixed $key The key to check
168
     *
169
     * @return bool Does the key exist
170
     */
171 2
    public function offsetExists($key)
172
    {
173 2
        return $this->internalGet($this->content, $key, true);
0 ignored issues
show
Bug Compatibility introduced by
The expression $this->internalGet($this->content, $key, true); of type array|boolean|null adds the type array to the return on line 173 which is incompatible with the return type declared by the interface ArrayAccess::offsetExists of type boolean.
Loading history...
174
    }
175
176
    /**
177
     * Unsets the key
178
     *
179
     * @param mixed $key The key to unset
180
     */
181 2
    public function offsetUnset($key)
182
    {
183 2
        $this->internalUnset($this->content, $key);
184 2
    }
185
186
    /**
187
     * Internal unset for the key
188
     *
189
     * @param array $array The array to use -- will always be based on $this->content but can be used recursively
190
     * @param mixed $key The key to unset
191
     */
192 2
    protected function internalUnset(array &$array, $key)
193
    {
194 2
        $parts = explode(".", $key);
195
196 2
        while (count($parts) > 1) {
197 1
            $part = array_shift($parts);
198
199 1
            if (isset($array[$part]) && is_array($array[$part])) {
200 1
                $array =& $array[$part];
201
            }
202
        }
203
204 2
        unset($array[array_shift($parts)]);
205 2
    }
206
207
    /**
208
     * Port of array_key_exists to \ArrayAccess
209
     *
210
     * @param mixed $key The key to check if exists
211
     *
212
     * @return bool Does the key exist
213
     */
214 4
    public function arrayKeyExists($key)
215
    {
216 4
        if (array_key_exists($key, $this->content)) {
217 2
            return true;
218
        }
219
220 2
        $parts = explode('.', $key);
221 2
        $arr = $this->content;
222 2
        foreach ($parts as $part) {
223 2
            if (!is_array($arr) || !array_key_exists($part, $arr)) {
224 1
                return false;
225
            }
226
227 1
            $arr = $arr[$part];
228
        }
229
230 1
        return true;
231
    }
232
}
233