Issues (3)

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.

ElasticaProviderBundle/Command/ProvideCommand.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
namespace GBProd\ElasticaProviderBundle\Command;
4
5
use Elastica\Client;
6
use GBProd\ElasticaProviderBundle\Provider\Handler;
7
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
8
use Symfony\Component\Console\Input\InputArgument;
9
use Symfony\Component\Console\Input\InputInterface;
10
use Symfony\Component\Console\Input\InputOption;
11
use Symfony\Component\Console\Output\OutputInterface;
12
use Symfony\Component\DependencyInjection\ContainerInterface;
13
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
14
15
/**
16
 * Command to run providing
17
 *
18
 * @author gbprod <[email protected]>
19
 */
20
class ProvideCommand extends ContainerAwareCommand
21
{
22
    /**
23
     * @var Handler
24
     */
25
    private $handler;
26
27
    /**
28
     * @var EventDispatcherInterface
29
     */
30
    private $eventDispatcher;
31
32
    /**
33
     * @param Handler                  $handler
34
     * @param EventDispatcherInterface $eventDispatcher
35
     */
36 5
    public function __construct(
37
        Handler $handler,
38
        EventDispatcherInterface $eventDispatcher
39
    ) {
40 5
        parent::__construct();
41 5
        $this->handler = $handler;
42 5
        $this->eventDispatcher = $eventDispatcher;
43 5
    }
44
45
    /**
46
     * {@inheritdoc}
47
     */
48 5
    protected function configure()
49
    {
50 5
        $this
51 5
            ->setName('elasticsearch:provide')
52 5
            ->setDescription('Provide data to Elasticsearch')
53 5
            ->addArgument('index', InputArgument::OPTIONAL, 'Index to provide')
54 5
            ->addArgument('type', InputArgument::OPTIONAL, 'Type to provide')
55 5
            ->addOption('client', null, InputOption::VALUE_REQUIRED, 'Client to use (if not default)')
56 5
            ->addOption('alias', null, InputOption::VALUE_REQUIRED, 'Alias to use instead of index name for providers (index is required to use this option)')
0 ignored issues
show
This line exceeds maximum limit of 120 characters; contains 158 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
57
        ;
58 5
    }
59
60
    /**
61
     * {@inheritdoc}
62
     */
63 4
    protected function execute(InputInterface $input, OutputInterface $output)
64
    {
65 4
        $client = $this->getClient($input->getOption('client'));
66
67 3
        $index = $input->getArgument('index');
68 3
        $type  = $input->getArgument('type');
69 3
        $alias = (null !== $index) ? $input->getOption('alias') : null; // alias usage only if index is set
70
71 3
        $output->writeln(sprintf(
72 3
            '<info>Providing <comment>%s/%s</comment> for client <comment>%s</comment></info>',
73 3
            $index ?: '*',
74 3
            $type ?: '*',
75 3
            $input->getOption('client')
76 3
        ));
77
78 3
        $this->initializeProgress($output);
79
80 3
        $this->handler->handle($client, $index, $type, $alias);
81 3
    }
82
83
    /**
84
     * @param string $clientName
85
     *
86
     * @return Client
87
     */
88 4
    private function getClient($clientName)
89
    {
90 4
        $clientName = $clientName ?: 'gbprod.elastica_provider.default_client';
91
92 4
        $client = $this->getContainer()
93 4
            ->get($clientName, ContainerInterface::NULL_ON_INVALID_REFERENCE)
94 4
        ;
95
96 4
        if (!$client) {
97 1
            throw new \InvalidArgumentException(sprintf(
98 1
                'No client "%s" found',
99
                $clientName
100 1
            ));
101
        }
102
103 3
        return $client;
104
    }
105
106 3
    private function initializeProgress(OutputInterface $output)
107
    {
108 3
        new ProvidingProgressBar($this->eventDispatcher, $output);
109 3
    }
110
}
111