Issues (42)

Security Analysis    no request data  

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.

src/CloverToHtml/Root.php (2 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
2
3
/**
4
 * This file is part of the Clover to Html package.
5
 *
6
 * (c) Stéphane Demonchaux <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
namespace CloverToHtml;
12
13
class Root
14
{
15
    /**
16
     * @var array
17
     */
18
    private $directories = array();
19
    /**
20
     * @var array
21
     */
22
    private $files = array();
23
    /**
24
     * @var string
25
     */
26
    private $basePath;
27
28
    /**
29
     * @param string $basePath
30
     */
31
    public function setBasePath($basePath): void
32
    {
33
        $this->basePath = $basePath;
34
    }
35
36
    /**
37
     * @param File $file
38
     */
39
    public function addFile(File $file): void
40
    {
41
        $this->files[] = $file;
42
    }
43
44
    /**
45
     * @param Directory $directory
46
     */
47
    public function addDirectory(Directory $directory): void
48
    {
49
        $this->directories[$directory->getPath()] = $directory;
50
    }
51
52
    /**
53
     * @return string
54
     */
55
    public function getBasePath(): string
56
    {
57
        return $this->basePath;
58
    }
59
60
    /**
61
     * @return File[]
62
     */
63
    public function getFileCollection(): array
64
    {
65
        return $this->files;
66
    }
67
68
    /**
69
     * @return array
70
     */
71
    public function getDirectoryCollection(): array
72
    {
73
        return $this->directories;
74
    }
75
76
    /**
77
     * @param string $name
78
     *
79
     * @return bool
80
     */
81
    public function hasDirectory($name): bool
82
    {
83
        return isset($this->directories[$name]);
84
    }
85
86
    /**
87
     * @param string $name
88
     *
89
     * @return Directory
90
     */
91
    public function getDirectoryByName($name): Directory
92
    {
93
        return $this->directories[$name];
94
    }
95
96
    /**
97
     * @param Directory $directory
98
     * @return Directory[]
99
     */
100
    public function getAllDirIn(Directory $directory): array
101
    {
102
        $dirCollection  = array();
0 ignored issues
show
Equals sign not aligned with surrounding assignments; expected 1 space but found 2 spaces

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
103
        $currentDir     = trim($directory->getPath());
0 ignored issues
show
Equals sign not aligned with surrounding assignments; expected 4 spaces but found 5 spaces

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
104
105
        foreach ($this->directories as $path => $dir) {
106
            /* @var $dir Directory */
107
            if ($currentDir !== '' &&
108
                trim($path) !== $currentDir &&
109
                strpos(trim($path), $currentDir) === 0
110
                ) {
111
                $dirCollection[] = $dir;
112
            }
113
        }
114
115
        return $dirCollection;
116
    }
117
}
118