Issues (65)

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.

src/Http/Controllers/AdminController.php (5 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
namespace Sco\Admin\Http\Controllers;
4
5
use Illuminate\Auth\Access\AuthorizationException;
6
use Illuminate\Http\Request;
7
use Illuminate\Routing\Controller;
8
use Sco\Admin\Contracts\ComponentInterface;
9
use Sco\Admin\Facades\AdminNavigation;
10
11
/**
12
 * Class AdminController
13
 *
14
 * @package Sco\Admin\Http\Controllers
15
 */
16
class AdminController extends Controller
17
{
18
    /**
19
     * Get page left navigation
20
     *
21
     * @return \Illuminate\Http\JsonResponse
22
     */
23
    public function getMenu()
24
    {
25
        $pages = AdminNavigation::filterByAccessRights()
26
            ->sort()
27
            ->getPages();
28
        return response()->json($pages);
29
    }
30
31
    /**
32
     * Component index page
33
     *
34
     * @param \Sco\Admin\Contracts\ComponentInterface $component
35
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
36
     * @throws \Illuminate\Auth\Access\AuthorizationException
37
     */
38
    public function index(ComponentInterface $component)
39
    {
40
        if (! $component->isDisplay()) {
41
            throw new AuthorizationException();
42
        }
43
44
        return view('admin::app');
45
    }
46
47
    /**
48
     * Component list data
49
     *
50
     * @param \Sco\Admin\Contracts\ComponentInterface $component
51
     * @return mixed
52
     * @throws \Illuminate\Auth\Access\AuthorizationException
53
     */
54
    public function getList(ComponentInterface $component)
55
    {
56
        if (! $component->isDisplay()) {
57
            throw new AuthorizationException();
58
        }
59
60
        return $component->get();
61
    }
62
63
    /**
64
     * Component config data
65
     *
66
     * @param \Sco\Admin\Contracts\ComponentInterface $component
67
     * @return \Illuminate\Support\Collection
68
     * @throws \Illuminate\Auth\Access\AuthorizationException
69
     */
70
    public function config(ComponentInterface $component)
71
    {
72
        if (! $component->isDisplay()) {
73
            throw new AuthorizationException();
74
        }
75
76
        return $component->getConfigs();
77
    }
78
79
    /**
80
     * @param \Sco\Admin\Contracts\ComponentInterface $component
81
     * @return null|\Sco\Admin\Contracts\Form\FormInterface
82
     * @throws \Illuminate\Auth\Access\AuthorizationException
83
     */
84
    public function getCreateInfo(ComponentInterface $component)
85
    {
86
        if (! $component->isCreate()) {
87
            throw new AuthorizationException();
88
        }
89
90
        $form = $component->fireCreate();
91
92
        return $form;
93
    }
94
95
    /**
96
     * @param \Sco\Admin\Contracts\ComponentInterface $component
97
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
98
     * @throws \Illuminate\Auth\Access\AuthorizationException
99
     */
100
    public function create(ComponentInterface $component)
101
    {
102
        if (! $component->isCreate()) {
103
            throw new AuthorizationException();
104
        }
105
106
        return view('admin::app');
107
    }
108
109
    /**
110
     * @param \Sco\Admin\Contracts\ComponentInterface $component
111
     * @param \Illuminate\Http\Request $request
112
     * @throws \Illuminate\Auth\Access\AuthorizationException
113
     */
114
    public function store(ComponentInterface $component, Request $request)
0 ignored issues
show
The parameter $request is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
115
    {
116
        if (! $component->isCreate()) {
117
            throw new AuthorizationException();
118
        }
119
120
        $component->store();
121
    }
122
123
    /**
124
     * @param \Sco\Admin\Contracts\ComponentInterface $component
125
     * @param $id
126
     * @return null|\Sco\Admin\Contracts\Form\FormInterface
127
     * @throws \Illuminate\Auth\Access\AuthorizationException
128
     */
129
    public function getEditInfo(ComponentInterface $component, $id)
130
    {
131
        if (! $component->isEdit()) {
132
            throw new AuthorizationException();
133
        }
134
135
        $form = $component->fireEdit($id);
136
137
        return $form;
138
    }
139
140
    /**
141
     * @param \Sco\Admin\Contracts\ComponentInterface $component
142
     * @param $id
143
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
144
     * @throws \Illuminate\Auth\Access\AuthorizationException
145
     */
146
    public function edit(ComponentInterface $component, $id)
0 ignored issues
show
The parameter $id is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
147
    {
148
        if (! $component->isEdit()) {
149
            throw new AuthorizationException();
150
        }
151
152
        return view('admin::app');
153
    }
154
155
    /**
156
     * @param \Sco\Admin\Contracts\ComponentInterface $component
157
     * @param \Illuminate\Http\Request $request
158
     * @param $id
159
     * @return \Illuminate\Http\JsonResponse
160
     * @throws \Illuminate\Auth\Access\AuthorizationException
161
     */
162
    public function update(ComponentInterface $component, Request $request, $id)
0 ignored issues
show
The parameter $request is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
163
    {
164
        if (! $component->isEdit()) {
165
            throw new AuthorizationException();
166
        }
167
168
        $component->update($id);
169
170
        return response()->json(['message' => 'ok']);
171
    }
172
173
    /**
174
     * @param \Sco\Admin\Contracts\ComponentInterface $component
175
     * @param $id
176
     * @return \Illuminate\Http\JsonResponse
177
     * @throws \Illuminate\Auth\Access\AuthorizationException
178
     */
179 View Code Duplication
    public function delete(ComponentInterface $component, $id)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
180
    {
181
        if (! $component->isDelete()) {
182
            throw new AuthorizationException();
183
        }
184
185
        $component->delete($id);
186
187
        return response()->json(['message' => 'ok']);
188
    }
189
190
    /**
191
     * @param \Sco\Admin\Contracts\ComponentInterface $component
192
     * @param $id
193
     * @return \Illuminate\Http\JsonResponse
194
     * @throws \Illuminate\Auth\Access\AuthorizationException
195
     */
196
    public function forceDelete(ComponentInterface $component, $id)
197
    {
198
        if (! $component->isDestroy()) {
199
            throw new AuthorizationException();
200
        }
201
202
        $component->forceDelete($id);
203
204
        return response()->json(['message' => 'ok']);
205
    }
206
207
    /**
208
     * @param \Sco\Admin\Contracts\ComponentInterface $component
209
     * @param $id
210
     * @return \Illuminate\Http\JsonResponse
211
     * @throws \Illuminate\Auth\Access\AuthorizationException
212
     */
213
    public function restore(ComponentInterface $component, $id)
214
    {
215
        if (! $component->isRestore()) {
216
            throw new AuthorizationException();
217
        }
218
        $component->restore($id);
219
220
        return response()->json(['message' => 'ok']);
221
    }
222
223
    /**
224
     * @param \Sco\Admin\Contracts\ComponentInterface $component
225
     * @return \Illuminate\Http\JsonResponse
226
     * @throws \Illuminate\Auth\Access\AuthorizationException
227
     */
228 View Code Duplication
    public function reorder(ComponentInterface $component)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
229
    {
230
        if (! $component->isEdit()) {
231
            throw new AuthorizationException();
232
        }
233
234
        //TODO
235
236
        return response()->json(['message' => 'ok']);
237
    }
238
}
239