Issues (547)

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.

Helper/ConfigExport.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
/**
4
 * PAYONE Magento 2 Connector is free software: you can redistribute it and/or modify
5
 * it under the terms of the GNU Lesser General Public License as published by
6
 * the Free Software Foundation, either version 3 of the License, or
7
 * (at your option) any later version.
8
 *
9
 * PAYONE Magento 2 Connector is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 * GNU Lesser General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU Lesser General Public License
15
 * along with PAYONE Magento 2 Connector. If not, see <http://www.gnu.org/licenses/>.
16
 *
17
 * PHP version 5
18
 *
19
 * @category  Payone
20
 * @package   Payone_Magento2_Plugin
21
 * @author    FATCHIP GmbH <[email protected]>
22
 * @copyright 2003 - 2016 Payone GmbH
23
 * @license   <http://www.gnu.org/licenses/> GNU Lesser General Public License
24
 * @link      http://www.payone.de
25
 */
26
27
namespace Payone\Core\Helper;
28
29
/**
30
 * Helper class for the config export
31
 */
32
class ConfigExport extends \Payone\Core\Helper\Base
33
{
34
    /**
35
     * PAYONE payment helper
36
     *
37
     * @var \Payone\Core\Helper\Payment
38
     */
39
    protected $paymentHelper;
40
41
    /**
42
     * PAYONE database helper
43
     *
44
     * @var \Payone\Core\Helper\Database
45
     */
46
    protected $databaseHelper;
47
48
    /**
49
     * PAYONE config helper
50
     *
51
     * @var \Payone\Core\Helper\Config
52
     */
53
    protected $configHelper;
54
55
    /**
56
     * Constructor
57
     *
58
     * @param \Magento\Framework\App\Helper\Context      $context
59
     * @param \Magento\Store\Model\StoreManagerInterface $storeManager
60
     * @param \Payone\Core\Helper\Shop                   $shopHelper
61
     * @param \Payone\Core\Helper\Payment                $paymentHelper
62
     * @param \Payone\Core\Helper\Database               $databaseHelper
63
     * @param \Payone\Core\Helper\Config                 $configHelper
64
     */
65
    public function __construct(
66
        \Magento\Framework\App\Helper\Context $context,
67
        \Magento\Store\Model\StoreManagerInterface $storeManager,
68
        \Payone\Core\Helper\Shop $shopHelper,
69
        \Payone\Core\Helper\Payment $paymentHelper,
70
        \Payone\Core\Helper\Database $databaseHelper,
71
        \Payone\Core\Helper\Config $configHelper
72
    ) {
73
        parent::__construct($context, $storeManager, $shopHelper);
74
        $this->paymentHelper = $paymentHelper;
75
        $this->databaseHelper = $databaseHelper;
76
        $this->configHelper = $configHelper;
77
    }
78
79
    /**
80
     * Format module info from db
81
     *
82
     * @return array
83
     */
84
    public function getModuleInfo()
85
    {
86
        $aModules = [];
87
88
        $aResult = $this->databaseHelper->getModuleInfo();
89
        if ($aResult) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $aResult of type array is implicitly converted to a boolean; are you sure this is intended? If so, consider using ! empty($expr) instead to make it clear that you intend to check for an array without elements.

This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.

Consider making the comparison explicit by using empty(..) or ! empty(...) instead.

Loading history...
90
            foreach ($aResult as $aRow) {
91
                $aModules[$aRow['module']] = $aRow['schema_version'];
92
            }
93
        }
94
        return $aModules;
95
    }
96
97
    /**
98
     * Get the configured status mappings for all payment types
99
     * for the given store
100
     *
101
     * @param  string $sStoreCode
102
     * @return array
103
     */
104
    public function getMappings($sStoreCode)
105
    {
106
        $aMappings = [];
107
108
        $aPaymentTypes = $this->paymentHelper->getAvailablePaymentTypes();
109
        foreach ($aPaymentTypes as $sPaymentCode) {
110
            $sPaymentMapping = $this->getConfigParam($sPaymentCode, 'statusmapping', 'payone_general', $sStoreCode);
111
            $aPaymentMapping = false;
112
            if (!empty($sPaymentMapping)) {
113
                $aPaymentMapping = $this->unserialize($sPaymentMapping);
114
            }
115
            if (is_array($aPaymentMapping) && !empty($aPaymentMapping)) {
116
                $aMap = [];
117
                foreach ($aPaymentMapping as $aPayMap) {
118
                    $aMap[] = [
119
                        'from' => $aPayMap['txaction'],
120
                        'to' => $aPayMap['state_status'],
121
                    ];
122
                }
123
                $aMappings[$this->paymentHelper->getPaymentAbbreviation($sPaymentCode)] = $aMap;
124
            }
125
        }
126
        return $aMappings;
127
    }
128
129
    /**
130
     * Get all configured status forwardings for the given store
131
     *
132
     * @param  string $sStoreCode
133
     * @return array
134
     */
135
    public function getForwardings($sStoreCode)
136
    {
137
        $aForwardingReturn = [];
138
        $aForwarding = $this->configHelper->getForwardingUrls($sStoreCode);
139
        foreach ($aForwarding as $aForwardEntry) {
140
            if (isset($aForwardEntry['txaction']) && !empty($aForwardEntry['txaction'])) {
141
                $aForwardingReturn[] = [
142
                    'status' => implode(',', $aForwardEntry['txaction']),
143
                    'url' => $aForwardEntry['url'],
144
                    'timeout' => (int)$aForwardEntry['timeout'],
145
                ];
146
            }
147
        }
148
        return $aForwardingReturn;
149
    }
150
151
    /**
152
     * Get config parameters of certain payment-types
153
     *
154
     * @param  string $sParam
155
     * @param  string $sPaymentCode
156
     * @param  string $sStoreCode
157
     * @param  bool   $blCheckGlobal
158
     * @return string
159
     */
160
    public function getPaymentConfig($sParam, $sPaymentCode, $sStoreCode, $blCheckGlobal = false)
161
    {
162
        $iPaymentUseGlobal = $this->getConfigParam('use_global', $sPaymentCode, 'payone_payment', $sStoreCode);
163
        if (!$blCheckGlobal || ($blCheckGlobal && $iPaymentUseGlobal == '0')) {
164
            return $this->getConfigParam($sParam, $sPaymentCode, 'payone_payment', $sStoreCode);
165
        }
166
        return $this->getConfigParam($sParam, 'global', 'payone_general', $sStoreCode);
167
    }
168
169
    /**
170
     * Get the allowed countries for a given payment type
171
     * or an empty string if all countries are allowed
172
     *
173
     * @param  string $sPaymentCode
174
     * @param  string $sStoreCode
175
     * @return string
176
     */
177
    public function getCountries($sPaymentCode, $sStoreCode)
178
    {
179
        if ($this->getPaymentConfig('allowspecific', $sPaymentCode, $sStoreCode, true) == '1') {
180
            return $this->getPaymentConfig('specificcountry', $sPaymentCode, $sStoreCode, true);
181
        }
182
        return ''; // empty return value if all countries are available
183
    }
184
}
185