Issues (1240)

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.

modules/payment/libraries/Payment.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 defined('SYSPATH') or die('No direct access allowed.');
2
/**
3
 * Provides payment support for credit cards and other providers like PayPal.
4
 *
5
 * $Id: Payment.php 3769 2008-12-15 00:48:56Z zombor $
6
 *
7
 * @package    Payment
8
 * @author     Kohana Team
9
 * @copyright  (c) 2007-2008 Kohana Team
10
 * @license    http://kohanaphp.com/license.html
11
 */
12
class Payment_Core
13
{
14
15
    // Configuration
16
    protected $config = array(
17
        // The driver string
18
        'driver'      => null,
19
        // Test mode is set to true by default
20
        'test_mode'   => true,
21
    );
22
23
    protected $driver = null;
24
25
    /**
26
     * Sets the payment processing fields.
27
     * The driver will translate these into the specific format for the provider.
28
     * Standard fields are (Providers may have additional or different fields):
29
     *
30
     * card_num
31
     * exp_date
32
     * cvv
33
     * description
34
     * amount
35
     * tax
36
     * shipping
37
     * first_name
38
     * last_name
39
     * company
40
     * address
41
     * city
42
     * state
43
     * zip
44
     * email
45
     * phone
46
     * fax
47
     * ship_to_first_name
48
     * ship_to_last_name
49
     * ship_to_company
50
     * ship_to_address
51
     * ship_to_city
52
     * ship_to_state
53
     * ship_to_zip
54
     *
55
     * @param  array  the driver string
56
     */
57
    public function __construct($config = array())
58
    {
59
        if (empty($config)) {
60
            // Load the default group
61
            $config = Kohana::config('payment.default');
62
        } elseif (is_string($config)) {
63
            $this->config['driver'] = $config;
64
        }
65
66
        // Merge the default config with the passed config
67
        is_array($config) and $this->config = array_merge($this->config, $config);
68
69
        // Set driver name
70
        $driver = 'Payment_'.ucfirst($this->config['driver']).'_Driver';
71
72
        // Load the driver
73 View Code Duplication
        if (! Kohana::auto_load($driver)) {
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...
74
            throw new Kohana_Exception('core.driver_not_found', $this->config['driver'], get_class($this));
75
        }
76
77
        // Get the driver specific settings
78
        $this->config = array_merge($this->config, Kohana::config('payment.'.$this->config['driver']));
79
80
        // Initialize the driver
81
        $this->driver = new $driver($this->config);
82
83
        // Validate the driver
84 View Code Duplication
        if (! ($this->driver instanceof Payment_Driver)) {
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...
85
            throw new Kohana_Exception('core.driver_implements', $this->config['driver'], get_class($this), 'Payment_Driver');
86
        }
87
    }
88
89
    /**
90
     * Sets the credit card processing fields
91
     *
92
     * @param  string  field name
93
     * @param  string  value
94
     */
95
    public function __set($name, $val)
96
    {
97
        $this->driver->set_fields(array($name => $val));
98
    }
99
100
    /**
101
     * Bulk setting of payment processing fields.
102
     *
103
     * @param   array   array of values to set
104
     * @return  Payment_Core  this object
105
     */
106
    public function set_fields($fields)
107
    {
108
        $this->driver->set_fields((array) $fields);
109
110
        return $this;
111
    }
112
113
    /**
114
     * Runs the transaction
115
     *
116
     * @return  TRUE|string  TRUE on successful payment, an error string on failure
117
     */
118
    public function process()
119
    {
120
        return $this->driver->process();
121
    }
122
}
123