Issues (127)

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.

Documentation/Traits/DocsGeneratorTrait.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
<?php
2
3
namespace App\Containers\Documentation\Traits;
4
5
use DateTime;
6
use Illuminate\Support\Facades\Config;
7
8
/**
9
 * Class DocsGeneratorTrait
10
 *
11
 * @author  Mahmoud Zalt  <[email protected]>
12
 */
13
trait DocsGeneratorTrait
14
{
15
16
    /**
17
     * @param $type
18
     *
19
     * @return mixed
20
     */
21
    private function getFullApiUrl($type)
22
    {
23
        return '> ' . $this->getAppUrl() . '/' . $this->getUrl($type);
24
    }
25
26
    /**
27
     * @return  mixed
28
     */
29
    private function getAppUrl()
30
    {
31
        return Config::get('app.url');
32
    }
33
34
    /**
35
     * @return  mixed
36
     */
37
    private function getHtmlPath()
38
    {
39
        return Config::get("{$this->getConfigFile()}.html_files");
40
    }
41
42
    /**
43
     * Where to generate the new documentation.
44
     *
45
     * @param $type
46
     *
47
     * @return string
48
     */
49
    private function getDocumentationPath($type)
50
    {
51
        return $this->getHtmlPath() . $this->getUrl($type);
52
    }
53
54
    /**
55
     * @param $type
56
     *
57
     * @return string
58
     */
59
    private function getJsonFilePath($type)
60
    {
61
        return "app/Containers/Documentation/ApiDocJs/{$type}";
62
    }
63
64
    /**
65
     * @return  string
66
     */
67
    private function getConfigFile()
68
    {
69
        return 'documentation-container';
70
    }
71
72
    /**
73
     * @return  mixed
74
     */
75
    private function getTypeConfig()
76
    {
77
        return Config::get($this->getConfigFile() . '.types');
78
    }
79
80
    /**
81
     * @return  mixed
82
     */
83
    private function getExecutable()
84
    {
85
        return Config::get($this->getConfigFile() . '.executable');
86
    }
87
88
    /**
89
     * @param $type
90
     *
91
     * @return  mixed
92
     */
93
    private function getUrl($type)
94
    {
95
        $configs = $this->getTypeConfig();
96
97
        return $configs[$type]['url'];
98
    }
99
100
    /**
101
     * @param $type
102
     *
103
     * @return  string
104
     */
105
    private function getEndpointFiles($type)
106
    {
107
        $configs = $this->getTypeConfig();
108
109
        // what files types needs to be included
110
        $routeFilesCommand = '';
111
        $routes = $configs[$type]['routes'];
112
113
        foreach ($routes as $route) {
114
            $routeFilesCommand .= '-f ' . $route . '.php ';
115
        }
116
117
        return $routeFilesCommand;
118
    }
119
120
121
    /**
122
     * @param $templateKey
123
     * @param $value
124
     */
125
    private function replace($templateKey, $value)
126
    {
127
        $this->headerMarkdownContent = str_replace($templateKey, $value, $this->headerMarkdownContent);
0 ignored issues
show
The property headerMarkdownContent 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...
128
    }
129
130
    /**
131
     * @param $minutes
132
     *
133
     * @return  string
134
     */
135
    private function minutesToTimeDisplay($minutes)
136
    {
137
        $seconds = $minutes * 60;
138
139
        $dtF = new DateTime('@0');
140
        $dtT = new DateTime("@$seconds");
141
142
        return $dtF->diff($dtT)->format('%a days, %h hours, %i minutes and %s seconds');
143
    }
144
145
}
146