Issues (508)

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.

src/Framework/WpExtension.php (1 issue)

1
<?php
2
3
namespace Leonidas\Framework;
4
5
use Leonidas\Contracts\Extension\WpExtensionInterface;
6
use Leonidas\Framework\Plugin\Plugin;
7
use Leonidas\Framework\Theme\Theme;
8
use Psr\Container\ContainerInterface;
9
10
class WpExtension implements WpExtensionInterface
11
{
12
    protected string $name;
13
14
    protected string $version;
15
16
    protected string $slug;
17
18
    protected string $namespace;
19
20
    protected string $prefix;
21
22
    protected string $description;
23
24
    protected string $path;
25
26
    protected string $url;
27
28
    protected string $type;
29
30
    protected ContainerInterface $container;
31
32
    protected bool $isInDev;
33
34
    public function __construct(string $type, string $path, string $url, ContainerInterface $container)
35
    {
36
        $this->type = $type;
37
        $this->path = $path;
38
        $this->url = $url;
39
        $this->container = $container;
40
    }
41
42
    /**
43
     * {@inheritDoc}
44
     */
45
    public function getName(): string
46
    {
47
        return $this->name ??= $this->config('app.name');
48
    }
49
50
    /**
51
     * {@inheritDoc}
52
     */
53
    public function getVersion(): string
54
    {
55
        return $this->version ??= $this->config('app.version');
56
    }
57
58
    /**
59
     * {@inheritDoc}
60
     */
61
    public function getSlug(): string
62
    {
63
        return $this->slug ??= $this->config('app.slug');
64
    }
65
66
    /**
67
     * {@inheritDoc}
68
     */
69
    public function getNamespace(): string
70
    {
71
        return $this->namespace ??= $this->config('app.namespace');
72
    }
73
74
    /**
75
     * {@inheritDoc}
76
     */
77
    public function getPrefix(): string
78
    {
79
        return $this->prefix ??= $this->config('app.prefix');
80
    }
81
82
    /**
83
     * {@inheritDoc}
84
     */
85
    public function getDescription(): string
86
    {
87
        return $this->description ??= $this->config('app.description');
88
    }
89
90
    /**
91
     * {@inheritDoc}
92
     */
93
    public function getPath(): string
94
    {
95
        return $this->path;
96
    }
97
98
    /**
99
     * {@inheritDoc}
100
     */
101
    public function getUrl(): string
102
    {
103
        return $this->url;
104
    }
105
106
    /**
107
     * {@inheritDoc}
108
     */
109
    public function getType(): string
110
    {
111
        return $this->type;
112
    }
113
114
    /**
115
     * {@inheritDoc}
116
     */
117
    public function isInDev(): bool
118
    {
119
        return $this->isInDev ??= $this->config('app.dev');
120
    }
121
122
    /**
123
     * {@inheritDoc}
124
     */
125
    public function get(string $id)
126
    {
127
        return $this->container->get($id);
128
    }
129
130
    /**
131
     * {@inheritDoc}
132
     */
133
    public function has(string $id): bool
134
    {
135
        return $this->container->has($id);
136
    }
137
138
    /**
139
     * {@inheritDoc}
140
     */
141
    public function header(string $header): ?string
142
    {
143
        switch ($this->getType()) {
144
            case 'plugin':
145
                $headers = Plugin::headers(static::absPath('/plugin.php'));
0 ignored issues
show
Bug Best Practice introduced by
The method Leonidas\Framework\WpExtension::absPath() is not static, but was called statically. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

145
                $headers = Plugin::headers(static::/** @scrutinizer ignore-call */ absPath('/plugin.php'));
Loading history...
146
147
                break;
148
149
            case 'theme':
150
                $headers = Theme::headers(static::absPath('/style.css'));
151
152
                break;
153
        }
154
155
        return $headers[$header] ?? null;
156
    }
157
158
    /**
159
     * {@inheritDoc}
160
     */
161
    public function config(string $key, $default = null)
162
    {
163
        return $this->get('config')->get($key, $default);
164
    }
165
166
    /**
167
     * {@inheritDoc}
168
     */
169
    public function hasConfig(string $key): bool
170
    {
171
        return $this->get('config')->has($key);
172
    }
173
174
    /**
175
     * {@inheritDoc}
176
     */
177
    public function relPath(?string $file = null): ?string
178
    {
179
        return null;
180
    }
181
182
    /**
183
     * {@inheritDoc}
184
     */
185
    public function absPath(?string $file = null): ?string
186
    {
187
        return $this->getPath() . $file;
188
    }
189
190
    /**
191
     * {@inheritDoc}
192
     */
193
    public function url(?string $route = null): string
194
    {
195
        return $this->getUrl() . $route;
196
    }
197
198
    /**
199
     * {@inheritDoc}
200
     */
201
    public function namespace(string $value, string $separator = '/'): string
202
    {
203
        return $this->getNamespace() . $separator . $value;
204
    }
205
206
    /**
207
     * {@inheritDoc}
208
     */
209
    public function prefix(string $value, string $separator = '_'): string
210
    {
211
        return $this->getPrefix() . $separator . $value;
212
    }
213
214
    /**
215
     * {@inheritDoc}
216
     */
217
    public function doAction(string $event, ...$data): void
218
    {
219
        do_action($this->namespace($event, '/'), ...$data);
220
    }
221
222
    /**
223
     * {@inheritDoc}
224
     */
225
    public function applyFilters(string $attribute, $value, ...$data): void
226
    {
227
        apply_filters($this->namespace($attribute, '/'), $value, ...$data);
228
    }
229
230
    /**
231
     * Returns a new instance of WpExtension using values in the array passed.
232
     *
233
     * @param array $args
234
     *
235
     * @return WpExtension
236
     */
237
    public static function create(array $args): WpExtension
238
    {
239
        return new static(
240
            $args['type'],
241
            $args['path'],
242
            $args['url'],
243
            $args['container'],
244
        );
245
    }
246
}
247