Issues (9)

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.

ConfirmationRequestsController.php (4 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 enigmatix\confirmation;
4
5
use yii\web\Controller;
6
use Yii;
7
use enigmatix\confirmation\ConfirmationRequest;
8
use yii\base\ErrorException;
9
use yii\web\NotFoundHttpException;
10
use yii\filters\VerbFilter;
11
12
/**
13
 * ConfirmationRequestsController implements the CRUD actions for ConfirmationRequest model.
14
 */
15
class ConfirmationRequestsController extends Controller
16
{
17
18
    var $defaultAction = 'release';
0 ignored issues
show
The visibility should be declared for property $defaultAction.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

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

Loading history...
19
    /**
20
     * @inheritdoc
21
     */
22
    public function behaviors()
23
    {
24
        return [
25
            'verbs' => [
26
                'class' => VerbFilter::className(),
27
                'actions' => [
28
                    'delete' => ['POST'],
29
                ],
30
            ],
31
        ];
32
    }
33
34
35
    /**
36
     * Releases a single change as stored in the  ConfirmationRequest model.
37
     * @return mixed
38
     */
39
    public function actionRelease($release_token)
0 ignored issues
show
Coding Style Naming introduced by
The parameter $release_token is not named in camelCase.

This check marks parameter names that have not been written in camelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection string becomes databaseConnectionString.

Loading history...
40
    {
41
42
        try {
43
            $model = $this->findModel($release_token);
44
        } catch (NotFoundHttpException $e) {
45
            Yii::$app->session->setFlash('danger', "We were not able to find your change.  Perhaps it has already been processed?");
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal We were not able to find...already been processed? does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
46
            return $this->goHome();
47
        }
48
49
        try {
50
            $model->release();
51
        } catch (ErrorException $e) {
52
            return $this->redirect(['confirmation-requests/expired']);
53
        }
54
55
        $viewLink = $model->constructObject()->getViewLink();
56
        $model->delete();
57
58
        if (!Yii::$app->user->isGuest) {
59
            return $this->redirect($viewLink);
60
        }
61
62
        return $this->render('@vendor/enigmatix/yii2-confirmation/views/confirm', []);
63
    }
64
65
    public function actionExpired() {
66
        return $this->render('@vendor/enigmatix/yii2-confirmation/views/expired', []);
67
68
    }
69
70
    /**
71
     * Finds the ConfirmationRequest model based on its primary key value.
72
     * If the model is not found, a 404 HTTP exception will be thrown.
73
     * @return ConfirmationRequest the loaded model
74
     * @throws NotFoundHttpException if the model cannot be found
75
     */
76
    protected function findModel($release_token)
0 ignored issues
show
Coding Style Naming introduced by
The parameter $release_token is not named in camelCase.

This check marks parameter names that have not been written in camelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection string becomes databaseConnectionString.

Loading history...
77
    {
78
        if (($model = ConfirmationRequest::findOne(['release_token' => $release_token])) !== null) {
79
            return $model;
80
        } else {
81
            throw new NotFoundHttpException('The requested page does not exist.');
82
        }
83
    }
84
}
85