Issues (4)

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/controllers/DefaultController.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
2
3
namespace zacksleo\yii2\lookup\controllers;
4
5
use Yii;
6
use zacksleo\yii2\lookup\models\Lookup;
7
use zacksleo\yii2\lookup\models\LookupSearch;
8
use yii\web\Controller;
9
use yii\web\NotFoundHttpException;
10
use yii\filters\VerbFilter;
11
12
class DefaultController extends Controller
13
{
14
    public function behaviors()
15
    {
16
        return [
17
            'verbs' => [
18
                'class' => VerbFilter::className(),
19
                'actions' => [
20
                    'delete' => ['post'],
21
                ],
22
            ],
23
        ];
24
    }
25
26
    /**
27
     * Lists all Lookup models.
28
     * @return mixed
29
     */
30
    public function actionIndex()
31
    {
32
        $lookupModel = new LookupSearch();
33
        $dataProvider = $lookupModel->search(Yii::$app->request->queryParams);
34
35
        return $this->render('index', [
36
            'lookupModel' => $lookupModel,
37
            'dataProvider' => $dataProvider,
38
        ]);
39
    }
40
41
    /**
42
     * Displays a single Lookup model.
43
     * @param integer $id
44
     * @return mixed
45
     */
46
    public function actionView($id)
47
    {
48
        return $this->render('view', [
49
            'model' => $this->findModel($id),
50
        ]);
51
    }
52
53
    /**
54
     * Creates a new Lookup model.
55
     * If creation is successful, the browser will be redirected to the 'view' page.
56
     * @return mixed
57
     */
58
    public function actionCreate()
59
    {
60
        $model = new Lookup();
61
        if ($model->load(Yii::$app->request->post()) && $model->save()) {
62
            return $this->redirect(['view', 'id' => $model->id]);
63
        }
64
        return $this->render('create', [
65
            'model' => $model,
66
        ]);
67
    }
68
69
    /**
70
     * Updates an existing Lookup model.
71
     * If update is successful, the browser will be redirected to the 'view' page.
72
     * @param integer $id
73
     * @return mixed
74
     */
75
    public function actionUpdate($id)
76
    {
77
        $model = $this->findModel($id);
78
        if ($model->load(Yii::$app->request->post()) && $model->save()) {
79
            return $this->redirect(['view', 'id' => $model->id]);
80
        }
81
        return $this->render('update', [
82
            'model' => $model,
83
        ]);
84
    }
85
86
    /**
87
     * Deletes an existing Lookup model.
88
     * If deletion is successful, the browser will be redirected to the 'index' page.
89
     * @param integer $id
90
     * @return mixed
91
     */
92
    public function actionDelete($id)
93
    {
94
        $this->findModel($id)->delete();
95
96
        return $this->redirect(['index']);
97
    }
98
99
    /**
100
     * Finds the Lookup model based on its primary key value.
101
     * If the model is not found, a 404 HTTP exception will be thrown.
102
     * @param integer $id
103
     * @return Lookup the loaded model
104
     * @throws NotFoundHttpException if the model cannot be found
105
     */
106
    protected function findModel($id)
107
    {
108
        if (($model = Lookup::findOne($id)) !== null) {
0 ignored issues
show
Bug Compatibility introduced by
The expression \zacksleo\yii2\lookup\models\Lookup::findOne($id); of type yii\db\ActiveRecordInterface|array|null adds the type array to the return on line 109 which is incompatible with the return type documented by zacksleo\yii2\lookup\con...ltController::findModel of type zacksleo\yii2\lookup\models\Lookup.
Loading history...
109
            return $model;
110
        }
111
        throw new NotFoundHttpException('The requested page does not exist.');
112
    }
113
}
114