Issues (847)

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.

inc/pluginutils.php (1 issue)

Labels
Severity

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
 * Utilities for handling plugins
4
 *
5
 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
6
 * @author     Andreas Gohr <[email protected]>
7
 */
8
9
// plugin related constants
10
use dokuwiki\Extension\AdminPlugin;
11
use dokuwiki\Extension\PluginController;
12
use dokuwiki\Extension\PluginInterface;
13
14
if(!defined('DOKU_PLUGIN'))  define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
15
// note that only [a-z0-9]+ is officially supported,
16
// this is only to support plugins that don't follow these conventions, too
17
if(!defined('DOKU_PLUGIN_NAME_REGEX')) define('DOKU_PLUGIN_NAME_REGEX', '[a-zA-Z0-9\x7f-\xff]+');
18
19
/**
20
 * Original plugin functions, remain for backwards compatibility
21
 */
22
23
/**
24
 * Return list of available plugins
25
 *
26
 * @param string $type type of plugins; empty string for all
27
 * @param bool $all; true to retrieve all, false to retrieve only enabled plugins
0 ignored issues
show
There is no parameter named $all;. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
28
 * @return array with plugin names or plugin component names
29
 */
30
function plugin_list($type='',$all=false)
31
{
32
    /** @var $plugin_controller PluginController */
33
    global $plugin_controller;
34
    $plugins = $plugin_controller->getList($type,$all);
35
    sort($plugins, SORT_NATURAL|SORT_FLAG_CASE);
36
    return $plugins;
37
}
38
39
/**
40
 * Returns plugin object
41
 * Returns only new instances of a plugin when $new is true or if plugin is not Singleton,
42
 * otherwise an already loaded instance.
43
 *
44
 * @param  $type     string type of plugin to load
45
 * @param  $name     string name of the plugin to load
46
 * @param  $new      bool   true to return a new instance of the plugin, false to use an already loaded instance
47
 * @param  $disabled bool   true to load even disabled plugins
48
 * @return PluginInterface|null  the plugin object or null on failure
49
 */
50
function plugin_load($type,$name,$new=false,$disabled=false)
51
{
52
    /** @var $plugin_controller PluginController */
53
    global $plugin_controller;
54
    return $plugin_controller->load($type,$name,$new,$disabled);
55
}
56
57
/**
58
 * Whether plugin is disabled
59
 *
60
 * @param string $plugin name of plugin
61
 * @return bool true disabled, false enabled
62
 */
63
function plugin_isdisabled($plugin)
64
{
65
    /** @var $plugin_controller PluginController */
66
    global $plugin_controller;
67
    return !$plugin_controller->isEnabled($plugin);
68
}
69
70
/**
71
 * Enable the plugin
72
 *
73
 * @param string $plugin name of plugin
74
 * @return bool true saving succeed, false saving failed
75
 */
76
function plugin_enable($plugin)
77
{
78
    /** @var $plugin_controller PluginController */
79
    global $plugin_controller;
80
    return $plugin_controller->enable($plugin);
81
}
82
83
/**
84
 * Disable the plugin
85
 *
86
 * @param string $plugin name of plugin
87
 * @return bool  true saving succeed, false saving failed
88
 */
89
function plugin_disable($plugin)
90
{
91
    /** @var $plugin_controller PluginController */
92
    global $plugin_controller;
93
    return $plugin_controller->disable($plugin);
94
}
95
96
/**
97
 * Returns directory name of plugin
98
 *
99
 * @param string $plugin name of plugin
100
 * @return string name of directory
101
 * @deprecated 2018-07-20
102
 */
103
function plugin_directory($plugin)
104
{
105
    dbg_deprecated('$plugin directly');
106
    return $plugin;
107
}
108
109
/**
110
 * Returns cascade of the config files
111
 *
112
 * @return array with arrays of plugin configs
113
 */
114
function plugin_getcascade()
115
{
116
    /** @var $plugin_controller PluginController */
117
    global $plugin_controller;
118
    return $plugin_controller->getCascade();
119
}
120
121
122
/**
123
 * Return the currently operating admin plugin or null
124
 * if not on an admin plugin page
125
 *
126
 * @return Doku_Plugin_Admin
127
 */
128
function plugin_getRequestAdminPlugin()
129
{
130
    static $admin_plugin = false;
131
    global $ACT,$INPUT,$INFO;
132
133
    if ($admin_plugin === false) {
134
        if (($ACT == 'admin') && ($page = $INPUT->str('page', '', true)) != '') {
135
            $pluginlist = plugin_list('admin');
136
            if (in_array($page, $pluginlist)) {
137
                // attempt to load the plugin
138
                /** @var $admin_plugin AdminPlugin */
139
                $admin_plugin = plugin_load('admin', $page);
140
                // verify
141
                if ($admin_plugin && !$admin_plugin->isAccessibleByCurrentUser()) {
142
                    $admin_plugin = null;
143
                    $INPUT->remove('page');
144
                    msg('For admins only',-1);
145
                }
146
            }
147
        }
148
    }
149
150
    return $admin_plugin;
151
}
152