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

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/Common/Resource/HasWaiterTrait.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 declare(strict_types=1);
2
3
namespace OpenStack\Common\Resource;
4
5
use OpenStack\Common\Error\BadResponseError;
6
7
/**
8
 * Contains reusable functionality for resources that have long operations which require waiting in
9
 * order to reach a particular state.
10
 *
11
 * @codeCoverageIgnore
12
 *
13
 * @package OpenStack\Common\Resource
14
 */
15
trait HasWaiterTrait
16
{
17
    /**
18
     * Provides a blocking operation until the resource has reached a particular state. The method
19
     * will enter a loop, requesting feedback from the remote API until it sends back an appropriate
20
     * status.
21
     *
22
     * @param string $status      The state to be reached
23
     * @param int    $timeout     The maximum timeout. If the total time taken by the waiter has reached
24
     *                            or exceed this timeout, the blocking operation will immediately cease.
25
     * @param int    $sleepPeriod The amount of time to pause between each HTTP request.
26
     */
27
    public function waitUntil(string $status, $timeout = 60, int $sleepPeriod = 1)
28
    {
29
        $startTime = time();
30
31
        while (true) {
32
            $this->retrieve();
0 ignored issues
show
It seems like retrieve() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
33
34
            if ($this->status == $status || $this->shouldHalt($timeout, $startTime)) {
0 ignored issues
show
The property status does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
35
                break;
36
            }
37
38
            sleep($sleepPeriod);
39
        }
40
    }
41
42
    /**
43
     * Provides a blocking operation until the resource has reached a particular state. The method
44
     * will enter a loop, executing the callback until TRUE is returned. This provides great
45
     * flexibility.
46
     *
47
     * @param callable $fn          An anonymous function that will be executed on every iteration. You can
48
     *                              encapsulate your own logic to determine whether the resource has
49
     *                              successfully transitioned. When TRUE is returned by the callback,
50
     *                              the loop will end.
51
     * @param int|bool $timeout     The maximum timeout in seconds. If the total time taken by the waiter has reached
52
     *                              or exceed this timeout, the blocking operation will immediately cease. If FALSE
53
     *                              is provided, the timeout will never be considered.
54
     * @param int      $sleepPeriod The amount of time to pause between each HTTP request.
55
     */
56
    public function waitWithCallback(callable $fn, $timeout = 60, int $sleepPeriod = 1)
57
    {
58
        $startTime = time();
59
60
        while (true) {
61
            $this->retrieve();
0 ignored issues
show
It seems like retrieve() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
62
63
            $response = call_user_func_array($fn, [$this]);
64
65
            if ($response === true || $this->shouldHalt($timeout, $startTime)) {
66
                break;
67
            }
68
69
            sleep($sleepPeriod);
70
        }
71
    }
72
73
    /**
74
     * Internal method used to identify whether a timeout has been exceeded.
75
     *
76
     * @param bool|int $timeout
77
     * @param int      $startTime
78
     *
79
     * @return bool
80
     */
81
    private function shouldHalt($timeout, int $startTime)
82
    {
83
        if ($timeout === false) {
84
            return false;
85
        }
86
87
        return time() - $startTime >= $timeout;
88
    }
89
90
    /**
91
     * Convenience method providing a blocking operation until the resource transitions to an
92
     * ``ACTIVE`` status.
93
     *
94
     * @param int|bool $timeout The maximum timeout in seconds. If the total time taken by the waiter has reached
95
     *                          or exceed this timeout, the blocking operation will immediately cease. If FALSE
96
     *                          is provided, the timeout will never be considered.
97
     */
98
    public function waitUntilActive($timeout = false)
99
    {
100
        $this->waitUntil('ACTIVE', $timeout);
0 ignored issues
show
It seems like $timeout defined by parameter $timeout on line 98 can also be of type boolean; however, OpenStack\Common\Resourc...aiterTrait::waitUntil() does only seem to accept integer, maybe add an additional type check?

This check looks at variables that have been passed in as parameters and are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
101
    }
102
103
    public function waitUntilDeleted($timeout = 60, int $sleepPeriod = 1)
104
    {
105
        $startTime = time();
106
107
        while (true) {
108
            try {
109
                $this->retrieve();
0 ignored issues
show
It seems like retrieve() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
110
            } catch (BadResponseError $e) {
111
                if ($e->getResponse()->getStatusCode() === 404) {
112
                    break;
113
                }
114
                throw $e;
115
            }
116
117
            if ($this->shouldHalt($timeout, $startTime)) {
118
                break;
119
            }
120
121
            sleep($sleepPeriod);
122
        }
123
    }
124
}
125