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

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/RequestFactory.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 ReactGuzzleRing.
5
 *
6
 ** (c) 2014 Cees-Jan Kiewiet
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
namespace WyriHaximus\React\Guzzle\HttpClient;
12
13
use Clue\React\Buzz\Browser;
14
use Clue\React\Buzz\Io\Sender;
15
use Clue\React\HttpProxy\ProxyConnector as HttpProxyClient;
16
use Clue\React\Socks\Client as SocksProxyClient;
17
use Psr\Http\Message\RequestInterface;
18
use React\Dns\Resolver\Resolver;
19
use React\EventLoop\LoopInterface;
20
use React\HttpClient\Client as HttpClient;
21
use React\Promise\Deferred;
22
use React\Socket\Connector;
23
use React\Socket\TimeoutConnector;
24
use React\Stream\ReadableStreamInterface;
25
use React\Stream\WritableResourceStream;
26
use ReflectionObject;
27
28
/**
29
 * Class RequestFactory
30
 *
31
 * @package WyriHaximus\React\Guzzle\HttpClient
32
 */
33
class RequestFactory
34
{
35
    /**
36
     *
37
     * @param RequestInterface $request
38
     * @param array $options
39
     * @param $resolver Resolver
40
     * @param HttpClient $httpClient
41
     * @param LoopInterface $loop
42
     * @return \React\Promise\Promise
43
     */
44 1
    public function create(
45
        RequestInterface $request,
46
        array $options,
47
        Resolver $resolver,
0 ignored issues
show
The parameter $resolver is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
48
        HttpClient $httpClient,
49
        LoopInterface $loop
50
    ) {
51 1
        $options = $this->convertOptions($options);
52
53 1
        if (isset($options['delay'])) {
54
            $promise = \WyriHaximus\React\timedPromise($loop, $options['delay']);
55
        }
56 1
        if (!isset($promise)) {
57 1
            $promise = \WyriHaximus\React\futurePromise($loop);
58 1
        }
59
        
60
        return $promise->then(function () use (
61 1
            $request,
62 1
            $options,
63 1
            $httpClient,
64 1
            $loop
65
        ) {
66 1
            $sender = $this->createSender($options, $httpClient, $loop);
67 1
            return (new Browser($loop, $sender))
0 ignored issues
show
$sender is of type object<Clue\React\Buzz\Io\Sender>, but the function expects a null|object<React\Socket\ConnectorInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
68 1
                ->withOptions($options)
69
                ->send($request)->then(function ($response) use ($loop, $options) {
70
                    if (!isset($options['sink'])) {
71
                        return \React\Promise\resolve($response);
72
                    }
73
74
                    return \React\Promise\resolve($this->sink($loop, $response, $options['sink']));
75 1
                });
76 1
        });
77
    }
78
79
    protected function sink($loop, $response, $target)
80
    {
81
        $deferred = new Deferred();
82
        $writeStream = fopen($target, 'w');
83
        $saveToStream = new WritableResourceStream($writeStream, $loop);
84
85
        $saveToStream->on(
86
            'end',
87
            function () use ($deferred, $response) {
88
                $deferred->resolve($response);
89
            }
90
        );
91
92
        $body = $response->getBody();
93
        if ($body instanceof ReadableStreamInterface) {
94
            $body->pipe($saveToStream);
95
        } else {
96
            $saveToStream->end($body->getContents());
97
        }
98
99
        return $deferred->promise();
100
    }
101
102
    /**
103
     * @param array $options
104
     * @param HttpClient $httpClient
105
     * @param LoopInterface $loop
106
     * @return Sender
107
     */
108 1
    protected function createSender(array $options, HttpClient $httpClient, LoopInterface $loop)
109
    {
110 1
        $connector = $this->getProperty($httpClient, 'connector');
111
112 1
        if (isset($options['proxy'])) {
113
            switch (parse_url($options['proxy'], PHP_URL_SCHEME)) {
114
                case 'http':
115
                    $connector = new Connector(
116
                        $loop,
117
                        [
118
                            'tcp' => new HttpProxyClient(
119
                                $options['proxy'],
120
                                $connector
121
                            ),
122
                        ]
123
                    );
124
                    break;
125
                case 'socks':
126
                case 'socks4':
127
                case 'socks4a':
128
                case 'socks5':
129
                    $connector = new Connector(
130
                        $loop,
131
                        [
132
                            'tcp' => new SocksProxyClient(
133
                                $options['proxy'],
134
                                $connector
135
                            ),
136
                        ]
137
                    );
138
                    break;
139
            }
140
        }
141
142 1
        if (isset($options['connect_timeout'])) {
143
            $connector = new TimeoutConnector($connector, $options['connect_timeout'], $loop);
144
        }
145
146 1
        return $connector;
147
    }
148
149
    /**
150
     * @param array $options
151
     * @return array
152
     */
153 1
    protected function convertOptions(array $options)
154
    {
155
        // provides backwards compatibility for Guzzle 3-5.
156 1
        if (isset($options['client'])) {
157
            $options = array_merge($options, $options['client']);
158
            unset($options['client']);
159
        }
160
161
        // provides for backwards compatibility for Guzzle 3-5
162 1
        if (isset($options['save_to'])) {
163
            $options['sink'] = $options['save_to'];
164
            unset($options['save_to']);
165
        }
166
167 1
        if (isset($options['delay'])) {
168
            $options['delay'] = $options['delay']/1000;
169
        }
170
        
171 1
        if (isset($options['allow_redirects'])) {
172
            $this->convertRedirectOption($options);
173
        }
174
175 1
        return $options;
176
    }
177
178
    protected function convertRedirectOption(&$options)
179
    {
180
        $option = $options['allow_redirects'];
181
        unset($options['allow_redirects']);
182
183
        if (is_bool($option)) {
184
            $options['followRedirects'] = $option;
185
            return;
186
        }
187
188
        if (is_array($option)) {
189
            if (isset($option['max'])) {
190
                $options['maxRedirects'] = $option['max'];
191
            }
192
            $options['followRedirects'] = true;
193
            return;
194
        }
195
    }
196
197
    /**
198
     * @param object $object
199
     * @param string $desiredProperty
200
     * @return mixed
201
     */
202 1
    protected function getProperty($object, $desiredProperty)
203
    {
204 1
        $reflection = new ReflectionObject($object);
205 1
        $property = $reflection->getProperty($desiredProperty);
206 1
        $property->setAccessible(true);
207 1
        return $property->getValue($object);
208
    }
209
}
210