Issues (31)

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.

lib/Cerbere/Action/Hacked.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
 * Drush Cerbere command line tools.
5
 * Copyright (C) 2015 - Sebastien Malot <[email protected]>
6
 *
7
 * This program is free software; you can redistribute it and/or modify
8
 * it under the terms of the GNU General Public License as published by
9
 * the Free Software Foundation; either version 2 of the License, or
10
 * (at your option) any later version.
11
 *
12
 * This program is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 * GNU General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU General Public License along
18
 * with this program; if not, write to the Free Software Foundation, Inc.,
19
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
 */
21
22
namespace Cerbere\Action;
23
24
use Cerbere\Event\CerbereDoActionEvent;
25
use Cerbere\Event\CerbereDoneActionEvent;
26
use Cerbere\Event\CerbereEvents;
27
use Cerbere\Event\CerbereReportActionEvent;
28
use Cerbere\Model\Hacked\HackedProject;
29
use Cerbere\Model\Project;
30
use Cerbere\Model\ReleaseHistory;
31
use Symfony\Component\EventDispatcher\EventDispatcher;
32
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
33
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
34
35
/**
36
 * Class Hacked
37
 *
38
 * @package Cerbere\Action
39
 */
40
class Hacked implements ActionInterface
41
{
42
    /**
43
     * @var EventDispatcherInterface
44
     */
45
    protected $dispatcher;
46
47
    /**
48
     * @inheritDoc
49
     */
50
    public function getCode()
51
    {
52
        return 'hacked';
53
    }
54
55
    /**
56
     * @inheritDoc
57
     */
58
    public function addLoggerListener(EventSubscriberInterface $listener)
59
    {
60
        $this->getDispatcher()->addSubscriber($listener);
61
    }
62
63
    /**
64
     * @inheritDoc
65
     */
66
    public function getDispatcher()
67
    {
68
        if (!isset($this->dispatcher)) {
69
            $this->dispatcher = new EventDispatcher();
70
        }
71
72
        return $this->dispatcher;
73
    }
74
75
    /**
76
     * @inheritDoc
77
     */
78
    public function setDispatcher(EventDispatcherInterface $dispatcher)
79
    {
80
        $this->dispatcher = $dispatcher;
81
    }
82
83
    /**
84
     * @inheritDoc
85
     */
86
    public function prepare()
87
    {
88
89
    }
90
91
    /**
92
     * @inheritDoc
93
     */
94
    public function process(array $projects, $options = array())
95
    {
96
        if (empty($projects)) {
97
            return array();
98
        }
99
100
        $reports = array();
101
        $release_history = new ReleaseHistory();
102
103
        /** @var Project $project */
104
        foreach ($projects as $project) {
105
            $release_history->prepare($project);
106
107
            $event = new CerbereDoActionEvent($this, $project);
108
            $this->getDispatcher()->dispatch(CerbereEvents::CERBERE_DO_ACTION, $event);
109
110
            if ($filename = $project->getFilename()) {
0 ignored issues
show
$filename is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
111
                $current_dir = getcwd();
112
                // Change current directory to the module directory.
113
                chdir($project->getWorkingDirectory());
114
115
                $hacked = new HackedProject($project);
116
                $result = $hacked->computeReport();
117
118
                $report = array(
119
                  'project' => $project->getProject(),
120
                  'type' => $project->getProjectType(),
121
                  'version' => $project->getVersion(),
122
                  'version_date' => $project->getDatestamp(),
123
                  'status' => $result['status'],
124
                  'status_label' => HackedProject::getStatusLabel($result['status']),
125
                  'modified' => $result['counts']['different'],
126
                  'deleted' => $result['counts']['missing'],
127
                );
128
129
                $event = new CerbereReportActionEvent($this, $project, $report);
130
                $this->getDispatcher()->dispatch(CerbereEvents::CERBERE_REPORT_ACTION, $event);
131
                $report = $event->getReport();
132
133
                $reports[] = $report;
134
135
                // Restore current directory.
136
                chdir($current_dir);
137
            }
138
139
            $event = new CerbereDoneActionEvent($this, $project);
140
            $this->getDispatcher()->dispatch(CerbereEvents::CERBERE_DONE_ACTION, $event);
141
        }
142
143
        return $reports;
144
    }
145
}
146