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/nganluong/VerifiedData.php (1 issue)

Severity

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\nganluong;
9
10
use yiiviet\payment\VerifiedData as BaseVerifiedData;
11
12
/**
13
 * Lớp VerifiedData cung cấp dữ liệu đã được xác thực từ Ngân Lượng gửi về.
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
 * @property string $token mã token dùng để truy vấn thông tin giao dịch.
19
 * @property string $error_code mã lỗi, chỉ tồn tại khi `token` hợp lệ.
20
 * @property mixed $order_code mã giao dịch tại hệ thống, chỉ tồn tại khi `token` hợp lệ.
21
 * @property double $total_amount số tiền đơn hàng, chỉ tồn tại khi `token` hợp lệ.
22
 * @property string $payment_method phương thức thanh toán, chỉ tồn tại khi `token` hợp lệ.
23
 * @property string $bank_code mã ngân hàng, chỉ tồn tại khi `token` hợp lệ.
24
 * @property string $payment_type hình thức thanh toán `1` là trực tiếp, `2` là tạm giữ, chỉ tồn tại khi `token` hợp lệ.
25
 * @property string $order_description thông tin đơn hàng, chỉ tồn tại khi `token` hợp lệ.
26
 * @property double $tax_amount tiền thuế, chỉ tồn tại khi `token` hợp lệ.
27
 * @property double $discount_amount tiền giảm giá, chỉ tồn tại khi `token` hợp lệ.
28
 * @property double $fee_shipping phí ship, chỉ tồn tại khi `token` hợp lệ.
29
 * @property string $return_url đường dẫn trả về khi thanh toán thành công, chỉ tồn tại khi `token` hợp lệ.
30
 * @property string $cancel_url đường dẫn trả về khi hủy thành công, chỉ tồn tại khi `token` hợp lệ.
31
 * @property string $notify_url đường dẫn Ngân Lượng gọi về khi khách thanh toán thành công, chỉ tồn tại khi `token` hợp lệ.
32
 * @property int $time_limit số phút còn lại để thực thi giao dịch, chỉ tồn tại khi `token` hợp lệ.
33
 * @property string $buyer_fullname tên người mua, chỉ tồn tại khi `token` hợp lệ.
34
 * @property string $buyer_email email người mua, chỉ tồn tại khi `token` hợp lệ.
35
 * @property string $buyer_mobile số điện thoại người mua, chỉ tồn tại khi `token` hợp lệ.
36
 * @property string $buyer_address địa chỉ người mua, chỉ tồn tại khi `token` hợp lệ.
37
 * @property string $affiliate_code mã đối tác của Ngân Lượng, chỉ tồn tại khi `token` hợp lệ.
38
 * @property string $transaction_status trạng thái giao dịch, chỉ tồn tại khi `token` hợp lệ.
39
 * @property string $transaction_id mã giao dịch tại Ngân Lượng, chỉ tồn tại khi `token` hợp lệ.
40
 * @property string $description thông tin giao dịch tại Ngân Lượng, chỉ tồn tại khi `token` hợp lệ.
41
 *
42
 * @author Vuong Minh <[email protected]>
43
 * @since 1.0
44
 */
45
class VerifiedData extends BaseVerifiedData
46
{
47
48
    /**
49
     * @inheritdoc
50
     */
51 1
    public function rules()
52
    {
53
        return [
54 1
            [['token'], 'required', 'on' => PaymentGateway::VRC_PURCHASE_SUCCESS],
55
            [['token'], 'ensureToken', 'message' => '{attribute} invalid!', 'on' => PaymentGateway::VRC_PURCHASE_SUCCESS]
56
        ];
57
    }
58
59
    /**
60
     * Phương thức kiểm tra tính hợp lệ của mã `token` gửi từ Ngân Lượng.
61
     *
62
     * @param string $attribute Chứa giá trị thuộc tính cần kiểm tra.
63
     * @param string $params Mảng thông tin khi thiết lập rule.
64
     * @param \yii\validators\InlineValidator $validator Đối tượng [[\yii\validators\InlineValidator]] đang thực thi kiểm tra dữ liệu.
65
     * @throws \ReflectionException|\yii\base\InvalidConfigException
66
     */
67
    public function ensureToken($attribute, $params, \yii\validators\InlineValidator $validator)
0 ignored issues
show
The parameter $params is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
68
    {
69
        $response = $this->getClient()->getGateway()->queryDR(['token' => $this->token]);
70
71
        if (!$response->isOk) {
72
            $validator->addError($this, $attribute, $validator->message);
73
        } else {
74
            foreach ($response->get(false) as $attr => $value) {
75
                $this->defineAttribute($attr, $value);
76
            }
77
        }
78
    }
79
80
}
81