Issues (5)

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/Response/Abstracts/AbstractResponse.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
 * ©[2016] SugarCRM Inc.  Licensed by SugarCRM under the Apache 2.0 license.
4
 */
5
6
namespace SugarAPI\SDK\Response\Abstracts;
7
8
use SugarAPI\SDK\Response\Interfaces\ResponseInterface;
9
10
abstract class AbstractResponse implements ResponseInterface {
11
12
    /**
13
     * The Curl Request Resource that was used when curl_exec was called
14
     * @var cURL resource handle
15
     */
16
    protected $CurlRequest;
17
18
    /**
19
     * Extracted headers from Curl Response
20
     * @var string
21
     */
22
    protected $headers;
23
24
    /**
25
     * Extracted body from Curl Response
26
     * @var mixed
27
     */
28
    protected $body;
29
30
    /**
31
     * The HTTP Status Code of Request
32
     * @var string
33
     */
34
    protected $status;
35
36
    /**
37
     * The last Curl Error that occurred
38
     * @var string|boolean - False when no Curl Error = 0
39
     */
40
    protected $error;
41
42
    /**
43
     * The cURL Resource information returned via curl_getinfo
44
     * @var array
45
     */
46
    protected $info;
47
48 1
    public function __construct($curlRequest,$curlResponse = NULL){
49 1
        $this->CurlRequest = $curlRequest;
50 1
        if ($curlResponse!==NULL){
51 1
            $this->setCurlResponse($curlResponse);
52 1
        }
53 1
    }
54
55 1
    public function setCurlResponse($curlResponse) {
56 1
        $this->extractInfo();
57 1
        if (!$this->error){
58 1
            $this->extractResponse($curlResponse);
59 1
        }
60 1
    }
61
62
    /**
63
     * Extract the information from the Curl Request via curl_getinfo
64
     * Setup the Status property to be equal to the http_code
65
     */
66 2
    protected function extractInfo(){
67 2
        $this->info = curl_getinfo($this->CurlRequest);
0 ignored issues
show
Documentation Bug introduced by
It seems like curl_getinfo($this->CurlRequest) of type * is incompatible with the declared type array of property $info.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
68 2
        $this->status = $this->info['http_code'];
69 2
        if (curl_errno($this->CurlRequest)!== CURLE_OK){
70 1
            $this->error = curl_error($this->CurlRequest);
71 1
        }else {
72 1
            $this->error = FALSE;
73
        }
74 2
    }
75
76
    /**
77
     * Seperate the Headers and Body from the CurlResponse, and set the object properties
78
     * @param string $curlResponse
79
     */
80 1
    protected function extractResponse($curlResponse){
81 1
        $this->headers = substr($curlResponse, 0, $this->info['header_size']);
82 1
        $this->body = substr($curlResponse, $this->info['header_size']);
83 1
    }
84
85
    /**
86
     * @inheritdoc
87
     */
88 1
    public function getStatus(){
89 1
        return $this->status;
90
    }
91
92
    /**
93
     * @inheritdoc
94
     */
95 1
    public function getBody(){
96 1
        return $this->body;
97
    }
98
99
    /**
100
     * @inheritdoc
101
     */
102 1
    public function getHeaders(){
103 1
        return $this->headers;
104
    }
105
106
    /**
107
     * @inheritdoc
108
     */
109 2
    public function getError(){
110 2
        return $this->error;
111
    }
112
113
    /**
114
     * @inheritdoc
115
     */
116 1
    public function getInfo(){
117 1
        return $this->info;
118
    }
119
120
}