Issues (8)

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.

ServiceContainer/Driver/GoutteFactory.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
/*
4
 * This file is part of the Behat MinkExtension.
5
 * (c) Konstantin Kudryashov <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Behat\MinkExtension\ServiceContainer\Driver;
12
13
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
14
use Symfony\Component\DependencyInjection\Definition;
15
16
/**
17
 * @author Christophe Coevoet <[email protected]>
18
 */
19
class GoutteFactory implements DriverFactory
20
{
21
    /**
22
     * {@inheritdoc}
23
     */
24
    public function getDriverName()
25
    {
26
        return 'goutte';
27
    }
28
29
    /**
30
     * {@inheritdoc}
31
     */
32
    public function supportsJavascript()
33
    {
34
        return false;
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40
    public function configure(ArrayNodeDefinition $builder)
41
    {
42
        $builder
43
            ->children()
44
                ->arrayNode('server_parameters')
45
                    ->useAttributeAsKey('key')
46
                    ->prototype('variable')->end()
47
                ->end()
48
                ->arrayNode('guzzle_parameters')
49
                    ->useAttributeAsKey('key')
50
                    ->prototype('variable')->end()
51
                    ->info(
52
                        "For Goutte 1.x, these are the second argument of the Guzzle3 client constructor.\n".
53
                        'For Goutte 2.x, these are the elements passed in the "defaults" key of the Guzzle4 config.'
54
                    )
55
                ->end()
56
            ->end()
57
        ;
58
    }
59
60
    /**
61
     * {@inheritdoc}
62
     */
63
    public function buildDriver(array $config)
64
    {
65
        if (!class_exists('Behat\Mink\Driver\GoutteDriver')) {
66
            throw new \RuntimeException(
67
                'Install MinkGoutteDriver in order to use goutte driver.'
68
            );
69
        }
70
71
        if ($this->isGoutte1()) {
72
            $guzzleClient = $this->buildGuzzle3Client($config['guzzle_parameters']);
73
        } elseif ($this->isGuzzle6()) {
74
            $guzzleClient = $this->buildGuzzle6Client($config['guzzle_parameters']);
75
        } else {
76
            $guzzleClient = $this->buildGuzzle4Client($config['guzzle_parameters']);
77
        }
78
79
        $clientDefinition = new Definition('Behat\Mink\Driver\Goutte\Client', array(
80
            $config['server_parameters'],
81
        ));
82
        $clientDefinition->addMethodCall('setClient', array($guzzleClient));
83
84
        return new Definition('Behat\Mink\Driver\GoutteDriver', array(
85
            $clientDefinition,
86
        ));
87
    }
88
89 View Code Duplication
    private function buildGuzzle6Client(array $parameters)
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...
90
    {
91
        // Force the parameters set by default in Goutte to reproduce its behavior
92
        $parameters['allow_redirects'] = false;
93
        $parameters['cookies'] = true;
94
95
        return new Definition('GuzzleHttp\Client', array($parameters));
96
    }
97
98 View Code Duplication
    private function buildGuzzle4Client(array $parameters)
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...
99
    {
100
        // Force the parameters set by default in Goutte to reproduce its behavior
101
        $parameters['allow_redirects'] = false;
102
        $parameters['cookies'] = true;
103
104
        return new Definition('GuzzleHttp\Client', array(array('defaults' => $parameters)));
105
    }
106
107
    private function buildGuzzle3Client(array $parameters)
108
    {
109
        // Force the parameters set by default in Goutte to reproduce its behavior
110
        $parameters['redirect.disable'] = true;
111
112
        return new Definition('Guzzle\Http\Client', array(null, $parameters));
113
    }
114
115
    private function isGoutte1()
116
    {
117
        $refl = new \ReflectionParameter(array('Goutte\Client', 'setClient'), 0);
118
119
        if ($refl->getClass() && 'Guzzle\Http\ClientInterface' === $refl->getClass()->getName()) {
120
            return true;
121
        }
122
123
        return false;
124
    }
125
126
    private function isGuzzle6()
127
    {
128
        return interface_exists('GuzzleHttp\ClientInterface') &&
129
            version_compare(\GuzzleHttp\ClientInterface::VERSION, '6.0.0', '>=');
130
    }
131
}
132