Issues (66)

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.

src/Plugin.php (8 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 namespace Comodojo\Installer;
2
3
use Composer\Composer;
4
use Composer\IO\IOInterface;
5
use Composer\Plugin\PluginInterface;
6
use Comodojo\Configuration\Installer as PackageInstaller;
7
8
/**
9
 *
10
 *
11
 * @package     Comodojo Framework
12
 * @author      Marco Giovinazzi <[email protected]>
13
 * @author      Marco Castiello <[email protected]>
14
 * @license     GPL-3.0+
15
 *
16
 * LICENSE:
17
 *
18
 * This program is free software: you can redistribute it and/or modify
19
 * it under the terms of the GNU Affero General Public License as
20
 * published by the Free Software Foundation, either version 3 of the
21
 * License, or (at your option) any later version.
22
 *
23
 * This program is distributed in the hope that it will be useful,
24
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26
 * GNU Affero General Public License for more details.
27
 *
28
 * You should have received a copy of the GNU Affero General Public License
29
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
30
 */
31
32
class Plugin implements PluginInterface {
33
34
    public function activate(Composer $composer, IOInterface $io) {
35
36
        $this->loadInstallerConfig($composer);
37
38
        if ( !$this->loadStaticConfiguration($composer) ) {
0 ignored issues
show
The call to Plugin::loadStaticConfiguration() has too many arguments starting with $composer.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
39
40
            $this->getIO()->write('<comment>Comodojo configuration not (yet) available.</comment>');
0 ignored issues
show
The method getIO() does not seem to exist on object<Comodojo\Installer\Plugin>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
41
            
42
            $installer = new Installer($io, $composer);
0 ignored issues
show
The call to Installer::__construct() misses a required argument $package_installer.

This check looks for function calls that miss required arguments.

Loading history...
$io is of type object<Composer\IO\IOInterface>, but the function expects a object<Composer\Composer>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
$composer is of type object<Composer\Composer>, but the function expects a object<Composer\IO\IOInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
43
44
        } else {
45
            
46
            $package_installer = new PackageInstaller();
47
            
48
            $installer = new Installer($io, $composer, $package_installer);
0 ignored issues
show
$io is of type object<Composer\IO\IOInterface>, but the function expects a object<Composer\Composer>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
$composer is of type object<Composer\Composer>, but the function expects a object<Composer\IO\IOInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
49
            
50
            $this->getIO()->write('<comment>Comodojo configuration loaded, installer ready.</comment>');
0 ignored issues
show
The method getIO() does not seem to exist on object<Comodojo\Installer\Plugin>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
51
            
52
        }
53
54
        $composer->getInstallationManager()->addInstaller($installer);
55
56
    }
57
58
    private function loadInstallerConfig(Composer $composer) {
59
60
        $extra = $composer->getPackage()->getExtra();
61
62
        $installer_default_config = array(
63
            'app-assets' => 'public/apps',
64
            'framework-js' => 'public/js',
65
            'framework-templates' => 'public/templates',
66
            'local-cache' => 'cache',
67
            'static-config' => 'config',
68
            'local-logs' => 'logs',
69
            'local-database' => 'database'
70
        );
71
72
        if ( isset($extra['comodojo-installer-paths']) && is_array($extra['comodojo-installer-paths']) ) {
73
74
            $installer_config = array_replace($installer_default_config, $extra['comodojo-installer-paths']);
75
76
        } else {
77
78
            $installer_config = $installer_default_config;
79
80
        }
81
82
        define('COMODOJO_INSTALLER_APP_ASSETS', $installer_config['app-assets']);
83
84
        define('COMODOJO_INSTALLER_THEME_ASSETS', $installer_config['theme-assets']);
85
86
        define('COMODOJO_INSTALLER_LOCAL_CACHE', $installer_config['local-cache']);
87
88
        define('COMODOJO_INSTALLER_STATIC_CONFIG', $installer_config['static-config']);
89
90
        define('COMODOJO_INSTALLER_LOCAL_LOGS', $installer_config['local-logs']);
91
92
        define('COMODOJO_INSTALLER_LOCAL_DATABASE', $installer_config['local-database']);
93
94
        define('COMODOJO_INSTALLER_WORKING_DIRECTORY', getcwd());
95
96
    }
97
98
    private function loadStaticConfiguration() {
99
100
        $config_file = COMODOJO_INSTALLER_WORKING_DIRECTORY.COMODOJO_INSTALLER_STATIC_CONFIG.'/config.php';
101
102
        if ( is_file($config_file) && is_readable($config_file) ) {
103
104
            include_once($config_file);
105
106
            return true;
107
108
        }
109
110
        return false;
111
112
    }
113
114
}
115