Issues (608)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  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.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  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.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  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.
  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.
  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.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
  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.
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  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.
  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.
  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.
  Header Injection
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.

class/Gateways/Gateway.php (1 issue)

Severity
1
<?php
2
3
namespace XoopsModules\Oledrion\Gateways;
4
5
/*
6
 You may not change or alter any portion of this comment or credits
7
 of supporting developers from this source code or any supporting source code
8
 which is considered copyrighted (c) material of the original comment or credit authors.
9
10
 This program is distributed in the hope that it will be useful,
11
 but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
*/
14
15
use XoopsModules\Oledrion;
16
17
/**
18
 * oledrion
19
 *
20
 * @copyright   {@link https://xoops.org/ XOOPS Project}
21
 * @license     {@link http://www.fsf.org/copyleft/gpl.html GNU public license}
22
 * @author      Hervé Thouzard (http://www.herve-thouzard.com/)
23
 */
24
25
/**
26
 * Every gateway script must extends this class
27
 */
28
// defined('XOOPS_ROOT_PATH') || die('Restricted access');
29
30
abstract class Gateway
31
{
32
    protected $handlers;
33
    protected $gatewayInformation;
34
    public    $languageFilename;
35
36
    /**
37
     * Gateway constructor.
38
     */
39
    public function __construct()
40
    {
41
        $this->getHandlers();
42
        $this->setGatewayInformation();
43
    }
44
45
    /**
46
     * Set the information about the current gateway
47
     * $gateway['name'] = "Paypal";
48
     * $gateway['foldername'] = 'paypal';
49
     * $gateway['version'] = 1.0;
50
     * $gateway['description'] = "PayPal is the safer, easier way to pay and get paid online";
51
     * $gateway['author'] = "Instant Zero (http://www.herve-thouzard.com/)";
52
     * $gateway['credits'] = "Hervé Thouzard";
53
     * $gateway['releaseDate'] = 20081215;    // YYYYMMDD
54
     */
55
    abstract public function setGatewayInformation();
56
57
    /**
58
     * Loads the module's handler
59
     */
60
    private function getHandlers()
61
    {
62
        //        $this->handlers = HandlerManager::getInstance();
63
    }
64
65
    /**
66
     * Returns some informations about the gateway on the form of an array :
67
     *
68
     * @return array $gateway
69
     */
70
    public function getGatewayInformation()
71
    {
72
        return $this->gatewayInformation;
73
    }
74
75
    /**
76
     * Verifies if the gateway log exists and create it if it does not
77
     *
78
     * @param  string $gatewaysLogPath The full path (and name) to the gateway's log file
79
     */
80
    public function verifyIfGatewayLogExists($gatewaysLogPath)
81
    {
82
        if (!file_exists($gatewaysLogPath)) {
83
            file_put_contents($gatewaysLogPath, '<?php exit(); ?>', LOCK_EX);
84
        }
85
    }
86
87
    /**
88
     * Ecriture d'un texte dans le fichier log des passerelles
89
     *
90
     * @param  string $gatewaysLogPath Le chemin d'accès complet (et le nom) au fichier log
91
     * @param  string $text            Le texte à écrire
92
     */
93
    public function appendToLog($gatewaysLogPath, $text)
94
    {
95
        $this->verifyIfGatewayLogExists($gatewaysLogPath);
96
        $fp = fopen($gatewaysLogPath, 'ab');
97
        if ($fp) {
0 ignored issues
show
$fp is of type resource, thus it always evaluated to false.
Loading history...
98
            fwrite($fp, str_repeat('-', 120) . "\n");
99
            fwrite($fp, date('d/m/Y H:i:s') . "\n");
100
            fwrite($fp, $text . "\n");
101
            fclose($fp);
102
        }
103
    }
104
105
    /**
106
     * This method is called to display a form containing the gateways parameters.
107
     * You must return a XoopsThemeForm and this form MUST use the post method.
108
     * The module is in charge to load your defines before to call this method and
109
     * it loads xoopsformloader.php
110
     *
111
     * If your gateway does not requires parameters, then you must return false
112
     *
113
     * @param $postUrl
114
     * @return mixed
115
     * @internal param string $posstUrl The url to use to post data to
116
     */
117
    abstract public function getParametersForm($postUrl);
118
119
    /**
120
     * This method is called by the module to save the gateway's parameters
121
     * It's up to you to verify data and eventually to complain about uncomplete or missing data
122
     *
123
     * @param  array $data Receives $_POST
124
     * @return bool True if you succeed to save data else false
125
     */
126
    abstract public function saveParametersForm($data);
127
128
    /**
129
     * Returns the URL to redirect user to (for paying)
130
     * @param $cmd_total
131
     * @param $cmd_id
132
     * @return string
133
     */
134
    abstract public function getRedirectURL($cmd_total, $cmd_id);
135
136
    /**
137
     * Returns the form to use before to redirect user to the gateway
138
     *
139
     * @param  Oledrion\Commands $order Objects of type Commands
140
     * @return array  Key = element's name, Value = Element's value
141
     */
142
    abstract public function getCheckoutFormContent($order);
143
144
    /**
145
     * Returns the list of countries codes used by the gateways
146
     */
147
    abstract public function getCountriesList();
148
149
    /**
150
     * This method is in charge to dialog with the gateway to verify the payment's statuts
151
     *
152
     * @param  string $gatewaysLogPath The full path (and name) to the log file
153
     */
154
    abstract public function gatewayNotify($gatewaysLogPath);
155
156
    /**
157
     * Returne the gateway's language file
158
     *
159
     * @return string the filename to use
160
     */
161
    public function getGatewayLanguageFile()
162
    {
163
        global $xoopsConfig;
164
        $gatewayName  = ucfirst($this->gatewayInformation['foldername']);
165
        $fullFilePath = OLEDRION_GATEWAY_PATH . $gatewayName; // c:/inetpub/wwwroot/xoops3/modules/oledrion/admin/gateways/passerelle
166
        //        /** @var Oledrion\Helper $helper */
167
        //        $helper = Oledrion\Helper::getInstance();
168
        //        $helper->loadLanguage('main');
169
170
        if (file_exists($fullFilePath . '/language/' . $xoopsConfig['language'] . '/main.php')) {
171
            return $fullFilePath . '/language/' . $xoopsConfig['language'] . '/main.php';
172
        }
173
174
        return $fullFilePath . '/language/english/main.php';
175
    }
176
}
177