Issues (100)

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/Kernel/ServiceContainer.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
namespace Kaylyu\Alipay\Kernel;
4
5
use Kaylyu\Alipay\Kernel\Providers\ConfigServiceProvider;
6
use Kaylyu\Alipay\Kernel\Providers\HttpClientServiceProvider;
7
use Kaylyu\Alipay\Kernel\Providers\LogServiceProvider;
8
use Kaylyu\Alipay\Kernel\Providers\RequestServiceProvider;
9
use Pimple\Container;
10
11
/**
12
 * Class ServiceContainer.
13
 *
14
 * @property \Kaylyu\Alipay\Kernel\Config $config
15
 * @property \Symfony\Component\HttpFoundation\Request $request
16
 * @property \GuzzleHttp\Client $http_client
17
 * @property \Monolog\Logger $logger
18
 */
19
class ServiceContainer extends Container
20
{
21
    /**
22
     * @var string
23
     */
24
    protected $id;
25
26
    /**
27
     * @var array
28
     */
29
    protected $providers = [];
30
31
    /**
32
     * @var array
33
     */
34
    protected $defaultConfig = [];
35
36
    /**
37
     * @var array
38
     */
39
    protected $userConfig = [];
40
41
    /**
42
     * Constructor.
43
     *
44
     * @param array $config
45
     * @param array $prepends
46
     * @param string|null $id
47
     */
48
    public function __construct(array $config = [], array $prepends = [], string $id = null)
49
    {
50
        $this->registerProviders($this->getProviders());
51
52
        parent::__construct($prepends);
53
54
        $this->userConfig = $config;
55
56
        $this->id = $id;
57
    }
58
59
    /**
60
     * @return string
61
     */
62
    public function getId()
63
    {
64
        return $this->id ?? $this->id = md5(json_encode($this->userConfig));
65
    }
66
67
    /**
68
     * 当面付
69
     * @return array
70
     */
71
    public function getF2fpay() : array
72
    {
73
        return $this->config->get('f2fpay');
74
    }
75
76
    /**
77
     * @return array
78
     */
79
    public function getConfig()
80
    {
81
        $base = [
82
            // http://docs.guzzlephp.org/en/stable/request-options.html
83
            'http' => [
84
                'timeout' => 5.0,
85
                'base_uri' => '',
86
            ],
87
        ];
88
89
        return array_replace_recursive($base, $this->defaultConfig, $this->userConfig);
90
    }
91
92
    /**
93
     * Return all providers.
94
     *
95
     * @return array
96
     */
97
    public function getProviders()
98
    {
99
        return array_merge([
100
            ConfigServiceProvider::class,
101
            LogServiceProvider::class,
102
            RequestServiceProvider::class,
103
            HttpClientServiceProvider::class,
104
        ], $this->providers);
105
    }
106
107
    /**
108
     * @param string $id
109
     * @param mixed $value
110
     */
111
    public function rebind($id, $value)
112
    {
113
        $this->offsetUnset($id);
114
        $this->offsetSet($id, $value);
115
    }
116
117
    /**
118
     * Magic get access.
119
     *
120
     * @param string $id
121
     *
122
     * @return mixed
123
     */
124
    public function __get($id)
125
    {
126
        return $this->offsetGet($id);
127
    }
128
129
    /**
130
     * Magic set access.
131
     *
132
     * @param string $id
133
     * @param mixed $value
134
     */
135
    public function __set($id, $value)
136
    {
137
        $this->offsetSet($id, $value);
138
    }
139
140
    /**
141
     * @param array $providers
142
     */
143
    public function registerProviders(array $providers)
144
    {
145
        foreach ($providers as $provider) {
146
            parent::register(new $provider());
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (register() instead of registerProviders()). Are you sure this is correct? If so, you might want to change this to $this->register().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
147
        }
148
    }
149
}
150