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/JudgeServerController.php (12 issues)

1
<?php
2
3
namespace App\Admin\Controllers;
4
5
use App\Models\Eloquent\JudgeServer;
6
use App\Models\JudgerModel;
7
use App\Models\Eloquent\OJ;
8
use Encore\Admin\Controllers\AdminController;
9
use Encore\Admin\Controllers\HasResourceActions;
10
use Encore\Admin\Form;
11
use Encore\Admin\Grid;
12
use Encore\Admin\Layout\Content;
13
use Encore\Admin\Show;
14
use Illuminate\Database\Eloquent\Model;
15
16
class JudgeServerController extends AdminController
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.judgeservers.index.header'))
0 ignored issues
show
It seems like __('admin.judgeservers.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.judgeservers.index.header'))
Loading history...
30
            ->description(__('admin.judgeservers.index.description'))
0 ignored issues
show
It seems like __('admin.judgeservers.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.judgeservers.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.judgeservers.show.header'))
0 ignored issues
show
It seems like __('admin.judgeservers.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.judgeservers.show.header'))
Loading history...
45
            ->description(__('admin.judgeservers.show.description'))
0 ignored issues
show
It seems like __('admin.judgeservers.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.judgeservers.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.judgeservers.edit.header'))
0 ignored issues
show
It seems like __('admin.judgeservers.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.judgeservers.edit.header'))
Loading history...
60
            ->description(__('admin.judgeservers.edit.description'))
0 ignored issues
show
It seems like __('admin.judgeservers.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.judgeservers.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.judgeservers.create.header'))
0 ignored issues
show
It seems like __('admin.judgeservers.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.judgeservers.create.header'))
Loading history...
74
            ->description(__('admin.judgeservers.create.description'))
0 ignored issues
show
It seems like __('admin.judgeservers.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.judgeservers.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 JudgeServer());
86
87
        $grid->column('jsid', 'JSID');
88
        $grid->column('scode', __('admin.judgeservers.scode'));
0 ignored issues
show
It seems like __('admin.judgeservers.scode') 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

88
        $grid->column('scode', /** @scrutinizer ignore-type */ __('admin.judgeservers.scode'));
Loading history...
89
        $grid->column('name', __('admin.judgeservers.name'));
90
        $grid->column('host', __('admin.judgeservers.host'));
91
        $grid->column('port', __('admin.judgeservers.port'));
92
        $grid->column('token', __('admin.judgeservers.token'));
93
        $grid->column('available', __('admin.judgeservers.availability'))->display(function($available) {
94
            return $available ?__('admin.judgeservers.available') : __('admin.judgeservers.unavailable');
95
        });
96
        $grid->column('OJ', __('admin.judgeservers.oj'))->display(function() {
97
            return $this->oj->name;
0 ignored issues
show
Bug Best Practice introduced by
The property oj does not exist on App\Admin\Controllers\JudgeServerController. Did you maybe forget to declare it?
Loading history...
98
        });
99
        $grid->column('usage', __('admin.judgeservers.usage'))->display(function($usage) {
100
            return blank($usage) ? "-" : "$usage%";
101
        });
102
        $grid->column('status', __('admin.judgeservers.status'))->display(function($status) {
103
            $status=JudgerModel::$status[$status];
104
            return '<i class="MDI '.$status['icon'].' '.$status['color'].'"></i> '.$status['text'];
105
        });
106
        $grid->column('status_update_at', __('admin.judgeservers.status_update_at'));
107
        $grid->column('created_at', __('admin.created_at'));
108
        $grid->column('updated_at', __('admin.updated_at'));
109
110
        return $grid;
111
    }
112
113
    /**
114
     * Make a show builder.
115
     *
116
     * @param mixed $id
117
     * @return Show
118
     */
119
    protected function detail($id)
120
    {
121
        $show=new Show(JudgeServer::findOrFail($id));
122
123
        $show->field('jsid', 'JSID');
124
        $show->field('scode', __('admin.judgeservers.scode'));
0 ignored issues
show
It seems like __('admin.judgeservers.scode') 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

124
        $show->field('scode', /** @scrutinizer ignore-type */ __('admin.judgeservers.scode'));
Loading history...
125
        $show->field('name', __('admin.judgeservers.name'));
126
        $show->field('host', __('admin.judgeservers.host'));
127
        $show->field('port', __('admin.judgeservers.port'));
128
        $show->field('token', __('admin.judgeservers.token'));
129
        $show->field('available', __('admin.judgeservers.availability'))->as(function($available) {
130
            return $available ?__('admin.judgeservers.available') : __('admin.judgeservers.unavailable');
131
        });
132
        $show->field('oj.name', __('admin.judgeservers.oj'));
133
        $show->field('usage', __('admin.judgeservers.usage'))->as(function($usage) {
134
            return blank($usage) ? "-" : "$usage%";
135
        });
136
        $show->field('status', __('admin.judgeservers.status'))->unescape()->as(function($status) {
137
            $status=JudgerModel::$status[$status];
138
            return '<i class="MDI '.$status['icon'].' '.$status['color'].'"></i> '.$status['text'];
139
        });
140
        $show->field('status_update_at', __('admin.judgeservers.status_update_at'));
141
        $show->field('created_at', __('admin.created_at'));
142
        $show->field('updated_at', __('admin.updated_at'));
143
144
        return $show;
145
    }
146
147
    /**
148
     * Make a form builder.
149
     *
150
     * @return Form
151
     */
152
    protected function form()
153
    {
154
        $form=new Form(new JudgeServer());
155
156
        $form->text('scode', __('admin.judgeservers.scode'))->rules('required|alpha_dash|min:3|max:20');
157
        $form->text('name', __('admin.judgeservers.name'))->required();
158
        $form->text('host', __('admin.judgeservers.host'))->required();
159
        $form->text('port', __('admin.judgeservers.port'))->required();
160
        $form->text('token', __('admin.judgeservers.token'))->required();
161
        $form->switch('available', __('admin.judgeservers.availability'));
162
        $form->select('oid', __('admin.judgeservers.oj'))->options(OJ::all()->pluck('name', 'oid'))->help(__('admin.judgeservers.help.onlinejudge'))->required();
0 ignored issues
show
It seems like __('admin.judgeservers.help.onlinejudge') can also be of type array and array; however, parameter $text of Encore\Admin\Form\Field::help() 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

162
        $form->select('oid', __('admin.judgeservers.oj'))->options(OJ::all()->pluck('name', 'oid'))->help(/** @scrutinizer ignore-type */ __('admin.judgeservers.help.onlinejudge'))->required();
Loading history...
163
        $form->hidden('status', __('admin.judgeservers.status'))->default(0);
164
        return $form;
165
    }
166
}
167