Issues (2)

Security Analysis    no request data  

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.

controllers/Cli.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
/**
4
 * @package Demo 
5
 * @author Iurii Makukh <[email protected]> 
6
 * @copyright Copyright (c) 2017, Iurii Makukh <[email protected]> 
7
 * @license https://www.gnu.org/licenses/gpl-3.0.en.html GPL-3.0+ 
8
 */
9
10
namespace gplcart\modules\demo\controllers;
11
12
use gplcart\core\CliController;
13
use gplcart\core\models\Store as StoreModel;
14
use gplcart\modules\demo\models\Demo as DemoModuleModel;
15
16
/**
17
 * Handles Demo module CLI commands
18
 */
19
class Cli extends CliController
20
{
21
22
    /**
23
     * Demo module model instance
24
     * @var \gplcart\modules\demo\models\Demo $demo
25
     */
26
    protected $demo;
27
28
    /**
29
     * Store model class instance
30
     * @var \gplcart\modules\demo\models\Store $store
31
     */
32
    protected $store;
33
34
    /**
35
     * The current demo handler id
36
     * @var string
37
     */
38
    protected $data_handler_id;
39
40
    /**
41
     * The current demo store ID
42
     * @var integer
43
     */
44
    protected $data_store_id;
45
46
    /**
47
     * @param StoreModel $store
48
     * @param DemoModuleModel $demo
49
     */
50
    public function __construct(StoreModel $store, DemoModuleModel $demo)
51
    {
52
        parent::__construct();
53
54
        $this->demo = $demo;
55
        $this->store = $store;
0 ignored issues
show
Documentation Bug introduced by
It seems like $store of type object<gplcart\core\models\Store> is incompatible with the declared type object<gplcart\modules\demo\models\Store> of property $store.

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...
56
57
        $this->data_store_id = $this->getArgument('store', 1);
58
        $this->data_handler_id = $this->getArgument('package', 'default');
59
    }
60
61
    /**
62
     * Handles "demo-create" command
63
     */
64
    public function createCli()
65
    {
66
        if ($this->validateCli()) {
67
            $result = $this->demo->create($this->data_handler_id, $this->data_store_id);
68
            if ($result !== true) {
69
                $this->setError('result', $result);
70
            }
71
        }
72
73
        $this->output();
74
    }
75
76
    /**
77
     * Handles "demo-delete" command
78
     */
79
    public function deleteCli()
80
    {
81
        if ($this->validateCli()) {
82
            $result = $this->demo->delete($this->data_handler_id, $this->data_store_id);
83
            if ($result !== true) {
84
                $this->setError('result', $result);
85
            }
86
        }
87
88
        $this->output();
89
    }
90
91
    /**
92
     * Validates submitted arguments
93
     * @return boolean
94
     */
95
    protected function validateCli()
96
    {
97
        if (!$this->store->get($this->data_store_id)) {
98
            $this->setError('store_id', $this->text('Store does not exist'));
99
        }
100
101
        if (!$this->demo->getHandler($this->data_handler_id)) {
102
            $this->setError('handler_id', $this->text('Unknown handler'));
103
        }
104
        return !$this->isError();
105
    }
106
107
}
108