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

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/Pinterest/Auth/PinterestOAuth.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
 * Copyright 2015 Dirk Groenen
4
 *
5
 * (c) Dirk Groenen <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace DirkGroenen\Pinterest\Auth;
12
13
use DirkGroenen\Pinterest\Transport\Request;
14
use DirkGroenen\Pinterest\Exceptions\PinterestException;
15
16
class PinterestOAuth {
17
18
    /**
19
     * The application ID
20
     *
21
     * @var string
22
     */
23
    private $client_id;
24
25
    /**
26
     * The app secret
27
     *
28
     * @var string
29
     */
30
    private $client_secret;
31
32
    /**
33
     * Random string indicating the state
34
     * to prevent spoofing
35
     *
36
     * @var void
37
     */
38
    private $state;
39
40
    /**
41
     * A reference to the request instance
42
     *
43
     * @var Request
44
     */
45
    private $request;
46
47
    /**
48
     * Pinterest's oauth endpoint
49
     */
50
    const AUTH_HOST = "https://api.pinterest.com/oauth/";
51
52
    /**
53
     * Construct
54
     *
55
     * @param  string   $client_id
56
     * @param  string   $client_secret
57
     * @param  Request  $request
58
     */
59 43
    public function __construct($client_id, $client_secret, $request)
60
    {
61 43
        $this->client_id = $client_id;
62 43
        $this->client_secret = $client_secret;
63
64
        // Generate and set the state
65 43
        $this->state = $this->generateState();
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->generateState() of type string is incompatible with the declared type null of property $state.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
66
67
        // Set request instance
68 43
        $this->request = $request;
69 43
    }
70
71
    /**
72
     * Returns the login url
73
     *
74
     * @access public
75
     * @param  array    $scopes
76
     * @param  string   $redirect_uri
77
     * @return string
78
     */
79
    public function getLoginUrl($redirect_uri, $scopes = array("read_public"), $response_type = "code")
80
    {
81
        $queryparams = array(
82
            "response_type"     => $response_type,
83
            "redirect_uri"      => $redirect_uri,
84
            "client_id"         => $this->client_id,
85
            "scope"             => implode(",", $scopes),
86
            "state"             => $this->state
87
        );
88
89
        // Build url and return it
90
        return sprintf("%s?%s", self::AUTH_HOST, http_build_query($queryparams));
91
    }
92
93
    /**
94
     * Generates a random string and returns is
95
     *
96
     * @access private
97
     * @return string       random string
98
     */
99 43
    private function generateState()
100
    {
101 43
        return substr(md5(rand()), 0, 7);
102
    }
103
104
    /**
105
     * Get the generated state
106
     *
107
     * @return string
108
     */
109 2
    public function getState()
110
    {
111 2
        return $this->state;
112
    }
113
114
    /**
115
     * Set a state manually
116
     *
117
     * @param  string    $state
118
     * @return void
119
     */
120 1
    public function setState($state)
121
    {
122 1
        $this->state = $state;
0 ignored issues
show
Documentation Bug introduced by
It seems like $state of type string is incompatible with the declared type null of property $state.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
123 1
    }
124
125
    /**
126
     * Change the code for an access_token
127
     *
128
     * @param  string   $code
129
     * @return \DirkGroenen\Pinterest\Transport\Response
130
     */
131
    public function getOAuthToken($code)
132
    {
133
        // Build data array
134
        $data = array(
135
            "grant_type"    => "authorization_code",
136
            "client_id"     => $this->client_id,
137
            "client_secret" => $this->client_secret,
138
            "code"          => $code
139
        );
140
141
        // Perform post request
142
        $response = $this->request->post("oauth/token", $data);
143
144
        return $response;
145
    }
146
147
    /**
148
     * Set the access_token for further requests
149
     *
150
     * @access public
151
     * @param  string   $access_token
152
     * @return void
153
     */
154 43
    public function setOAuthToken($access_token)
155
    {
156 43
        $this->request->setAccessToken($access_token);
157
    }
158
}