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/Provider/SinaWeibo.php (2 issues)

Labels
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
 * Created by PhpStorm.
4
 * User: xiabin
5
 * Date: 16/6/24
6
 * Time: 下午7:12
7
 */
8
9
10
namespace Xiabin\OAuth2\Client\Provider;
11
12
use League\OAuth2\Client\Provider\AbstractProvider;
13
use Psr\Http\Message\ResponseInterface;
14
use GuzzleHttp\Client as HttpClient;
15
use Xiabin\OAuth2\Client\Provider\Exception;
16
use Xiabin\OAuth2\Client\Provider\Exception\SinaWeiboIdentityProviderException;
17
use League\OAuth2\Client\Token\AccessToken;
18
19
/**
20
 * Class SinaWeibo
21
 * @package League\OAuth2\Client\Provider
22
 */
23
class SinaWeibo extends AbstractProvider
24
{
25
26
27
    /**
28
     * Returns the base URL for authorizing a client.
29
     *
30
     * Eg. https://oauth.service.com/authorize
31
     *
32
     * @return string
33
     */
34 6
    public function getBaseAuthorizationUrl()
35
    {
36 6
        return "https://api.weibo.com/oauth2/authorize";
37
    }
38
39
    /**
40
     * Returns the base URL for requesting an access token.
41
     *
42
     * Eg. https://oauth.service.com/token
43
     *
44
     * @param array $params
45
     * @return string
46
     */
47 12
    public function getBaseAccessTokenUrl(array $params)
48
    {
49 12
        return 'https://api.weibo.com/oauth2/access_token?' . http_build_query([
50 12
            'client_id' => $params['client_id'],
51 12
            'client_secret' => $params['client_secret'],
52 12
            'grant_type' => $params['grant_type'],
53 12
            'redirect_uri' => $params['redirect_uri'],
54 12
            'code' => $params['code']
55 8
        ]);
56
57
    }
58
59
    /**
60
     * Returns the URL for requesting the resource owner's details.
61
     *
62
     * @param AccessToken $token
63
     * @return string
64
     */
65
    public function getResourceOwnerDetailsUrl(AccessToken $token)
66
    {
67
        // 暂不使用
68
    }
69
70
71
    /**
72
     * Returns the default scopes used by this provider.
73
     *
74
     * This should only be the scopes that are required to request the details
75
     * of the resource owner, rather than all the available scopes.
76
     *
77
     * @return array
78
     */
79 6
    protected function getDefaultScopes()
80
    {
81
        // 暂不使用
82 6
    }
83
84
    /**
85
     * Checks a provider response for errors.
86
     * @param ResponseInterface $response
87
     * @param array|string $data
88
     * @throws \League\OAuth2\Client\Provider\Exception\IdentityProviderException
89
     */
90 9
    protected function checkResponse(ResponseInterface $response, $data)
91
    {
92 9
        if ($response->getStatusCode() >= 400) {
93 3
            throw SinaWeiboIdentityProviderException::clientException($response, $data);
0 ignored issues
show
It seems like $data defined by parameter $data on line 90 can also be of type array; however, Xiabin\OAuth2\Client\Pro...tion::clientException() does only seem to accept string, 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...
94 6
        } elseif (isset($data['error'])) {
95 3
            throw SinaWeiboIdentityProviderException::oauthException($response, $data);
0 ignored issues
show
It seems like $data defined by parameter $data on line 90 can also be of type array; however, Xiabin\OAuth2\Client\Pro...ption::oauthException() does only seem to accept string, 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...
96
        }
97 3
    }
98
99
    /**
100
     * Generates a resource owner object from a successful resource owner
101
     * details request.
102
     *
103
     * @param  array $response
104
     * @param  AccessToken $token
105
     * @return \League\OAuth2\Client\Provider\ResourceOwnerInterface
106
     */
107
    protected function createResourceOwner(array $response, AccessToken $token)
108
    {
109
        // 暂不使用.
110
    }
111
}
112