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 (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.

src/Http/InputValidation.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
 *  Copyright (C) 2016 SURFnet.
4
 *
5
 *  This program is free software: you can redistribute it and/or modify
6
 *  it under the terms of the GNU Affero General Public License as
7
 *  published by the Free Software Foundation, either version 3 of the
8
 *  License, or (at your option) any later version.
9
 *
10
 *  This program is distributed in the hope that it will be useful,
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 *  GNU Affero General Public License for more details.
14
 *
15
 *  You should have received a copy of the GNU Affero General Public License
16
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
 */
18
19
namespace fkooman\RemoteStorage\Http;
20
21
use fkooman\RemoteStorage\Http\Exception\InputValidationException;
22
23
class InputValidation
24
{
25
    /**
26
     * @return string
27
     */
28
    public static function displayName($displayName)
29
    {
30
        $displayName = filter_var($displayName, FILTER_UNSAFE_RAW, FILTER_FLAG_STRIP_LOW);
31
32
        if (0 === mb_strlen($displayName)) {
33
            throw new InputValidationException('invalid "display_name"');
34
        }
35
36
        return $displayName;
37
    }
38
39
    /**
40
     * @return string
41
     */
42
    public static function commonName($commonName)
43
    {
44
        if (1 !== preg_match('/^[a-fA-F0-9]{32}$/', $commonName)) {
45
            throw new InputValidationException('invalid "common_name"');
46
        }
47
48
        return $commonName;
49
    }
50
51
    /**
52
     * @return string
53
     */
54
    public static function serverCommonName($serverCommonName)
55
    {
56
        if (1 !== preg_match('/^[a-zA-Z0-9-.]+$/', $serverCommonName)) {
57
            throw new InputValidationException('invalid "server_common_name"');
58
        }
59
60
        return $serverCommonName;
61
    }
62
63
    /**
64
     * @return string
65
     */
66
    public static function profileId($profileId)
67
    {
68
        if (1 !== preg_match('/^[a-zA-Z0-9]+$/', $profileId)) {
69
            throw new InputValidationException('invalid "profile_id"');
70
        }
71
72
        return $profileId;
73
    }
74
75
    /**
76
     * @return string
77
     */
78
    public static function instanceId($instanceId)
79
    {
80
        if (1 !== preg_match('/^[a-zA-Z0-9-.]+$/', $instanceId)) {
81
            throw new InputValidationException('invalid "instance_id"');
82
        }
83
84
        return $instanceId;
85
    }
86
87
    /**
88
     * @return string
89
     */
90
    public static function languageCode($languageCode)
91
    {
92
        $supportedLanguages = ['en_US', 'nl_NL', 'de_DE', 'fr_FR'];
93
        if (!in_array($languageCode, $supportedLanguages)) {
94
            throw new InputValidationException('invalid "language_code"');
95
        }
96
97
        return $languageCode;
98
    }
99
100
    /**
101
     * @return string
102
     */
103
    public static function totpSecret($totpSecret)
104
    {
105
        if (1 !== preg_match('/^[A-Z0-9]{16}$/', $totpSecret)) {
106
            throw new InputValidationException('invalid "totp_secret"');
107
        }
108
109
        return $totpSecret;
110
    }
111
112
    /**
113
     * @return string
114
     */
115
    public static function yubiKeyOtp($yubiKeyOtp)
116
    {
117
        if (1 !== preg_match('/^[a-z]{44}$/', $yubiKeyOtp)) {
118
            throw new InputValidationException('invalid "yubi_key_otp"');
119
        }
120
121
        return $yubiKeyOtp;
122
    }
123
124
    /**
125
     * @return string
126
     */
127
    public static function totpKey($totpKey)
128
    {
129
        if (1 !== preg_match('/^[0-9]{6}$/', $totpKey)) {
130
            throw new InputValidationException('invalid "totp_key"');
131
        }
132
133
        return $totpKey;
134
    }
135
136
    /**
137
     * @return string
138
     */
139
    public static function clientId($clientId)
140
    {
141
        if (1 !== preg_match('/^(?:[\x20-\x7E])+$/', $clientId)) {
142
            throw new InputValidationException('invalid "client_id"');
143
        }
144
145
        return $clientId;
146
    }
147
148
    /**
149
     * @return string
150
     */
151
    public static function userId($userId)
152
    {
153
        if (1 !== preg_match('/^[a-zA-Z0-9-.@]+$/', $userId)) {
154
            throw new InputValidationException('invalid "user_id"');
155
        }
156
157
        return $userId;
158
    }
159
160
    /**
161
     * @return int
162
     */
163
    public static function dateTime($dateTime)
164
    {
165
        // try to parse first
166
        if (false === $unixTime = strtotime($dateTime)) {
167
            // if that fails, check if it is already unixTime
168
            if (is_numeric($dateTime)) {
169
                $unixTime = (int) $dateTime;
170
                if (0 <= $unixTime) {
171
                    return $unixTime;
172
                }
173
            }
174
175
            throw new InputValidationException('invalid "date_time"');
176
        }
177
178
        return $unixTime;
179
    }
180
181
    /**
182
     * @return string
183
     */
184 View Code Duplication
    public static function ipAddress($ipAddress)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
185
    {
186
        if (false === filter_var($ipAddress, FILTER_VALIDATE_IP)) {
187
            throw new InputValidationException('invalid "ip_address"');
188
        }
189
190
        // normalize the IP address (only makes a difference for IPv6)
191
        return inet_ntop(inet_pton($ipAddress));
192
    }
193
194
    /**
195
     * @return string
196
     */
197
    public static function vootToken($vootToken)
198
    {
199
        if (1 !== preg_match('/^[a-zA-Z0-9-]+$/', $vootToken)) {
200
            throw new InputValidationException('invalid "voot_token"');
201
        }
202
203
        return $vootToken;
204
    }
205
206
    /**
207
     * @return string
208
     */
209
    public static function ip4($ip4)
210
    {
211
        if (false === filter_var($ip4, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
212
            throw new InputValidationException('invalid "ip4"');
213
        }
214
215
        return $ip4;
216
    }
217
218
    /**
219
     * @return string
220
     */
221 View Code Duplication
    public static function ip6($ip6)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
222
    {
223
        if (false === filter_var($ip6, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
224
            throw new InputValidationException('invalid "ip6"');
225
        }
226
227
        // normalize the IPv6 address
228
        return inet_ntop(inet_pton($ip6));
229
    }
230
231
    /**
232
     * @return int
233
     */
234
    public static function connectedAt($connectedAt)
235
    {
236
        if (!is_numeric($connectedAt) || 0 > intval($connectedAt)) {
237
            throw new InputValidationException('invalid "connected_at"');
238
        }
239
240
        return intval($connectedAt);
241
    }
242
243
    /**
244
     * @return int
245
     */
246
    public static function disconnectedAt($disconnectedAt)
247
    {
248
        if (!is_numeric($disconnectedAt) || 0 > intval($disconnectedAt)) {
249
            throw new InputValidationException('invalid "disconnected_at"');
250
        }
251
252
        return intval($disconnectedAt);
253
    }
254
255
    /**
256
     * @return int
257
     */
258
    public static function bytesTransferred($bytesTransferred)
259
    {
260
        if (!is_numeric($bytesTransferred) || 0 > intval($bytesTransferred)) {
261
            throw new InputValidationException('invalid "bytes_transferred"');
262
        }
263
264
        return intval($bytesTransferred);
265
    }
266
267
    /**
268
     * @return string
269
     */
270
    public static function twoFactorType($twoFactorType)
271
    {
272
        if ('totp' !== $twoFactorType && 'yubi' !== $twoFactorType) {
273
            throw new InputValidationException('invalid "two_factor_type"');
274
        }
275
276
        return $twoFactorType;
277
    }
278
279
    /**
280
     * @return string
281
     */
282
    public static function twoFactorValue($twoFactorValue)
283
    {
284
        if (!is_string($twoFactorValue) || 0 >= strlen($twoFactorValue)) {
285
            throw new InputValidationException('invalid "two_factor_value"');
286
        }
287
288
        return $twoFactorValue;
289
    }
290
291
    /**
292
     * @return int
293
     */
294
    public static function messageId($messageId)
295
    {
296
        if (!is_numeric($messageId) || 0 >= $messageId) {
297
            throw new InputValidationException('invalid "message_id"');
298
        }
299
300
        return (int) $messageId;
301
    }
302
303
    /**
304
     * @return string
305
     */
306
    public static function messageType($messageType)
307
    {
308
        if ('motd' !== $messageType && 'notification' !== $messageType && 'maintenance' !== $messageType) {
309
            throw new InputValidationException('invalid "message_type"');
310
        }
311
312
        return $messageType;
313
    }
314
}
315