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

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/AsyncClient.php (5 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
declare(strict_types=1);
3
4
namespace ApiClients\Client\RabbitMQ\Management;
5
6
use ApiClients\Foundation\ClientInterface as FoundationClientInterface;
7
use ApiClients\Foundation\Factory;
8
use ApiClients\Foundation\Hydrator\CommandBus\Command\HydrateCommand;
9
use ApiClients\Foundation\Transport\CommandBus\Command\SimpleRequestCommand;
10
use function ApiClients\Tools\Rx\observableFromArray;
11
use Psr\Http\Message\ResponseInterface;
12
use React\EventLoop\LoopInterface;
13
use React\Promise\PromiseInterface;
14
use function React\Promise\resolve;
15
use Rx\Observable;
16
use Rx\ObservableInterface;
17
use Rx\React\Promise;
18
use Rx\Scheduler\EventLoopScheduler;
19
20
final class AsyncClient implements AsyncClientInterface
21
{
22
    /**
23
     * @var FoundationClientInterface
24
     */
25
    private $client;
26
27
    /**
28
     * @param FoundationClientInterface $client
29
     */
30
    private function __construct(FoundationClientInterface $client)
31
    {
32
        $this->client = $client;
33
    }
34
35
    /**
36
     * Create a new AsyncClient based on the loop and other options pass.
37
     *
38
     * @param  LoopInterface $loop
39
     * @param  string        $baseUrl
40
     * @param  string        $username
41
     * @param  string        $password
42
     * @param  array         $options
43
     * @return AsyncClient
44
     */
45
    public static function create(
46
        LoopInterface $loop,
47
        string $baseUrl,
48
        string $username,
49
        string $password,
50
        array $options = []
0 ignored issues
show
The parameter $options 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...
51
    ): self {
52
        $options = ApiSettings::getOptions($baseUrl, $username, $password, 'Async');
53
        $client = Factory::create($loop, $options);
54
55
        return new self($client);
56
    }
57
58
    /**
59
     * Create an AsyncClient from a ApiClients\Foundation\ClientInterface.
60
     * Be sure to pass in a client with the options from ApiSettings and the Async namespace suffix.
61
     *
62
     * @param  FoundationClientInterface $client
63
     * @return AsyncClient
64
     */
65
    public static function createFromClient(FoundationClientInterface $client): self
66
    {
67
        return new self($client);
68
    }
69
70
    /**
71
     * @return PromiseInterface
72
     */
73
    public function overview(): PromiseInterface
74
    {
75
        return $this->client->handle(
76
            new SimpleRequestCommand('overview')
77
        )->then(function (ResponseInterface $response) {
78
            return resolve($this->client->handle(
79
                new HydrateCommand('Overview', $response->getBody()->getParsedContents())
0 ignored issues
show
It seems like you code against a concrete implementation and not the interface Psr\Http\Message\StreamInterface as the method getParsedContents() does only exist in the following implementations of said interface: ApiClients\Middleware\Json\JsonStream.

Let’s take a look at an example:

interface User
{
    /** @return string */
    public function getPassword();
}

class MyUser implements User
{
    public function getPassword()
    {
        // return something
    }

    public function getDisplayName()
    {
        // return some name.
    }
}

class AuthSystem
{
    public function authenticate(User $user)
    {
        $this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
        // do something.
    }
}

In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break.

Available Fixes

  1. Change the type-hint for the parameter:

    class AuthSystem
    {
        public function authenticate(MyUser $user) { /* ... */ }
    }
    
  2. Add an additional type-check:

    class AuthSystem
    {
        public function authenticate(User $user)
        {
            if ($user instanceof MyUser) {
                $this->logger->info(/** ... */);
            }
    
            // or alternatively
            if ( ! $user instanceof MyUser) {
                throw new \LogicException(
                    '$user must be an instance of MyUser, '
                   .'other instances are not supported.'
                );
            }
    
        }
    }
    
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types inside the if block in such a case.
  1. Add the method to the interface:

    interface User
    {
        /** @return string */
        public function getPassword();
    
        /** @return string */
        public function getDisplayName();
    }
    
Loading history...
80
            ));
81
        });
82
    }
83
84
    /**
85
     * @param  int|null            $interval
86
     * @return ObservableInterface
87
     */
88
    public function queues(int $interval = null): ObservableInterface
89
    {
90
        if ($interval === null) {
91
            return Promise::toObservable($this->client->handle(
92
                new SimpleRequestCommand('queues')
93
            ))->flatMap(function (ResponseInterface $response) {
94
                return observableFromArray($response->getBody()->getParsedContents());
0 ignored issues
show
It seems like you code against a concrete implementation and not the interface Psr\Http\Message\StreamInterface as the method getParsedContents() does only exist in the following implementations of said interface: ApiClients\Middleware\Json\JsonStream.

Let’s take a look at an example:

interface User
{
    /** @return string */
    public function getPassword();
}

class MyUser implements User
{
    public function getPassword()
    {
        // return something
    }

    public function getDisplayName()
    {
        // return some name.
    }
}

class AuthSystem
{
    public function authenticate(User $user)
    {
        $this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
        // do something.
    }
}

In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break.

Available Fixes

  1. Change the type-hint for the parameter:

    class AuthSystem
    {
        public function authenticate(MyUser $user) { /* ... */ }
    }
    
  2. Add an additional type-check:

    class AuthSystem
    {
        public function authenticate(User $user)
        {
            if ($user instanceof MyUser) {
                $this->logger->info(/** ... */);
            }
    
            // or alternatively
            if ( ! $user instanceof MyUser) {
                throw new \LogicException(
                    '$user must be an instance of MyUser, '
                   .'other instances are not supported.'
                );
            }
    
        }
    }
    
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types inside the if block in such a case.
  1. Add the method to the interface:

    interface User
    {
        /** @return string */
        public function getPassword();
    
        /** @return string */
        public function getDisplayName();
    }
    
Loading history...
95
            })->flatMap(function ($queue) {
96
                return Promise::toObservable($this->client->handle(
97
                    new HydrateCommand('Queue', $queue)
98
                ));
99
            });
100
        }
101
102
        $scheduler = new EventLoopScheduler($this->client->getFromContainer(LoopInterface::class));
0 ignored issues
show
$this->client->getFromCo...p\LoopInterface::class) is of type *, but the function expects a callable.

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...
103
104
        return Observable::interval($interval * 1000, $scheduler)->flatMap(function () {
105
            return $this->queues();
106
        });
107
    }
108
109
    /**
110
     * @return ObservableInterface
111
     */
112
    public function connections(): ObservableInterface
113
    {
114
        return Promise::toObservable($this->client->handle(
115
            new SimpleRequestCommand('connections')
116
        ))->flatMap(function (ResponseInterface $response) {
117
            return observableFromArray($response->getBody()->getParsedContents());
0 ignored issues
show
It seems like you code against a concrete implementation and not the interface Psr\Http\Message\StreamInterface as the method getParsedContents() does only exist in the following implementations of said interface: ApiClients\Middleware\Json\JsonStream.

Let’s take a look at an example:

interface User
{
    /** @return string */
    public function getPassword();
}

class MyUser implements User
{
    public function getPassword()
    {
        // return something
    }

    public function getDisplayName()
    {
        // return some name.
    }
}

class AuthSystem
{
    public function authenticate(User $user)
    {
        $this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
        // do something.
    }
}

In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break.

Available Fixes

  1. Change the type-hint for the parameter:

    class AuthSystem
    {
        public function authenticate(MyUser $user) { /* ... */ }
    }
    
  2. Add an additional type-check:

    class AuthSystem
    {
        public function authenticate(User $user)
        {
            if ($user instanceof MyUser) {
                $this->logger->info(/** ... */);
            }
    
            // or alternatively
            if ( ! $user instanceof MyUser) {
                throw new \LogicException(
                    '$user must be an instance of MyUser, '
                   .'other instances are not supported.'
                );
            }
    
        }
    }
    
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types inside the if block in such a case.
  1. Add the method to the interface:

    interface User
    {
        /** @return string */
        public function getPassword();
    
        /** @return string */
        public function getDisplayName();
    }
    
Loading history...
118
        })->flatMap(function ($connection) {
119
            return Promise::toObservable($this->client->handle(
120
                new HydrateCommand('Connection', $connection)
121
            ));
122
        });
123
    }
124
}
125