Issues (1240)

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.

modules/kodoc/controllers/kodoc.php (3 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 defined('SYSPATH') or die('No direct access allowed.');
2
3
class Kodoc_Controller extends Template_Controller
4
{
5
6
    // Do not allow to run in production
7
    const ALLOW_PRODUCTION = false;
8
9
    public $template = 'kodoc/template';
10
11
    // Kodoc instance
12
    protected $kodoc;
13
14
    public function __construct()
15
    {
16
        parent::__construct();
17
18
        $active = $this->uri->segment(2) ? $this->uri->segment(2) : 'core';
0 ignored issues
show
The property uri does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
19
20
        // Add the menu to the template
21
        $this->template->menu = new View('kodoc/menu', array('active' => $active));
22
    }
23
24
    public function index()
25
    {
26
        $this->template->content = 'hi';
27
    }
28
29
    public function media()
30
    {
31
        if (isset($this->profiler)) {
32
            $this->profiler->disable();
0 ignored issues
show
The property profiler does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
33
        }
34
35
        // Get the filename
36
        $file = implode('/', $this->uri->segment_array(1));
37
        $ext = strrchr($file, '.');
38
39
        if ($ext !== false) {
40
            $file = substr($file, 0, -strlen($ext));
41
            $ext = substr($ext, 1);
42
        }
43
44
        // Disable auto-rendering
45
        $this->auto_render = false;
46
47
        try {
48
            // Attempt to display the output
49
            echo new View('kodoc/'.$file, null, $ext);
50
        } catch (Kohana_Exception $e) {
0 ignored issues
show
catch (\Kohana_Exception...t::run('system.404'); } does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
51
            Event::run('system.404');
52
        }
53
    }
54
55
    public function __call($method, $args)
56
    {
57
        if (count($segments = $this->uri->segment_array(1)) > 1) {
58
            // Find directory (type) and filename
59
            $type = array_shift($segments);
60
            $file = implode('/', $segments);
61
62
            if (substr($file, -(strlen(EXT))) === EXT) {
63
                // Remove extension
64
                $file = substr($file, 0, -(strlen(EXT)));
65
            }
66
67
            if ($type === 'config') {
68
                if ($file === 'config') {
69
                    // This file can only exist in one location
70
                    $file = APPPATH.$type.'/config'.EXT;
71
                } else {
72
                    foreach (array_reverse(Kohana::include_paths()) as $path) {
73
                        if (is_file($path.$type.'/'.$file.EXT)) {
74
                            // Found the file
75
                            $file = $path.$type.'/'.$file.EXT;
76
                            break;
77
                        }
78
                    }
79
                }
80
            } else {
81
                // Get absolute path to file
82
                $file = Kohana::find_file($type, $file);
83
            }
84
85
            if (in_array($type, Kodoc::get_types())) {
86
                // Load Kodoc
87
                $this->kodoc = new Kodoc($type, $file);
88
89
                // Set the title
90
                $this->template->title = implode('/', $this->uri->segment_array(1));
91
92
                // Load documentation for this file
93
                $this->template->content = new View('kodoc/documentation');
94
95
                // Exit this method
96
                return;
97
            }
98
        }
99
100
        // Nothing to document
101
        url::redirect('kodoc');
102
    }
103
} // End Kodoc Controller
104