Issues (5)

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.

src/AbstractGateway.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
 * WebMoney driver for the Omnipay PHP payment processing library
5
 *
6
 * @link      https://github.com/ck-developer/omnipay-payline
7
 * @package   omnipay-payline
8
 * @license   MIT
9
 * @copyright Copyright (c) 2016 Claude Khedhiri <[email protected]>
10
 */
11
12
namespace Omnipay\Payline;
13
14
use Symfony\Component\HttpFoundation\Request as HttpRequest;
15
16
abstract class AbstractGateway extends \Omnipay\Common\AbstractGateway
17
{
18
    protected $liveEndpoint = 'http://www.payline.com/wsdl/v4_0/production';
19
    protected $testEndpoint = 'http://www.payline.com/wsdl/v4_0/homologation';
20
21
    abstract public function getEndPoint();
22
23
    /**
24
     * AbstractGateway constructor.
25
     *
26
     * @param \SoapClient|null $httpClient
27
     * @param HttpRequest|null $httpRequest
28
     */
29 90
    public function __construct(\SoapClient $httpClient = null, HttpRequest $httpRequest = null)
30
    {
31 90
        $this->httpClient = $httpClient;
0 ignored issues
show
Documentation Bug introduced by
It seems like $httpClient can also be of type object<SoapClient>. However, the property $httpClient is declared as type object<Guzzle\Http\ClientInterface>. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
32 90
        $this->httpRequest = $httpRequest;
33 90
        $this->initialize();
34 90
    }
35
36 33
    protected function createRequest($class, array $parameters)
37
    {
38 33
        $this->httpClient = $this->httpClient ?: $this->getDefaultHttpClient();
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->httpClient ?: $th...>getDefaultHttpClient() can also be of type object<SoapClient>. However, the property $httpClient is declared as type object<Guzzle\Http\ClientInterface>. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
39 33
        $this->httpRequest = $this->httpRequest ?: $this->getDefaultHttpRequest();
40
41 33
        $obj = new $class($this->httpClient, $this->httpRequest);
42
43 33
        return $obj->initialize(array_replace($this->getParameters(), $parameters));
44
    }
45
46 90
    public function getDefaultParameters()
47
    {
48
        return array(
49 90
            'merchantId' => '',
50 60
            'accessKey' => '',
51 60
            'proxyHost' => '',
52 60
            'proxyPort' => '',
53 60
            'proxyLogin' => '',
54 60
            'proxyPassword' => '',
55 60
            'contractNumber' => '',
56 60
            'testMode' => true,
57 60
        );
58
    }
59
60
    /**
61
     * @return string
62
     */
63 6
    public function getMerchantId()
64
    {
65 6
        return $this->getParameter('merchantId');
66
    }
67
68
    /**
69
     * @param string $merchantId
70
     *
71
     * @return $this
72
     */
73 90
    public function setMerchantId($merchantId)
74
    {
75 90
        return $this->setParameter('merchantId', $merchantId);
76
    }
77
78
    /**
79
     * @return string
80
     */
81 6
    public function getAccessKey()
82
    {
83 6
        return $this->getParameter('accessKey');
84
    }
85
86
    /**
87
     * @param string $accessKey
88
     *
89
     * @return $this
90
     */
91 90
    public function setAccessKey($accessKey)
92
    {
93 90
        return $this->setParameter('accessKey', $accessKey);
94
    }
95
96
    /**
97
     * @return string
98
     */
99 3
    public function getContractNumber()
100
    {
101 3
        return $this->getParameter('contractNumber');
102
    }
103
104
    /**
105
     * @param string $contractNumber
106
     *
107
     * @return $this
108
     */
109 90
    public function setContractNumber($contractNumber)
110
    {
111 90
        return $this->setParameter('contractNumber', $contractNumber);
112
    }
113
114
    /**
115
     * @return string
116
     */
117 6
    public function getProxyHost()
118
    {
119 6
        return $this->getParameter('proxyHost');
120
    }
121
122
    /**
123
     * @param string $proxyHost
124
     *
125
     * @return $this
126
     */
127 15
    public function setProxyHost($proxyHost)
128
    {
129 15
        return $this->setParameter('proxyHost', $proxyHost);
130
    }
131
132
    /**
133
     * @return string
134
     */
135 3
    public function getProxyPort()
136
    {
137 3
        return $this->getParameter('proxyPort');
138
    }
139
140
    /**
141
     * @param string $proxyPort
142
     *
143
     * @return $this
144
     */
145 15
    public function setProxyPort($proxyPort)
146
    {
147 15
        return $this->setParameter('proxyPort', $proxyPort);
148
    }
149
150
    /**
151
     * @return string
152
     */
153 3
    public function getProxyLogin()
154
    {
155 3
        return $this->getParameter('proxyLogin');
156
    }
157
158
    /**
159
     * @param string $proxyLogin
160
     *
161
     * @return $this
162
     */
163 15
    public function setProxyLogin($proxyLogin)
164
    {
165 15
        return $this->setParameter('proxyLogin', $proxyLogin);
166
    }
167
168
    /**
169
     * @return string
170
     */
171 3
    public function getProxyPassword()
172
    {
173 3
        return $this->getParameter('proxyPassword');
174
    }
175
176
    /**
177
     * @param string $proxyPassword
178
     *
179
     * @return $this
180
     */
181 15
    public function setProxyPassword($proxyPassword)
182
    {
183 15
        return $this->setParameter('proxyPassword', $proxyPassword);
184
    }
185
186
    /**
187
     * @return \SoapClient
188
     */
189 3
    public function getDefaultHttpClient()
190
    {
191
        $header = array(
192 3
            'Content-Type' => 'text/xml; charset=utf-8',
193 3
            'login' => $this->getMerchantId(),
194 3
            'password' => $this->getAccessKey(),
195 3
            'style' => defined(SOAP_DOCUMENT) ? SOAP_DOCUMENT : 2,
196 3
            'use' => defined(SOAP_LITERAL) ? SOAP_LITERAL : 2,
197 3
            'connection_timeout' => 5,
198 2
        );
199
200 3
        if ($this->getProxyHost()) {
201
            $header['proxy_host'] = $this->getProxyHost();
202
            $header['proxy_port'] = $this->getProxyPort();
203
            $header['proxy_login'] = $this->getProxyLogin();
204
            $header['proxy_password'] = $this->getProxyPassword();
205
        }
206
207 3
        return new \SoapClient($this->getEndPoint(), $header);
208
    }
209
}
210