Issues (42)

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/momo/ResponseData.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
 * @link https://github.com/yiiviet/yii2-payment
4
 * @copyright Copyright (c) 2017 Yii Viet
5
 * @license [New BSD License](http://www.opensource.org/licenses/bsd-license.php)
6
 */
7
8
namespace yiiviet\payment\momo;
9
10
use vxm\gatewayclients\ResponseData as BaseResponseData;
11
12
/**
13
 * Lớp ResponseData cung cấp dữ liệu nhận được từ MOMO khi tạo [[request()]] ở [[PaymentGateway]].
14
 *
15
 * @method PaymentClient getClient() đối tượng client đã dùng để thực thi request.
16
 *
17
 * @property PaymentClient $client đối tượng client đã dùng để thực thi request.
18
 *
19
 * @property string $partnerCode của client sử dụng khi tạo request [[PaymentGateway::RC_QUERY_DR, PaymentGateway::RC_REFUND, PaymentGateway::RC_QUERY_REFUND]].
20
 * @property string $accessKey của client sử dụng khi tạo request [[PaymentGateway::RC_QUERY_DR, PaymentGateway::RC_REFUND, PaymentGateway::RC_QUERY_REFUND]].
21
 * @property mixed $requestId mã unique request id khi tạo request [[PaymentGateway::RC_QUERY_DR, PaymentGateway::RC_REFUND, PaymentGateway::RC_QUERY_REFUND]].
22
 * @property double $amount số tiền của đơn hàng chỉ tồn tại với request [[PaymentGateway::RC_QUERY_DR, PaymentGateway::RC_QUERY_REFUND]].
23
 * @property string $orderId mã đơn hàng tại hệ thống.
24
 * @property string $orderType có giá trị cố định là `momo_wallet`.
25
 * @property string $transId mã giao dịch tại MOMO chỉ tồn tại khi tạo request [[PaymentGateway::RC_QUERY_DR, PaymentGateway::RC_REFUND, PaymentGateway::RC_QUERY_REFUND]].
26
 * @property string $message thống báo (eng).
27
 * @property string $localMessage thống báo (vi).
28
 * @property int $errorCode mã báo lỗi.
29
 * @property string $payType hình thức thanh toán (web hoặc qr) chỉ tồn tại khi tạo request [[PaymentGateway::RC_QUERY_DR]].
30
 * @property mixed $extraData dữ liệu kèm theo khi tạo request purchase chỉ tồn tại khi tạo request [[PaymentGateway::RC_QUERY_DR]].
31
 * @property string $payUrl đường dẫn thanh toán chỉ tồn tại khi tạo request [[PaymentGateway::RC_PURCHASE]].
32
 *
33
 * @author Vuong Minh <[email protected]>
34
 * @since 1.0.3
35
 */
36
class ResponseData extends BaseResponseData
37
{
38
39
    /**
40
     * @inheritdoc
41
     * @throws \ReflectionException
42
     */
43 4
    public function scenarios()
44
    {
45 4
        $requestCommands = $this->getClient()->getGateway()->requestCommands();
46
47 4
        return array_fill_keys($requestCommands, ['signature']);
48
    }
49
50
    /**
51
     * @inheritdoc
52
     */
53 4
    public function rules()
54
    {
55
        return [
56 4
            ['signature', 'required'],
57 4
            ['signature', SignatureValidator::class, 'client' => $this->getClient(), 'dataSignAttributes' => $this->getDataSignAttributes()]
58
        ];
59
    }
60
61
    /**
62
     * @inheritdoc
63
     */
64 4
    public function getIsOk(): bool
65
    {
66 4
        return $this->validate();
67
    }
68
69
    /**
70
     * @inheritdoc
71
     */
72 4
    protected function getDataSignAttributes(): array
73
    {
74 4
        switch ($this->getCommand()) {
75 4
            case PaymentGateway::RC_PURCHASE:
76 4
                return ['requestId', 'orderId', 'message', 'localMessage', 'payUrl', 'errorCode', 'requestType'];
77 3
            case PaymentGateway::RC_QUERY_DR:
78 1
                return ['partnerCode', 'accessKey', 'requestId', 'orderId', 'errorCode', 'transId', 'amount', 'message', 'localMessage', 'requestType', 'payType', 'extraData'];
79 2 View Code Duplication
            case PaymentGateway::RC_REFUND:
0 ignored issues
show
This code seems to be duplicated across 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...
80 1
                return ['partnerCode', 'accessKey', 'requestId', 'orderId', 'errorCode', 'transId', 'message', 'localMessage', 'requestType'];
81 1 View Code Duplication
            case PaymentGateway::RC_QUERY_REFUND:
0 ignored issues
show
This code seems to be duplicated across 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...
82 1
                return ['partnerCode', 'accessKey', 'requestId', 'orderId', 'errorCode', 'transId', 'amount', 'message', 'localMessage', 'requestType'];
83
            default:
84
                return [];
85
        }
86
    }
87
}
88