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

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.

yii-debug-toolbar/YiiDebugToolbarRoute.php (9 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
 * YiiDebugToolbarRouter class file.
4
 *
5
 * @author Sergey Malyshev <[email protected]>
6
 */
7
8
/**
9
 * YiiDebugToolbarRouter represents an ...
10
 *
11
 * Description of YiiDebugToolbarRouter
12
 *
13
 * @author Sergey Malyshev <[email protected]>
14
 * @version $Id$
15
 * @package YiiDebugToolbar
16
 * @since 1.1.7
17
 */
18
class YiiDebugToolbarRoute extends CLogRoute
19
{
20
21
    private $_panels = array(
22
        'YiiDebugToolbarPanelServer',
23
        'YiiDebugToolbarPanelRequest',
24
        'YiiDebugToolbarPanelSettings',
25
        'YiiDebugToolbarPanelViewsRendering',
26
        'YiiDebugToolbarPanelSql',
27
        'YiiDebugToolbarPanelLogging',
28
    );
29
30
    /** 
31
     * The filters are given in an array, each filter being:
32
     * - a normal IP (192.168.0.10 or '::1')
33
     * - an incomplete IP (192.168.0.* or 192.168.0.)
34
     * - a CIDR mask (192.168.0.0/24)
35
     * - "*" for everything.
36
     */
37
    public $ipFilters=array('127.0.0.1','::1');
38
    
39
    /**
40
     * If true, then after reloading the page will open the current panel.
41
     * @var bool
42
     */
43
    public $openLastPanel = true;
44
45
    private $_toolbarWidget,
46
            $_startTime,
47
            $_endTime;
48
49
50
    private $_proxyMap = array(
51
        'viewRenderer' => 'YiiDebugViewRenderer'
52
    );
53
54
    public function setPanels(array $pannels)
55
    {
56
        $selfPanels = array_fill_keys($this->_panels, array());
57
        $this->_panels = array_merge($selfPanels, $pannels);
58
    }
59
60
    public function getPanels()
61
    {
62
        return $this->_panels;
63
    }
64
65
    public function getStartTime()
66
    {
67
        return $this->_startTime;
68
    }
69
70
    public function getEndTime()
71
    {
72
        return $this->_endTime;
73
    }
74
75
    public function getLoadTime()
76
    {
77
        return ($this->endTime-$this->startTime);
78
    }
79
80
    protected function getToolbarWidget()
81
    {
82
        if (null === $this->_toolbarWidget)
83
        {
84
            $this->_toolbarWidget = Yii::createComponent(array(
85
                'class'=>'YiiDebugToolbar',
86
                'panels'=> $this->panels
87
            ), $this);
88
        }
89
        return $this->_toolbarWidget;
90
    }
91
92
    public function init()
93
    {
94
        $this->_startTime=microtime(true);
95
96
        parent::init();
97
98
        $c = ($this->allowIp(Yii::app()->request->userHostAddress) && !Yii::app()->getRequest()->getIsAjaxRequest() && (Yii::app() instanceof CWebApplication));
0 ignored issues
show
The class CWebApplication does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
$c is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
99
        $h = $this->allowIp(Yii::app()->request->userHostAddress);
0 ignored issues
show
$h is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
100
        $a = !Yii::app()->getRequest()->getIsAjaxRequest();
0 ignored issues
show
$a is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
101
        $i = (Yii::app() instanceof CWebApplication);
0 ignored issues
show
The class CWebApplication does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
$i is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
102
103
        $this->enabled && $this->enabled = ($this->allowIp(Yii::app()->request->userHostAddress)
104
                && !Yii::app()->getRequest()->getIsAjaxRequest() && (Yii::app() instanceof CWebApplication));
0 ignored issues
show
The class CWebApplication does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
105
106
        if ($this->enabled)
107
        {
108
            Yii::app()->attachEventHandler('onBeginRequest', array($this, 'onBeginRequest'));
109
            Yii::app()->attachEventHandler('onEndRequest', array($this, 'onEndRequest'));
110
            Yii::setPathOfAlias('yii-debug-toolbar', dirname(__FILE__));
111
            Yii::app()->setImport(array(
112
                'yii-debug-toolbar.*',
113
                'yii-debug-toolbar.components.*'
114
            ));
115
            $this->categories = '';
116
            $this->levels='';
117
        }
118
    }
119
120
    protected function onBeginRequest(CEvent $event)
121
    {
122
        $this->initComponents();
123
124
        $this->getToolbarWidget()
125
             ->init();
126
    }
127
128
    protected function initComponents()
129
    {
130
        foreach ($this->_proxyMap as $name=>$class)
131
        {
132
            $instance = Yii::app()->getComponent($name);
133
            if (null !== ($instance))
134
            {
135
                Yii::app()->setComponent($name, null);
136
            }
137
            $this->_proxyMap[$name] = array(
138
                'class'=>$class,
139
                'instance' => $instance
140
            );
141
        }
142
        Yii::app()->setComponents($this->_proxyMap, false);
143
    }
144
145
146
    /**
147
     * Processes the current request.
148
     * It first resolves the request into controller and action,
149
     * and then creates the controller to perform the action.
150
     */
151
    private function processRequest()
0 ignored issues
show
This method is not used, and could be removed.
Loading history...
152
    {
153
        if(is_array(Yii::app()->catchAllRequest) && isset(Yii::app()->catchAllRequest[0]))
154
        {
155
            $route=Yii::app()->catchAllRequest[0];
156
            foreach(array_splice(Yii::app()->catchAllRequest,1) as $name=>$value)
157
                $_GET[$name]=$value;
158
        }
159
        else
160
            $route=Yii::app()->getUrlManager()->parseUrl(Yii::app()->getRequest());
161
        Yii::app()->runController($route);
162
    }
163
164
    protected function onEndRequest(CEvent $event)
165
    {
166
167
    }
168
169
    public function collectLogs($logger, $processLogs=false)
170
    {
171
        parent::collectLogs($logger, $processLogs);
172
    }
173
174
    protected function processLogs($logs)
175
    {
176
        $this->_endTime = microtime(true);
177
        $this->enabled && $this->getToolbarWidget()->run();
178
    }
179
180
    /**
181
     * Checks to see if the user IP is allowed by {@link ipFilters}.
182
     * @param string $ip the user IP
183
     * @return boolean whether the user IP is allowed by {@link ipFilters}.
184
     */
185
    protected function allowIp($ip)
186
    {
187
        foreach ($this->ipFilters as $filter)
188
        {
189
            $filter = trim($filter);
190
            // normal or incomplete IPv4
191
            if (preg_match('/^[\d\.]*\*?$/', $filter)) {
192
                $filter = rtrim($filter, '*');
193
                if (strncmp($ip, $filter, strlen($filter)) === 0)
194
                {
195
                    return true;
196
                }
197
            }
198
            // CIDR
199
            else if (preg_match('/^([\d\.]+)\/(\d+)$/', $filter, $match))
200
            {
201
                if (self::matchIpMask($ip, $match[1], $match[2]))
202
                {
203
                    return true;
204
                }
205
            }
206
            // IPv6
207
            else if ($ip === $filter)
208
            {
209
                return true;
210
            }
211
        }
212
        return false;
213
    }
214
215
    /**
216
     * Check if an IP matches a CIDR mask.
217
     *
218
     * @param integer|string $ip IP to check.
219
     * @param integer|string $matchIp Radical of the mask (e.g. 192.168.0.0).
0 ignored issues
show
There is no parameter named $matchIp. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
220
     * @param integer $maskBits Size of the mask (e.g. 24).
221
     */
222
    protected static function matchIpMask($ip, $maskIp, $maskBits)
223
    {
224
        $mask =~ (pow(2, 32-$maskBits)-1);
225
        if (false === is_int($ip))
226
        {
227
            $ip = ip2long($ip);
228
        }
229
        if (false === is_int($maskIp))
230
        {
231
            $maskIp = ip2long($maskIp);
232
        }
233
        if (($ip & $mask) === ($maskIp & $mask))
234
        {
235
            return true;
236
        } else {
237
            return false;
238
        }
239
    }
240
}