Issues (10)

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/Command/CloudFoundry/RunCommand.php (2 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
 * Runs a command on a Cloud Foundry instance
4
 */
5
6
namespace Graviton\Deployment\Command\CloudFoundry;
7
8
use Graviton\Deployment\Command\AbstractCommand;
9
use Graviton\Deployment\Configuration;
10
use Graviton\Deployment\Deployment;
11
use Graviton\Deployment\Services\CloudFoundry\DeploymentUtils;
12
use Symfony\Component\Console\Input\InputArgument;
13
use Symfony\Component\Console\Input\InputInterface;
14
use Symfony\Component\Console\Input\InputOption;
15
use Symfony\Component\Console\Output\OutputInterface;
16
17
/**
18
 * @author   List of contributors <https://github.com/libgraviton/graviton/graphs/contributors>
19
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
20
 * @link     http://swisscom.ch
21
 */
22
final class RunCommand extends AbstractCommand
23
{
24
    /** @var Deployment */
25
    private $deployHandler;
26
27
    /**
28
     * @param Deployment    $deploymentHandler Managing the actual deployment
29
     * @param Configuration $configuration     Set of configuration options to influence the current command.
30
     * @param string|null   $name              Name of the command
31
     */
32
    public function __construct(Deployment $deploymentHandler, Configuration $configuration, $name = null)
33
    {
34
        parent::__construct($configuration, $name);
35
        $this->deployHandler = $deploymentHandler;
36
    }
37
38
    /**
39
     * Configures the current command.
40
     *
41
     * @return void
42
     */
43 View Code Duplication
    protected function configure()
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
44
    {
45
        $this
46
            ->setName('graviton:deployment:cf:run')
47
            ->setDescription('Run a command as on a Cloud Foundry instance')
48
            ->addArgument(
49
                'applicationName',
50
                InputArgument::REQUIRED,
51
                'Which application shall be deployed?'
52
            )
53
            ->addArgument(
54
                'cmd',
55
                InputArgument::REQUIRED,
56
                'Shell command passed as a string e.g. "php app/console doctrine:mongodb:fixtures:load unstable"'
57
            )
58
            ->addArgument(
59
                'versionName',
60
                InputArgument::OPTIONAL,
61
                'Which application shall be deployed?',
62
                'unstable'
63
            )
64
            ->addOption(
65
                'no-logout',
66
                null,
67
                InputOption::VALUE_NONE,
68
                'Will keep the CF session open after deployment. ' .
69
                '<fg=yellow;options=bold>Keep in mind to close it by yourself!</fg=yellow;options=bold>'
70
            );
71
    }
72
73
    /**
74
     * Executes the current command.
75
     *
76
     * @param InputInterface  $input  User input on console
77
     * @param OutputInterface $output Output of the command
78
     *
79
     * @return void
80
     */
81
    protected function execute(InputInterface $input, OutputInterface $output)
82
    {
83
        DeploymentUtils::login($this->deployHandler, $output, $this->configuration);
84
        $applicationName = $input->getArgument('applicationName') . '-' . $input->getArgument('versionName');
85
        DeploymentUtils::runCommand(
86
            $this->deployHandler,
87
            $output,
88
            $this->configuration,
89
            $input->getArgument('cmd'),
90
            $applicationName
91
        );
92
        $noLogout = $input->getOption('no-logout');
93 View Code Duplication
        if (true == $noLogout) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
94
            $output->writeln(
95
                '<bg=yellow;fg=black;options=bold>' .
96
                '                                                                           ' . PHP_EOL .
97
                '  Cloud Foundry session will not be closed (»no-logout« option was set) !  ' .
98
                PHP_EOL . '                                                                           ' .
99
                '</bg=yellow;fg=black;options=bold>'
100
            );
101
102
            return;
103
        }
104
        DeploymentUtils::logout($this->deployHandler, $output, $this->configuration);
105
    }
106
}
107