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 (2)

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/Request.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
 * The MIT License
4
 * Copyright (c) 2007 Andy Smith
5
 */
6
namespace Abraham\TwitterOAuth;
7
8
class Request
9
{
10
    protected $parameters;
11
    protected $httpMethod;
12
    protected $httpUrl;
13
    public static $version = '1.0';
14
15
    /**
16
     * Constructor
17
     *
18
     * @param string     $httpMethod
19
     * @param string     $httpUrl
20
     * @param array|null $parameters
21
     */
22
    public function __construct($httpMethod, $httpUrl, array $parameters = [])
23
    {
24
        $parameters = array_merge(Util::parseParameters(parse_url($httpUrl, PHP_URL_QUERY)), $parameters);
0 ignored issues
show
It seems like parse_url($httpUrl, PHP_URL_QUERY) targeting parse_url() can also be of type false; however, Abraham\TwitterOAuth\Util::parseParameters() does only seem to accept string, did you maybe forget to handle an error condition?
Loading history...
25
        $this->parameters = $parameters;
26
        $this->httpMethod = $httpMethod;
27
        $this->httpUrl = $httpUrl;
28
    }
29
30
    /**
31
     * pretty much a helper function to set up the request
32
     *
33
     * @param Consumer $consumer
34
     * @param Token    $token
35
     * @param string   $httpMethod
36
     * @param string   $httpUrl
37
     * @param array    $parameters
38
     *
39
     * @return Request
40
     */
41
    public static function fromConsumerAndToken(
42
        Consumer $consumer,
43
        Token $token = null,
44
        $httpMethod,
45
        $httpUrl,
46
        array $parameters = []
47
    ) {
48
        $defaults = [
49
            "oauth_version" => Request::$version,
50
            "oauth_nonce" => Request::generateNonce(),
51
            "oauth_timestamp" => time(),
52
            "oauth_consumer_key" => $consumer->key
53
        ];
54
        if (null !== $token) {
55
            $defaults['oauth_token'] = $token->key;
56
        }
57
58
        $parameters = array_merge($defaults, $parameters);
59
60
        return new Request($httpMethod, $httpUrl, $parameters);
61
    }
62
63
    /**
64
     * @param string $name
65
     * @param string $value
66
     */
67
    public function setParameter($name, $value)
68
    {
69
        $this->parameters[$name] = $value;
70
    }
71
72
    /**
73
     * @param $name
74
     *
75
     * @return string|null
76
     */
77
    public function getParameter($name)
78
    {
79
        return isset($this->parameters[$name]) ? $this->parameters[$name] : null;
80
    }
81
82
    /**
83
     * @return array
84
     */
85
    public function getParameters()
86
    {
87
        return $this->parameters;
88
    }
89
90
    /**
91
     * @param $name
92
     */
93
    public function removeParameter($name)
94
    {
95
        unset($this->parameters[$name]);
96
    }
97
98
    /**
99
     * The request parameters, sorted and concatenated into a normalized string.
100
     *
101
     * @return string
102
     */
103
    public function getSignableParameters()
104
    {
105
        // Grab all parameters
106
        $params = $this->parameters;
107
108
        // Remove oauth_signature if present
109
        // Ref: Spec: 9.1.1 ("The oauth_signature parameter MUST be excluded.")
110
        if (isset($params['oauth_signature'])) {
111
            unset($params['oauth_signature']);
112
        }
113
114
        return Util::buildHttpQuery($params);
115
    }
116
117
    /**
118
     * Returns the base string of this request
119
     *
120
     * The base string defined as the method, the url
121
     * and the parameters (normalized), each urlencoded
122
     * and the concated with &.
123
     *
124
     * @return string
125
     */
126
    public function getSignatureBaseString()
127
    {
128
        $parts = [
129
            $this->getNormalizedHttpMethod(),
130
            $this->getNormalizedHttpUrl(),
131
            $this->getSignableParameters()
132
        ];
133
134
        $parts = Util::urlencodeRfc3986($parts);
135
136
        return implode('&', $parts);
137
    }
138
139
    /**
140
     * Returns the HTTP Method in uppercase
141
     *
142
     * @return string
143
     */
144
    public function getNormalizedHttpMethod()
145
    {
146
        return strtoupper($this->httpMethod);
147
    }
148
149
    /**
150
     * parses the url and rebuilds it to be
151
     * scheme://host/path
152
     *
153
     * @return string
154
     */
155
    public function getNormalizedHttpUrl()
156
    {
157
        $parts = parse_url($this->httpUrl);
158
159
        $scheme = $parts['scheme'];
160
        $host = strtolower($parts['host']);
161
        $path = $parts['path'];
162
163
        return "$scheme://$host$path";
164
    }
165
166
    /**
167
     * Builds a url usable for a GET request
168
     *
169
     * @return string
170
     */
171
    public function toUrl()
172
    {
173
        $postData = $this->toPostdata();
174
        $out = $this->getNormalizedHttpUrl();
175
        if ($postData) {
176
            $out .= '?' . $postData;
177
        }
178
        return $out;
179
    }
180
181
    /**
182
     * Builds the data one would send in a POST request
183
     *
184
     * @return string
185
     */
186
    public function toPostdata()
187
    {
188
        return Util::buildHttpQuery($this->parameters);
189
    }
190
191
    /**
192
     * Builds the Authorization: header
193
     *
194
     * @return string
195
     * @throws TwitterOAuthException
196
     */
197
    public function toHeader()
198
    {
199
        $first = true;
200
        $out = 'Authorization: OAuth';
201
        foreach ($this->parameters as $k => $v) {
202
            if (substr($k, 0, 5) != "oauth") {
203
                continue;
204
            }
205
            if (is_array($v)) {
206
                throw new TwitterOAuthException('Arrays not supported in headers');
207
            }
208
            $out .= ($first) ? ' ' : ', ';
209
            $out .= Util::urlencodeRfc3986($k) . '="' . Util::urlencodeRfc3986($v) . '"';
210
            $first = false;
211
        }
212
        return $out;
213
    }
214
215
    /**
216
     * @return string
217
     */
218
    public function __toString()
219
    {
220
        return $this->toUrl();
221
    }
222
223
    /**
224
     * @param SignatureMethod $signatureMethod
225
     * @param Consumer        $consumer
226
     * @param Token           $token
227
     */
228
    public function signRequest(SignatureMethod $signatureMethod, Consumer $consumer, Token $token = null)
229
    {
230
        $this->setParameter("oauth_signature_method", $signatureMethod->getName());
231
        $signature = $this->buildSignature($signatureMethod, $consumer, $token);
232
        $this->setParameter("oauth_signature", $signature);
233
    }
234
235
    /**
236
     * @param SignatureMethod $signatureMethod
237
     * @param Consumer        $consumer
238
     * @param Token           $token
239
     *
240
     * @return string
241
     */
242
    public function buildSignature(SignatureMethod $signatureMethod, Consumer $consumer, Token $token = null)
243
    {
244
        return $signatureMethod->buildSignature($this, $consumer, $token);
245
    }
246
247
    /**
248
     * @return string
249
     */
250
    public static function generateNonce()
251
    {
252
        return md5(microtime() . mt_rand());
253
    }
254
}
255