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.

src/Version/Guzzle5.php (3 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
namespace CanalTP\AbstractGuzzle\Version;
4
5
use GuzzleHttp\Psr7\Request;
6
use GuzzleHttp\Psr7\Response;
7
use GuzzleHttp\Stream\Stream;
8
use GuzzleHttp\Client;
9
use CanalTP\AbstractGuzzle\Guzzle;
10
11
class Guzzle5 extends Guzzle
12
{
13
    /**
14
     * @var Client
15
     */
16
    private $client;
17
18
    /**
19
     * {@InheritDoc}
20
     */
21
    public function __construct($baseUri, $options = [])
22
    {
23
        $this->defaultOptions = [
24
            'base_url' => $baseUri,
25
            'defaults' => $options
26
        ];
27
28
        $this->client = new Client($this->defaultOptions);
29
    }
30
31
    /**
32
     * We have to recreate client to modify baseUri
33
     *
34
     * @param string $baseUri
35
     */
36
    public function setBaseUri($baseUri)
37
    {
38
        $this->__construct($baseUri, []);
39
    }
40
41
    public function getBaseUri()
42
    {
43
        return $this->client->getBaseUrl();
44
    }
45
46
    public function setDefaultOptions($options = [])
47
    {
48
        $this->__construct($this->getBaseUri(), $options);
49
    }
50
51
    public function getDefaultOptions()
52
    {
53
        return $this->client->getDefaultOption();
54
    }
55
56
    public function setDefaultAuth($username, $password, $type = 'basic')
57
    {
58
        $this->client->setDefaultOption('auth', [$username, $password, $type]);
59
    }
60
61
    /**
62
     * @return Client
63
     */
64
    public function getClient()
65
    {
66
        return $this->client;
67
    }
68
69
    /**
70
     * @param Client $client
71
     *
72
     * @return self
73
     */
74
    public function setClient(Client $client)
75
    {
76
        $this->client = $client;
77
78
        return $this;
79
    }
80
81
    /**
82
     * {@InheritDoc}
83
     */
84 View Code Duplication
    public function send(Request $request)
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...
85
    {
86
        $guzzleRequest = $this->client->createRequest(
0 ignored issues
show
The method createRequest() does not exist on GuzzleHttp\Client. Did you maybe mean request()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
87
            $request->getMethod(),
88
            $request->getUri(),
89
            ['headers' => $request->getHeaders()]
90
        );
91
92
        $guzzleRequest->setBody(Stream::factory($request->getBody()));
93
94
        $guzzleResponse = $this->getClient()->send($guzzleRequest);
95
96
        $response = new Response(
97
            $guzzleResponse->getStatusCode(),
98
            $guzzleResponse->getHeaders(),
99
            $guzzleResponse->getBody(true)
0 ignored issues
show
The call to ResponseInterface::getBody() has too many arguments starting with true.

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...
100
        );
101
102
        return $response;
103
    }
104
105
    /**
106
     * Used to mock client
107
     *
108
     * @return \GuzzleHttp\Event\Emitter|\GuzzleHttp\Event\EmitterInterface
109
     */
110
    public function getEmitter()
111
    {
112
        return $this->client->getEmitter();
113
    }
114
}
115