Issues (424)

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/cart/AbstractPurchase.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
 * Finance module for HiPanel
4
 *
5
 * @link      https://github.com/hiqdev/hipanel-module-finance
6
 * @package   hipanel-module-finance
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2015-2019, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hipanel\modules\finance\cart;
12
13
use yii\base\InvalidConfigException;
14
15
/**
16
 * Class Purchase.
17
 * Performs purchase action.
18
 * Holds cart position object and data needed to perform purchase:.
19
 *
20
 * @property int $amount
21
 * @property string $client
22
 * @property string $currency
23
 * @property string object - object type e.g. `domain`, `server`, `certificate`
24
 *
25
 * @property string $calculation_id
26
 */
27
abstract class AbstractPurchase extends \hipanel\base\Model
28
{
29
    use \hipanel\base\ModelTrait;
30
31
    /**
32
     * @var AbstractCartPosition
33
     */
34
    public $position;
35
36
    /**
37
     * @var array result of purchase execution
38
     */
39
    protected $_result;
40
41
    public function getResult()
42
    {
43
        return $this->_result;
44
    }
45
46
    /** {@inheritdoc} */
47
    public static function tableName()
48
    {
49
        throw new InvalidConfigException('Method "tableName" must be declared');
50
    }
51
52
    /**
53
     * @throws InvalidConfigException
54
     * @internal param string $ operation to be performed, e.g.: Renew, Transfer, Registration
55
     */
56
    public static function operation()
57
    {
58
        throw new InvalidConfigException('Method "operation" must be implemented');
59
    }
60
61
    /** {@inheritdoc} */
62
    public function init()
63
    {
64
        parent::init();
65
66
        $this->calculation_id = $this->position->getId();
67
        $this->amount = $this->position->getQuantity();
68
    }
69
70
    /**
71
     * Executes the purchase.
72
     * Calls proper API commands to purchase the product.
73
     * @throws ErrorPurchaseException in case of failed purchase
74
     * @return true if the item was purchased successfully
75
     */
76
    public function execute()
77
    {
78
        if ($this->validate()) {
79
            $this->_result = static::perform(static::operation(), $this->getAttributes());
0 ignored issues
show
Documentation Bug introduced by Andrii Vasyliev
It seems like static::perform(static::...$this->getAttributes()) of type * is incompatible with the declared type array of property $_result.

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...
80
81
            return true;
82
        }
83
84
        return false;
85
    }
86
87
    public function renderNotes()
88
    {
89
        return '';
90
    }
91
92
    /** {@inheritdoc} */
93
    public function rules()
94
    {
95
        return [
96
            [['calculation_id', 'object', 'client', 'type', 'currency', 'item'], 'safe'],
97
            [['amount'], 'number'],
98
        ];
99
    }
100
101
    /**
102
     * @return string[]
103
     */
104
    public function getPurchasabilityRules()
105
    {
106
        return [];
107
    }
108
}
109