Issues (563)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  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.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  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.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  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.
  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.
  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.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
  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.
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  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.
  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.
  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.
  Header Injection
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.

app/Admin/Controllers/DojoPassesController.php (14 issues)

1
<?php
2
3
namespace App\Admin\Controllers;
4
5
use App\Models\Eloquent\Dojo\DojoPass;
6
use App\Models\Eloquent\Dojo\Dojo;
7
use App\Models\Eloquent\User;
8
use App\Http\Controllers\Controller;
9
use Illuminate\Support\MessageBag;
10
use Encore\Admin\Controllers\HasResourceActions;
11
use Encore\Admin\Form;
12
use Encore\Admin\Grid;
13
use Encore\Admin\Layout\Content;
14
use Encore\Admin\Show;
15
16
class DojoPassesController extends Controller
17
{
18
    use HasResourceActions;
19
20
    /**
21
     * Index interface.
22
     *
23
     * @param Content $content
24
     * @return Content
25
     */
26
    public function index(Content $content)
27
    {
28
        return $content
29
            ->header(__('admin.dojopasses.index.header'))
0 ignored issues
show
It seems like __('admin.dojopasses.index.header') can also be of type array and array; however, parameter $header of Encore\Admin\Layout\Content::header() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

29
            ->header(/** @scrutinizer ignore-type */ __('admin.dojopasses.index.header'))
Loading history...
30
            ->description(__('admin.dojopasses.index.description'))
0 ignored issues
show
It seems like __('admin.dojopasses.index.description') can also be of type array and array; however, parameter $description of Encore\Admin\Layout\Content::description() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

30
            ->description(/** @scrutinizer ignore-type */ __('admin.dojopasses.index.description'))
Loading history...
31
            ->body($this->grid()->render());
32
    }
33
34
    /**
35
     * Show interface.
36
     *
37
     * @param mixed $id
38
     * @param Content $content
39
     * @return Content
40
     */
41
    public function show($id, Content $content)
42
    {
43
        return $content
44
            ->header(__('admin.dojopasses.show.header'))
0 ignored issues
show
It seems like __('admin.dojopasses.show.header') can also be of type array and array; however, parameter $header of Encore\Admin\Layout\Content::header() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

44
            ->header(/** @scrutinizer ignore-type */ __('admin.dojopasses.show.header'))
Loading history...
45
            ->description(__('admin.dojopasses.show.description'))
0 ignored issues
show
It seems like __('admin.dojopasses.show.description') can also be of type array and array; however, parameter $description of Encore\Admin\Layout\Content::description() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

45
            ->description(/** @scrutinizer ignore-type */ __('admin.dojopasses.show.description'))
Loading history...
46
            ->body($this->detail($id));
47
    }
48
49
    /**
50
     * Edit interface.
51
     *
52
     * @param mixed $id
53
     * @param Content $content
54
     * @return Content
55
     */
56
    public function edit($id, Content $content)
57
    {
58
        return $content
59
            ->header(__('admin.dojopasses.edit.header'))
0 ignored issues
show
It seems like __('admin.dojopasses.edit.header') can also be of type array and array; however, parameter $header of Encore\Admin\Layout\Content::header() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

59
            ->header(/** @scrutinizer ignore-type */ __('admin.dojopasses.edit.header'))
Loading history...
60
            ->description(__('admin.dojopasses.edit.description'))
0 ignored issues
show
It seems like __('admin.dojopasses.edit.description') can also be of type array and array; however, parameter $description of Encore\Admin\Layout\Content::description() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

60
            ->description(/** @scrutinizer ignore-type */ __('admin.dojopasses.edit.description'))
Loading history...
61
            ->body($this->form()->edit($id));
62
    }
63
64
    /**
65
     * Create interface.
66
     *
67
     * @param Content $content
68
     * @return Content
69
     */
70
    public function create(Content $content)
71
    {
72
        return $content
73
            ->header(__('admin.dojopasses.create.header'))
0 ignored issues
show
It seems like __('admin.dojopasses.create.header') can also be of type array and array; however, parameter $header of Encore\Admin\Layout\Content::header() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

73
            ->header(/** @scrutinizer ignore-type */ __('admin.dojopasses.create.header'))
Loading history...
74
            ->description(__('admin.dojopasses.create.description'))
0 ignored issues
show
It seems like __('admin.dojopasses.create.description') can also be of type array and array; however, parameter $description of Encore\Admin\Layout\Content::description() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

74
            ->description(/** @scrutinizer ignore-type */ __('admin.dojopasses.create.description'))
Loading history...
75
            ->body($this->form());
76
    }
77
78
    /**
79
     * Make a grid builder.
80
     *
81
     * @return Grid
82
     */
83
    protected function grid()
84
    {
85
        $grid=new Grid(new DojoPass);
86
        $grid->column('id', "ID")->sortable();
87
        $grid->column("dojo_name", __('admin.dojopasses.dojo'))->display(function() {
0 ignored issues
show
It seems like __('admin.dojopasses.dojo') can also be of type array and array; however, parameter $label of Encore\Admin\Grid::column() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

87
        $grid->column("dojo_name", /** @scrutinizer ignore-type */ __('admin.dojopasses.dojo'))->display(function() {
Loading history...
88
            return $this->dojo->name;
0 ignored issues
show
Bug Best Practice introduced by
The property dojo does not exist on App\Admin\Controllers\DojoPassesController. Did you maybe forget to declare it?
Loading history...
89
        });
90
        $grid->column("user_readable", __('admin.dojopasses.user'))->display(function() {
91
            return $this->user->readable_name;
0 ignored issues
show
Bug Best Practice introduced by
The property user does not exist on App\Admin\Controllers\DojoPassesController. Did you maybe forget to declare it?
Loading history...
92
        });
93
        $grid->column('updated_at', __('admin.dojopasses.updated_at'));
94
95
        $grid->filter(function(Grid\Filter $filter) {
96
            $filter->disableIdFilter();
97
            $filter->column(6, function($filter) {
98
                $filter->equal('dojo_id', __('admin.dojopasses.dojo'))->select(Dojo::all()->pluck('name', 'id'));
99
            });
100
            $filter->column(6, function($filter) {
101
                $filter->equal('user_id', __('admin.dojopasses.user'))->select(function($id) {
102
                    $user=User::find($id);
103
                    if ($user) {
104
                        return [$user->id => $user->readable_name];
105
                    }
106
                })->config('minimumInputLength', 4)->ajax(route('admin.api.users'));
107
            });
108
        });
109
        return $grid;
110
    }
111
112
    /**
113
     * Make a show builder.
114
     *
115
     * @param mixed $id
116
     * @return Show
117
     */
118
    protected function detail($id)
119
    {
120
        $show=new Show(DojoPass::findOrFail($id));
121
        $show->field('id', "ID");
122
        $show->field("dojo_name", __('admin.dojopasses.dojo'))->as(function() {
0 ignored issues
show
It seems like __('admin.dojopasses.dojo') can also be of type array and array; however, parameter $label of Encore\Admin\Show::field() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

122
        $show->field("dojo_name", /** @scrutinizer ignore-type */ __('admin.dojopasses.dojo'))->as(function() {
Loading history...
123
            return $this->dojo->name;
0 ignored issues
show
Bug Best Practice introduced by
The property dojo does not exist on App\Admin\Controllers\DojoPassesController. Did you maybe forget to declare it?
Loading history...
124
        });
125
        $show->field("user_readable", __('admin.dojopasses.user'))->as(function() {
126
            return $this->user->readable_name;
0 ignored issues
show
Bug Best Practice introduced by
The property user does not exist on App\Admin\Controllers\DojoPassesController. Did you maybe forget to declare it?
Loading history...
127
        });
128
        $show->field('updated_at', __('admin.dojopasses.updated_at'));
129
        return $show;
130
    }
131
132
    /**
133
     * Make a form builder.
134
     *
135
     * @return Form
136
     */
137
    protected function form()
138
    {
139
        $form=new Form(new DojoPass);
140
        $form->tab('Basic', function(Form $form) {
141
            $form->display('id', 'ID');
142
            $form->select('dojo_id', __('admin.dojopasses.dojo'))->options(Dojo::all()->pluck('name', 'id'))->rules('required');
143
            $form->select('user_id', __('admin.dojopasses.user'))->options(function($id) {
144
                $user=User::find($id);
145
                if ($user) {
146
                    return [$user->id => $user->readable_name];
147
                }
148
            })->config('minimumInputLength', 4)->ajax(route('admin.api.users'))->rules('required');
149
150
            $form->saving(function(Form $form) {
151
                $err=function($msg, $title='Error occur.') {
152
                    $error=new MessageBag([
153
                        'title'   => $title,
154
                        'message' => $msg,
155
                    ]);
156
                    return back()->with(compact('error'));
157
                };
158
                $user_id=$form->user_id;
159
                $dojo_id=$form->dojo_id;
160
                $pass=DojoPass::where([
161
                    "dojo_id" => $dojo_id,
162
                    "user_id" => $user_id,
163
                ])->first();
164
165
                $pass_id=$form->model()->id ?? null;
166
                if (!blank($pass) && $pass->id!=$pass_id) {
167
                    return $err('User has passed this dojo', 'Error occured.');
168
                }
169
            });
170
        });
171
        return $form;
172
    }
173
}
174