Issues (181)

Security Analysis    no request data  

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.

sources/AliasResolver.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
2
3
namespace Jumilla\Addomnipot\Laravel;
4
5
use Illuminate\Config\Repository;
6
use Illuminate\Container\Container;
7
8
class AliasResolver
9
{
10
    /**
11
     * @var static
12
     */
13
    protected static $instance;
14
15
    /**
16
     * @param string $apppath
17
     * @param array $addons
18
     * @param array $aliases
19
     */
20 2
    public static function register($apppath, array $addons, array $aliases)
21
    {
22 2
        static::$instance = new static($apppath, $addons, $aliases);
23
24 2
        spl_autoload_register([static::$instance, 'load'], true, false);
25 2
    }
26
27
    /**
28
     */
29 1
    public static function unregister()
30
    {
31 1
        if (static::$instance) {
32 1
            spl_autoload_unregister([static::$instance, 'load']);
33
        }
34 1
    }
35
36
    /**
37
     * @var array
38
     */
39
    protected $addons;
40
41
    /**
42
     * @var array
43
     */
44
    protected $globalClassAliases;
45
46
    /**
47
     * The constructor.
48
     *
49
     * @param string $apppath
50
     * @param array $addons
51
     * @param array $aliases
52
     */
53 3
    public function __construct($apppath, array $addons, array $aliases)
54
    {
55 3
        $this->addons = array_merge([$this->makeAppAddon($apppath)], $addons);
56 3
        $this->globalClassAliases = $aliases;
57 3
    }
58
59
    /**
60
     * Make addon instance for application namespace.
61
     *
62
     * @param string $path
63
     *
64
     * @return static
65
     */
66 3
    protected function makeAppAddon($path)
67
    {
68
        $config = [
69 3
            'namespace' => trim($this->getAppNamespace(), '\\'),
70
        ];
71
72 3
        return new Addon(null, 'app', $path, $config);
0 ignored issues
show
null is of type null, but the function expects a object<Illuminate\Contra...Foundation\Application>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
73
    }
74
75
    /**
76
     * @param string $className
77
     *
78
     * @return bool
79
     */
80 1
    public function load($className)
81
    {
82 1
        foreach ($this->addons as $addon) {
83 1
            $namespace = $addon->phpNamespace();
84
85
            // 名前空間のないパッケージはエイリアス解決をする必要がない
86 1
            if (empty($namespace)) {
87 1
                continue;
88
            }
89
90 1
            $namespacePrefix = $namespace.'\\';
91 1
            $includesGlobalAliases = $addon->config('addon.includes_global_aliases', true);
92 1
            $addonAliases = $addon->config('addon.aliases', []);
93
94
            // アドオンの名前空間下のクラスでないなら
95 1
            if (!starts_with($className, $namespacePrefix)) {
96 1
                continue;
97
            }
98
99
            // クラス名を取り出す
100 1
            $parts = explode('\\', $className);
101 1
            $relativeClassName = $parts[count($parts) - 1];
102
103
            // グローバルなエイリアスかチェックする
104 1
            if ($includesGlobalAliases) {
105 1
                if (isset($this->globalClassAliases[$relativeClassName])) {
106 1
                    $originalClassName = $this->globalClassAliases[$relativeClassName];
107 1
                    class_alias($originalClassName, $className);
108
109 1
                    return true;
110
                }
111
            }
112
113
            // パッケージ固有のエイリアスかチェックする
114 1
            if ($addonAliases) {
115 1
                if (isset($addonAliases[$relativeClassName])) {
116 1
                    $originalClassName = $addonAliases[$relativeClassName];
117 1
                    class_alias($originalClassName, $className);
118
119 1
                    return true;
120
                }
121
            }
122
        }
123
124 1
        return false;
125
    }
126
127
    /**
128
     * Get the application namespace.
129
     *
130
     * @return string
131
     */
132 3
    protected function getAppNamespace()
133
    {
134 3
        return Container::getInstance()->getNamespace();
0 ignored issues
show
The method getNamespace() does not seem to exist on object<Illuminate\Container\Container>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
135
    }
136
}
137