Issues (102)

Security Analysis    no vulnerabilities found

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.

plugin/Hooks/AbstractHooks.php (4 issues)

1
<?php
2
3
namespace GeminiLabs\SiteReviews\Hooks;
4
5
use GeminiLabs\SiteReviews\Contracts\HooksContract;
6
7
/**
8
 * Trigger order of primary WP hooks:
9
 * 
10
 * 1. plugins_loaded     Fires once activated plugins have loaded.
11
 * 2. load_textdomain    Fires before the MO translation file is loaded.
12
 * 3. after_setup_theme  Fires after the theme is loaded.
13
 * 4. init               Fires after WordPress has finished loading but before any headers are sent.
14
 * 5. wp_loaded          Fires after WordPress, all plugins, and the theme are fully loaded and instantiated.
15
 * 6. admin_init         Fires as an admin screen or script is being initialized.
16
 * 7. current_screen     Fires after the current screen has been set.
17
 * 8. load-{$page_hook}  Fires before a particular screen is loaded.
18
 */
19
abstract class AbstractHooks implements HooksContract
20
{
21
    protected $basename;
22
    protected $id;
23
    protected $prefix;
24
    protected $taxonomy;
25
    protected $type;
26
27
    public function __construct()
28
    {
29
        $this->basename = glsr()->basename;
30
        $this->id = glsr()->id;
31
        $this->prefix = glsr()->prefix;
32
        $this->taxonomy = glsr()->taxonomy;
33
        $this->type = glsr()->post_type;
34
    }
35
36
    public function hook(string $classname, array $hooks): void
37
    {
38
        glsr()->singleton($classname); // make singleton
39
        $controller = glsr($classname);
40
        foreach ($hooks as $hook) {
41
            if (2 > count($hook)) {
42
                continue;
43
            }
44
            $func = str_starts_with($hook[0], 'filter') ? 'add_filter' : 'add_action';
45
            $hook = array_pad($hook, 3, 10); // priority
46
            $hook = array_pad($hook, 4, 1); // accepted args
47
            $args = [ // order is intentional!
48
                'hook' => $hook[1],
49
                'callback' => [$controller, $hook[0]],
50
                'priority' => (int) $hook[2],
51
                'args' => (int) $hook[3],
52
            ];
53
            if (!str_starts_with($args['hook'], glsr()->id) && method_exists($controller, 'proxy')) {
54
                $args['callback'] = $controller->proxy($hook[0]);
55
            }
56
            call_user_func_array($func, array_values($args));
57
        }
58
    }
59
60
    public function levelInit(): ?int
61
    {
62
        return null;
63
    }
64
65
    public function levelPluginsLoaded(): ?int
66
    {
67
        return null;
68
    }
69
70
    /**
71
     * @action init
72
     */
73
    public function onInit(): void
74
    {
75
    }
76
77
    /**
78
     * @action plugins_loaded
79
     */
80
    public function onPluginsLoaded(): void
81
    {
82
    }
83
84
    /**
85
     * @param mixed $fallback
86
     *
87
     * @return mixed
88
     */
89
    public function option(string $path, $fallback = '', string $cast = '')
90
    {
91
        return glsr_get_option($path, $fallback, $cast);
92
    }
93
94
    public function run(): void
95
    {
96
    }
97
98
    public function runDeferred(): void
99
    {
100
        if (null !== ($level = $this->levelInit())) {
0 ignored issues
show
The condition null !== $level = $this->levelInit() is always false.
Loading history...
Are you sure the assignment to $level is correct as $this->levelInit() targeting GeminiLabs\SiteReviews\H...tractHooks::levelInit() seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
101
            add_action('init', [$this, 'onInit'], $level);
102
        }
103
        if (null !== ($level = $this->levelPluginsLoaded())) {
0 ignored issues
show
Are you sure the assignment to $level is correct as $this->levelPluginsLoaded() targeting GeminiLabs\SiteReviews\H...s::levelPluginsLoaded() seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
The condition null !== $level = $this->levelPluginsLoaded() is always false.
Loading history...
104
            add_action('plugins_loaded', [$this, 'onPluginsLoaded'], $level);
105
        }
106
    }
107
}
108