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/models/SpamChecker.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
namespace app\models;
4
5
use Yii;
6
use yii\data\ActiveDataProvider;
7
use yii\helpers\ArrayHelper;
8
9
/**
10
 * This is the model class for table "spam_checker".
11
 * @property integer $id
12
 * @property string $behavior
13
 * @property string $api_key
14
 * @property string $name
15
 * @property string $author_field
16
 * @property string $content_field
17
 */
18
class SpamChecker extends \yii\db\ActiveRecord
19
{
20
    const FIELD_TYPE_NO_CHECKING = 'notinterpret';
21
    const FIELD_TYPE_AUTHOR = 'author_field';
22
    const FIELD_TYPE_CONTENT = 'content_field';
23
24
    /**
25
     * @var int
26
     */
27
    public static $enabledApiId = 0;
28
29
    /**
30
     * @inheritdoc
31
     */
32
    public static function tableName()
33
    {
34
        return '{{%spam_checker}}';
35
    }
36
37
    /**
38
     * @inheritdoc
39
     */
40
    public function rules()
41
    {
42
        return [
43
            [['behavior'], 'required'],
44
            [['behavior'], 'string', 'max' => 255],
45
            [['name', 'author_field', 'content_field'], 'string', 'max' => 50],
46
            [['api_key'], 'string', 'max' => 90]
47
        ];
48
    }
49
50
    /**
51
     * @inheritdoc
52
     */
53
    public function attributeLabels()
54
    {
55
        return [
56
            'id' => Yii::t('app', 'ID'),
57
            'behavior' => Yii::t('app', 'Behavior'),
58
            'api_key' => Yii::t('app', 'Api Key'),
59
            'name' => Yii::t('app', 'Name'),
60
            'author_field' => Yii::t('app', 'Author Field'),
61
            'content_field' => Yii::t('app', 'Content Field'),
62
            'enabledApiId' => Yii::t('app', 'Enabled Api Key'),
63
        ];
64
    }
65
66
    /**
67
     * Search tasks
68
     * @param $params
69
     * @return ActiveDataProvider
70
     */
71
    public function search($params)
72
    {
73
        /* @var $query \yii\db\ActiveQuery */
74
        $query = self::find();
75
        $dataProvider = new ActiveDataProvider(
76
            [
77
                'query' => $query,
78
                'pagination' => [
79
                    'pageSize' => 10,
80
                ],
81
            ]
82
        );
83
        if (!($this->load($params))) {
84
            return $dataProvider;
85
        }
86
        $query->andFilterWhere(['id' => $this->id]);
87
        $query->andFilterWhere(['like', 'behavior', $this->behavior]);
88
        $query->andFilterWhere(['like', 'api_key', $this->api_key]);
89
        $query->andFilterWhere(['like', 'name', $this->name]);
90
        return $dataProvider;
91
    }
92
93
    /**
94
     * Function return array map for drop down list
95
     * @return array
96
     */
97
    public static function getAvailableApis()
98
    {
99
        static::getEnabledApiId();
100
        $all = static::find()->all();
101
        $map = ArrayHelper::map($all, 'id', 'name');
102
        return ArrayHelper::merge([0 => Yii::t('app', 'Not selected')], $map);
103
    }
104
105
    public static function getEnabledApiId()
106
    {
107
        $enabled = Yii::$app->getModule('core')->spamCheckerApiKey;
108
        static::$enabledApiId = static::getApiIdByClassName($enabled);
109
        return static::$enabledApiId;
110
    }
111
112
    public static function setEnabledApiId($id)
113
    {
114
        $config = Yii::$app->getModule('core')->spamCheckerApiKey;
115
        $model = static::findOne($id);
116
        if ($model === null) {
117
            $config->value = '';
118
        } else {
119
            $config->value = $model->behavior;
120
        }
121
        $config->save();
122
        static::$enabledApiId = $id;
123
    }
124
125
    /**
126
     * Function return id of SpanChecker by behavior class name
127
     * @param $className string
128
     * @return int
129
     */
130
    public static function getApiIdByClassName($className)
131
    {
132
        $model = static::findOne(['behavior' => $className]);
133
        if ($model === null) {
134
            $id = 0;
135
        } else {
136
            $id = $model->id;
137
        }
138
        return $id;
139
    }
140
141
    public static function getFieldTypesForForm()
142
    {
143
        return [
144
            self::FIELD_TYPE_NO_CHECKING => Yii::t('app', 'No'),
145
            self::FIELD_TYPE_AUTHOR => Yii::t('app', 'Username'),
146
            self::FIELD_TYPE_CONTENT => Yii::t('app', 'Content'),
147
        ];
148
    }
149
150
    /**
151
     * @return SpamChecker
0 ignored issues
show
Should the return type not be SpamChecker|null?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
152
     */
153
    public static function getActive()
154
    {
155
        return static::findOne(static::getEnabledApiId());
0 ignored issues
show
Bug Compatibility introduced by
The expression static::findOne(static::getEnabledApiId()); of type yii\db\ActiveRecordInterface|array|null adds the type array to the return on line 155 which is incompatible with the return type documented by app\models\SpamChecker::getActive of type app\models\SpamChecker|null.
Loading history...
156
    }
157
}
158