Issues (175)

Security Analysis    not enabled

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.

Facebook/HttpClients/FacebookGuzzleHttpClient.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
 * Copyright 2016 Facebook, Inc.
4
 *
5
 * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
 * use, copy, modify, and distribute this software in source code or binary
7
 * form for use in connection with the web services and APIs provided by
8
 * Facebook.
9
 *
10
 * As with any software that integrates with the Facebook platform, your use
11
 * of this software is subject to the Facebook Developer Principles and
12
 * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
 * shall be included in all copies or substantial portions of the software.
14
 *
15
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
 * DEALINGS IN THE SOFTWARE.
22
 *
23
 */
24
namespace Facebook\HttpClients;
25
26
use Facebook\Http\GraphRawResponse;
27
use Facebook\Exceptions\FacebookSDKException;
28
29
use GuzzleHttp\Client;
30
use GuzzleHttp\Message\ResponseInterface;
31
use GuzzleHttp\Ring\Exception\RingException;
32
use GuzzleHttp\Exception\RequestException;
33
34
class FacebookGuzzleHttpClient implements FacebookHttpClientInterface
35
{
36
    /**
37
     * @var \GuzzleHttp\Client The Guzzle client.
38
     */
39
    protected $guzzleClient;
40
41
    /**
42
     * @param \GuzzleHttp\Client|null The Guzzle client.
43
     */
44
    public function __construct(Client $guzzleClient = null)
45
    {
46
        $this->guzzleClient = $guzzleClient ?: new Client();
47
    }
48
49
    /**
50
     * @inheritdoc
51
     */
52
    public function send($url, $method, $body, array $headers, $timeOut)
53
    {
54
        $options = [
55
            'headers' => $headers,
56
            'body' => $body,
57
            'timeout' => $timeOut,
58
            'connect_timeout' => 10,
59
            'verify' => __DIR__ . '/certs/DigiCertHighAssuranceEVRootCA.pem',
60
        ];
61
        $request = $this->guzzleClient->createRequest($method, $url, $options);
62
63
        try {
64
            $rawResponse = $this->guzzleClient->send($request);
65
        } catch (RequestException $e) {
66
            $rawResponse = $e->getResponse();
67
68
            if ($e->getPrevious() instanceof RingException || !$rawResponse instanceof ResponseInterface) {
69
                throw new FacebookSDKException($e->getMessage(), $e->getCode());
70
            }
71
        }
72
73
        $rawHeaders = $this->getHeadersAsString($rawResponse);
74
        $rawBody = $rawResponse->getBody();
75
        $httpStatusCode = $rawResponse->getStatusCode();
76
77
        return new GraphRawResponse($rawHeaders, $rawBody, $httpStatusCode);
0 ignored issues
show
$rawBody is of type object<GuzzleHttp\Stream\StreamInterface>|null, but the function expects a string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
78
    }
79
80
    /**
81
     * Returns the Guzzle array of headers as a string.
82
     *
83
     * @param ResponseInterface $response The Guzzle response.
84
     *
85
     * @return string
86
     */
87
    public function getHeadersAsString(ResponseInterface $response)
88
    {
89
        $headers = $response->getHeaders();
90
        $rawHeaders = [];
91
        foreach ($headers as $name => $values) {
92
            $rawHeaders[] = $name . ": " . implode(", ", $values);
93
        }
94
95
        return implode("\r\n", $rawHeaders);
96
    }
97
}
98