Issues (3)

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/Provider/EveOnline.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
namespace Evelabs\OAuth2\Client\Provider;
4
5
use League\OAuth2\Client\Provider\AbstractProvider;
6
use League\OAuth2\Client\Provider\Exception\IdentityProviderException;
7
use League\OAuth2\Client\Provider\ResourceOwnerInterface;
8
use League\OAuth2\Client\Token\AccessToken;
9
use League\OAuth2\Client\Tool\BearerAuthorizationTrait;
10
use Psr\Http\Message\ResponseInterface;
11
12
class EveOnline extends AbstractProvider
13
{
14
    use BearerAuthorizationTrait;
15
16
17
    /**
18
     * Default scopes
19
     *
20
     * @var array
21
     */
22
    public $defaultScopes = [];
23
24
    /**
25
     * Get the string used to separate scopes.
26
     *
27
     * @return string
28
     */
29 9
    protected function getScopeSeparator()
30
    {
31 9
        return ' ';
32
    }
33
34
    /**
35
     * Returns the base URL for authorizing a client.
36
     *
37
     * Eg. https://oauth.service.com/authorize
38
     *
39
     * @return string
40
     */
41 9
    public function getBaseAuthorizationUrl()
42
    {
43 9
        return 'https://login.eveonline.com/oauth/authorize';
44
    }
45
46
    /**
47
     * Returns the base URL for requesting an access token.
48
     *
49
     * Eg. https://oauth.service.com/token
50
     *
51
     * @param array $params
52
     * @return string
53
     */
54 21
    public function getBaseAccessTokenUrl(array $params)
55
    {
56 21
        return 'https://login.eveonline.com/oauth/token';
57
    }
58
59
    /**
60
     * Returns the URL for requesting the resource owner's details.
61
     *
62
     * @param AccessToken $token
63
     * @return string
64
     */
65 3
    public function getResourceOwnerDetailsUrl(AccessToken $token)
66
    {
67 3
        return 'https://login.eveonline.com/oauth/verify';
68
    }
69
70
    /**
71
     * Returns the default scopes used by this provider.
72
     *
73
     * This should only be the scopes that are required to request the details
74
     * of the resource owner, rather than all the available scopes.
75
     *
76
     * @return array
77
     */
78 6
    protected function getDefaultScopes()
79
    {
80 6
        return $this->defaultScopes;
81
    }
82
83
    /**
84
     * Checks a provider response for errors.
85
     *
86
     * @throws IdentityProviderException
87
     * @param  ResponseInterface $response
88
     * @param  array|string $data Parsed response data
89
     * @return void
90
     */
91 21
    protected function checkResponse(ResponseInterface $response, $data)
92
    {
93
        //not throwing anything for 2xx responses
94 21
        if (intval(substr($response->getStatusCode(), 0, 1)) === 2) {
95 12
            return;
96
        }
97
98 9
        $message = $this->safeRead($data, 'error_description') || $this->safeRead($data, 'message');
99 9
        throw new IdentityProviderException(
100 9
            $message ?: $response->getReasonPhrase(),
0 ignored issues
show
It seems like $message ?: $response->getReasonPhrase() can also be of type boolean; however, League\OAuth2\Client\Pro...xception::__construct() does only seem to accept string, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
101 9
            $response->getStatusCode(),
102
            $response
0 ignored issues
show
$response is of type object<Psr\Http\Message\ResponseInterface>, but the function expects a array|string.

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 6
        );
104
    }
105
106
    /**
107
     * Generates a resource owner object from a successful resource owner
108
     * details request.
109
     *
110
     * @param  array $response
111
     * @param  AccessToken $token
112
     * @return ResourceOwnerInterface
113
     */
114 3
    protected function createResourceOwner(array $response, AccessToken $token)
115
    {
116 3
        return new EveOnlineResourceOwner($response);
117
    }
118
119
    /**
120
     * Internal helper function to safe read from an array
121
     * @param mixed $array
122
     * @param string|int $key
123
     * @return null
124
     */
125 9
    private function safeRead($array, $key)
126
    {
127 9
        return !empty($array[$key]) ? $array[$key] : null;
128
    }
129
}
130