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

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.

application/slider/SliderWidget.php (3 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 app\slider;
4
5
use app;
6
use app\models\Slider;
7
use devgroup\TagDependencyHelper\ActiveRecordHelper;
8
use Yii;
9
use yii\base\InvalidConfigException;
10
use yii\base\Widget;
11
use yii\helpers\ArrayHelper;
12
use yii\helpers\Json;
13
14
/**
15
 * Slider widget
16
 * @package app\slider\sliders
17
 */
18
class SliderWidget extends Widget
19
{
20
    /**
21
     * @var string Slider name
22
     */
23
    public $slider_name = null;
24
25
    /**
26
     * @var integer Slider ID
27
     */
28
    public $slider_id = null;
29
30
    /**
31
     * @var Slider|ActiveRecordHelper slider model instance
32
     */
33
    public $slider = null;
34
35
    /**
36
     * @var string View file to render slider widget with - can be redefined by Slider.custom_slider_view_file
37
     */
38
    public $view_file = "slider-widget";
39
40
    /**
41
     * @var string View file for each slide - can be redefined by Slider.custom_slide_view_file
42
     */
43
    public $slide_view_file = "slide";
44
45
    /**
46
     * @var array Params for the JS slider - will be merged with Slider.params
47
     */
48
    public $params = [];
49
50
    /**
51
     * @var string Advanced css classes to apply to this slider - will be appended by Slider.css_class
52
     */
53
    public $css_class = "";
54
55
    /**
56
     * @inheritdoc
57
     */
58
    public function init()
59
    {
60
        parent::init();
61
        if ($this->slider_id === null && $this->slider_name === null && $this->slider === null) {
62
            throw new InvalidConfigException("Either slider, slider_id or slider_name should be set.");
63
        }
64
        if ($this->slider === null) {
65
            if ($this->slider_name !== null) {
66
                $this->slider = Yii::$app->cache->get("Slider:name:".$this->slider_name);
67
                if ($this->slider === false) {
68
                    $this->slider = Slider::find()
0 ignored issues
show
Documentation Bug introduced by
It seems like \app\models\Slider::find...s->slider_name))->one() can also be of type object<yii\db\ActiveRecord> or array. However, the property $slider is declared as type object<app\models\Slider...per\ActiveRecordHelper>. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
69
                        ->where(['name' => $this->slider_name])
70
                        ->one();
71
                    if ($this->slider !== null) {
72
                        Yii::$app->cache->set(
73
                            "Slider:name:" . $this->slider_name,
74
                            $this->slider,
75
                            86400,
76
                            new \yii\caching\TagDependency([
77
                                'tags' => [
78
                                    $this->slider->objectTag(),
79
                                ]
80
                            ])
81
                        );
82
                    }
83
                }
84
            } else {
85
                $this->slider = Slider::findById($this->slider_id);
0 ignored issues
show
Documentation Bug introduced by
It seems like \app\models\Slider::findById($this->slider_id) of type object<yii\db\ActiveRecord> is incompatible with the declared type object<app\models\Slider...per\ActiveRecordHelper> of property $slider.

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...
86
            }
87
        }
88
    }
89
90
    /**
91
     * @inheritdoc
92
     */
93
    public function run()
94
    {
95
        if ($this->slider === null) {
96
            return '<!-- slider model not found -->';
97
        }
98
99
        $viewFile = !empty($this->slider->custom_slider_view_file) ?
100
            $this->slider->custom_slider_view_file :
101
            $this->view_file;
102
103
        $slide_viewFile = !empty($this->slider->custom_slide_view_file) ?
104
            $this->slider->custom_slide_view_file :
105
            $this->slide_view_file;
106
107
        $slider_params = Json::decode($this->slider->params);
108
        if (!is_array($slider_params)) {
109
            $slider_params = [];
110
        }
111
112
        $slider_params = ArrayHelper::merge($this->params, $slider_params);
113
114
        $css_class = $this->css_class . ' ' . $this->slider->css_class;
115
116
        /** @var \app\slider\AbstractSliderWidget $class_name */
117
        $class_name = $this->slider->handler()->slider_widget;
0 ignored issues
show
The method handler does only exist in app\models\Slider, but not in devgroup\TagDependencyHelper\ActiveRecordHelper.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
118
119
        return $class_name::widget([
120
            'viewFile' => $viewFile,
121
            'slide_viewFile' => $slide_viewFile,
122
            'slider_params' => $slider_params,
123
            'css_class' => $css_class,
124
            'slider' => $this->slider,
125
        ]);
126
    }
127
}
128