Issues (632)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  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.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  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.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  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.
  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.
  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.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
  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.
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  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.
  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.
  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.
  Header Injection
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.

Apps/Controller/Admin/Application.php (3 issues)

Labels
1
<?php
2
3
namespace Apps\Controller\Admin;
4
5
use Apps\Model\Admin\Application\FormInstall;
6
use Apps\Model\Admin\Application\FormTurn;
7
use Apps\Model\Admin\Application\FormUpdate;
8
use Extend\Core\Arch\AdminController;
9
use Ffcms\Core\App;
10
use Ffcms\Core\Exception\ForbiddenException;
11
use Ffcms\Core\Exception\NotFoundException;
12
use Ffcms\Core\Helper\Type\Str;
13
14
/**
15
 * Class Application. View and manage system applications.
16
 * @package Apps\Controller\Admin
17
 */
18
class Application extends AdminController
19
{
20
    public $type = 'app';
21
22
    /**
23
     * Application constructor.
24
     * @throws ForbiddenException
25
     */
26
    public function __construct()
27
    {
28
        // prevent version checks
29
        parent::__construct(false);
30
    }
31
32
    /**
33
     * List of all installed applications
34
     * @return string|null
35
     */
36
    public function actionIndex(): ?string
37
    {
38
        return $this->view->render('application/index', [
39
            'apps' => $this->applications
40
        ]);
41
    }
42
    
43
    /**
44
     * Show installation for of applications
45
     * @return string|null
46
     * @throws \Ffcms\Core\Exception\SyntaxException
47
     */
48
    public function actionInstall(): ?string
49
    {
50
        $model = new FormInstall($this->applications, 'app');
51
52
        // check if model is sended
53
        if ($model->send()) {
54
            // validate app name
55
            if ($model->validate()) {
56
                // try to run ::install method from remoute controller
57
                if ($model->make()) {
58
                    App::$Session->getFlashBag()->add('success', __('Application "%app%" is successful installed!', ['app' => $model->sysname]));
59
                    $this->response->redirect('application/index');
60
                } else {
61
                    App::$Session->getFlashBag()->add('error', __('During the installation process an error has occurred! Please contact with application developer.'));
62
                }
63
            } else {
64
                App::$Session->getFlashBag()->add('error', __('Probably, app or widget with the same name is always used! Try to solve this conflict.'));
65
            }
66
        }
67
68
        return $this->view->render('application/install', [
69
            'model' => $model
70
        ]);
71
    }
72
73
    /**
74
     * Show and process update form for apps
75
     * @param string $sys
76
     * @return string|null
77
     * @throws \Ffcms\Core\Exception\SyntaxException
78
     * @throws NotFoundException
79
     */
80
    public function actionUpdate($sys): ?string
81
    {
82
        // get controller name and try to find app in db
83
        $controller = ucfirst(Str::lowerCase($sys));
84
        $search = \Apps\ActiveRecord\App::getItem('app', $controller);
0 ignored issues
show
Are you sure the assignment to $search is correct as Apps\ActiveRecord\App::g...tem('app', $controller) targeting Apps\ActiveRecord\App::getItem() seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
85
86
        // check what we got
87
        if (!$search || (int)$search->id < 1) {
0 ignored issues
show
$search is of type null, thus it always evaluated to false.
Loading history...
88
            throw new NotFoundException('App is not founded');
89
        }
90
91
        // init model and make update with notification
92
        $model = new FormUpdate($search);
93
        if ($model->send() && $model->validate()) {
94
            $model->make();
95
            App::$Session->getFlashBag()->add('success', __('Application %s% is successful updated to %v% version', ['s' => $sys, 'v' => $model->scriptVersion]));
96
            $this->response->redirect('application/index');
97
        }
98
99
        // render response
100
        return $this->view->render('application/update', [
101
            'model' => $model
102
        ]);
103
    }
104
105
    /**
106
     * Allow turn on/off applications
107
     * @param $controllerName
108
     * @return string|null
109
     * @throws ForbiddenException
110
     */
111
    public function actionTurn($controllerName): ?string
112
    {
113
        $controllerName = ucfirst(Str::lowerCase($controllerName));
114
115
        /** @var \Apps\ActiveRecord\App $search */
116
        $search = \Apps\ActiveRecord\App::where('sys_name', $controllerName)
117
            ->where('type', 'app')
118
            ->first();
119
        if (!$search || (int)$search->id < 1) {
0 ignored issues
show
$search is of type Apps\ActiveRecord\App, thus it always evaluated to true.
Loading history...
120
            throw new ForbiddenException('App is not founded');
121
        }
122
123
        $model = new FormTurn($search);
124
        if ($model->send()) {
125
            $model->update();
126
            App::$Session->getFlashBag()->add('success', __('Application status was changed'));
127
        }
128
129
        return $this->view->render('application/turn', [
130
            'app' => $search,
131
            'model' => $model
132
        ]);
133
    }
134
}
135