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

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/EvangelistStatus.php (1 issue)

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
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 23 and the first side effect is on line 5.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
3
namespace Laztopaz\OpenSourceEvangelistStatus;
4
5
error_reporting(0);
6
7
/**
8
 * @package  Laztopaz\OpenSourceEvangelistStatus
9
 * @author   Temitope Olotin <[email protected]>
10
 * @license  <https://opensource.org/license/MIT> MIT
11
 */
12
13
use Dotenv\Dotenv;
14
use GuzzleHttp\Client;
15
use Laztopaz\OpenSourceEvangelistStatus\EvangelistStatusInterface;
16
use Laztopaz\OpenSourceEvangelistStatus\EvangelistStatusRanking;
17
use Laztopaz\OpenSourceEvangelistStatus\EvangelistStatusException;
18
use Laztopaz\OpenSourceEvangelistStatus\NullNoOfReposException;
19
use Laztopaz\OpenSourceEvangelistStatus\ArgumentCheckException;
20
use Exception;
21
22
23
class EvangelistStatus implements EvangelistStatusInterface
24
{
25
    protected  $githubApi;
26
    public     $username;
27
    private    $response;
28
    private    $clientId;
29
    private    $clientSecret;
30
    private    $guzzleClient;
31
    private    $githubResponse;
32
    private    $noOfGitRepos;
33
	
34
    public function __construct($username)
35
    { 
36
        $this->username                         = $username;
37
38
        $num_args = (int) func_num_args(); // get number of arguments passed to 
39
40
        if ($num_args == 0 ||  $num_args > 1) {
41
            throw ArgumentCheckException::NullOfOverflowArgumentException("Argument missing: only one argument is allowed");
42
        }
43
      
44
        $this->username                         = $username;
45
        
46
47
        $this->checkNullUsernameException();
48
49
        $this->clientId                         = getenv('ClientID'); // get the GitHub client id
50
        $this->clientSecret                     = getenv('ClientSecret'); // get the GitHub client secret
51
52
        $this->guzzleClient                     = new Client();
53
54
        $this->githubResponse                   = $this->getGitApiData(); // return GitHub jsonObject
55
        $this->noOfGitRepos                     = $this->getNumberOfRepos(); // return number of repo the user has
56
    }
57
58
    /**
59
     * This method returns Github JSON data 
60
     * @param    void
61
     * @return   response 
62
     */
63
    public function getGitApiData()
64
    {
65
        $this->response = $this->guzzleClient->get('https://api.github.com/users/'.$this->username.'?client_id='.$this->clientId .'&client_secret='.$this->clientSecret);
66
        return $this->response->getBody();
67
    }
68
69
    /**
70
     * This method returns number of the user repo on Github
71
     * @param void
72
     * @return public_repos
73
     */
74
    public function getNumberOfRepos()
75
    {
76
        $githubJson = json_decode($this->githubResponse, true);
77
78
        if (EvangelistStatusRanking::checkForNullRepos($githubJson)) {
79
            throw NullNoOfReposException::createNullReposException("Empty GitHub repository");
80
        }
81
        return $githubJson['public_repos'];
82
    }
83
84
    /**
85
     * This method returns a string depending on number of user repositories on Github
86
     * @param void 
87
     * @return string evangelistRanking
88
     */
89
    public function getStatus()
90
    {
91
        return EvangelistStatusRanking::determineEvangelistLevel($this->noOfGitRepos); 
92
    }
93
94
    /**
95
     * This method checks for empty GitHub username
96
     * @param string $username
97
     * @return boolean
98
     */
99
    public function checkEmptyGithubUsername($username)
100
    {
101
        if ($username == "") {
102
            return true;
103
        }
104
        return false;
105
    }
106
107
    /**
108
     * This method checks for null argument 
109
     * @return exception
110
     */
111
    public function checkNullUsernameException()
112
    {
113
        if ($this->checkEmptyGithubUsername($this->username)) {
114
            throw EvangelistStatusException::createEvangelistStatusException("Username is Empty, please provide a GitHub valid username");
115
        }
116
    }
117
}  
118