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.

bin/plugin.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
#!/usr/bin/env php
2
<?php
3
4
use dokuwiki\Extension\PluginController;
5
use splitbrain\phpcli\CLI;
6
use splitbrain\phpcli\Colors;
7
use splitbrain\phpcli\Options;
8
9
if(!defined('DOKU_INC')) define('DOKU_INC', realpath(dirname(__FILE__) . '/../') . '/');
10
define('NOSESSION', 1);
11
require_once(DOKU_INC . 'inc/init.php');
12
13
class PluginCLI extends CLI {
14
15
    /**
16
     * Register options and arguments on the given $options object
17
     *
18
     * @param Options $options
19
     * @return void
20
     */
21
    protected function setup(Options $options) {
22
        $options->setHelp('Excecutes Plugin command line tools');
23
        $options->registerArgument('plugin', 'The plugin CLI you want to run. Leave off to see list', false);
24
    }
25
26
    /**
27
     * Your main program
28
     *
29
     * Arguments and options have been parsed when this is run
30
     *
31
     * @param Options $options
32
     * @return void
33
     */
34
    protected function main(Options $options) {
35
        global $argv;
36
        $argv = $options->getArgs();
37
38
        if($argv) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $argv of type array is implicitly converted to a boolean; are you sure this is intended? If so, consider using ! empty($expr) instead to make it clear that you intend to check for an array without elements.

This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.

Consider making the comparison explicit by using empty(..) or ! empty(...) instead.

Loading history...
39
            $plugin = $this->loadPlugin($argv[0]);
40
            if($plugin !== null) {
41
                $plugin->run();
42
            } else {
43
                $this->fatal('Command {cmd} not found.', ['cmd' => $argv[0]]);
44
            }
45
        } else {
46
            echo $options->help();
47
            $this->listPlugins();
48
        }
49
    }
50
51
    /**
52
     * List available plugins
53
     */
54
    protected function listPlugins() {
55
        /** @var PluginController $plugin_controller */
56
        global $plugin_controller;
57
58
        echo "\n";
59
        echo "\n";
60
        echo $this->colors->wrap('AVAILABLE PLUGINS:', Colors::C_BROWN);
61
        echo "\n";
62
63
        $list = $plugin_controller->getList('cli');
64
        sort($list);
65
        if(!count($list)) {
66
            echo $this->colors->wrap("  No plugins providing CLI components available\n", Colors::C_RED);
67
        } else {
68
            $tf = new \splitbrain\phpcli\TableFormatter($this->colors);
69
70
            foreach($list as $name) {
71
                $plugin = $this->loadPlugin($name);
72
                if($plugin === null) continue;
73
                $info = $plugin->getInfo();
74
75
                echo $tf->format(
76
                    [2, '30%', '*'],
77
                    ['', $name, $info['desc']],
78
                    ['', Colors::C_CYAN, '']
79
80
                );
81
            }
82
        }
83
    }
84
85
    /**
86
     * Instantiate a CLI plugin
87
     *
88
     * @param string $name
89
     * @return \dokuwiki\Extension\CLIPlugin|null
90
     */
91
    protected function loadPlugin($name) {
92
        // execute the plugin CLI
93
        $class = "cli_plugin_$name";
94
        if(class_exists($class)) {
95
            return new $class();
96
        }
97
        return null;
98
    }
99
}
100
101
// Main
102
$cli = new PluginCLI();
103
$cli->run();
104