Issues (174)

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.

debug/views/user/detail.php (36 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
/* @var $panel yii\debug\panels\UserPanel */
4
5
use rhosocial\user\User;
6
use rhosocial\user\Profile;
7
use rhosocial\user\security\PasswordHistory;
8
use rhosocial\user\rbac\Item;
9
use yii\data\ArrayDataProvider;
10
use yii\grid\GridView;
11
use yii\widgets\DetailView;
12
use yii\widgets\Pjax;
13
14
?>
15
16
<h1>User Info</h1>
17
18
<?php if (!Yii::$app->user->isGuest) {
19
    $identity = $panel->data['identity'];
20
    /* @var $identity User */
21
    echo DetailView::widget([
22
        'model' => $panel->data['identity'],
23
        'attributes' => [
24
            'GUID' => 'readableGUID',
25
            'ID' => $identity->idAttribute,
26
            'Password Hash' => $identity->passwordHashAttribute,
27
            'IP' => [
28
                'attribute' => 'ipAddress',
29
                'label' => Yii::t('user', 'IP Address'),
30
            ],
31
            'IP Type' => $identity->ipTypeAttribute,
32
            'Created At' => [
33
                'attribute' => $identity->createdAtAttribute,
34
                'label' => Yii::t('user', 'Creation Time'),
35
                'value' => function($model, $widget) {
0 ignored issues
show
The parameter $widget 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...
36
                    $value = Yii::$app->formatter->asDatetime($model->getCreatedAt());
37
                    $defaultTimeZone = Yii::$app->formatter->defaultTimeZone;
38
                    Yii::$app->formatter->defaultTimeZone = date_default_timezone_get();
39
                    $value .= ' (UTC: ' . Yii::$app->formatter->asDatetime($model->getCreatedAt()) . ' | Origial: ' . $model->getCreatedAt() . ')';
40
                    Yii::$app->formatter->defaultTimeZone = $defaultTimeZone;
41
                    return $value;
42
                },
43
            ],
44
            'Updated At' => [
45
                'attribute' => $identity->createdAtAttribute,
46
                'label' => Yii::t('user', 'Last Updated Time'),
47
                'value' => function($model, $widget) {
0 ignored issues
show
The parameter $widget 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...
48
                    $value = Yii::$app->formatter->asDatetime($model->getUpdatedAt());
49
                    $defaultTimeZone = Yii::$app->formatter->defaultTimeZone;
50
                    Yii::$app->formatter->defaultTimeZone = date_default_timezone_get();
51
                    $value .= ' (UTC: ' . Yii::$app->formatter->asDatetime($model->getUpdatedAt()) . ' | Origial: ' . $model->getUpdatedAt() . ')';
52
                    Yii::$app->formatter->defaultTimeZone = $defaultTimeZone;
53
                    return $value;
54
                },
55
            ],
56
            'Authentication Key' => $identity->authKeyAttribute,
57
            'Access Token' => $identity->accessTokenAttribute,
58
            'Password Reset Token' => $identity->passwordResetTokenAttribute,
59
            'Status' => $identity->statusAttribute,
60
            'Type' => 'type',
61
            'Source' => $identity->sourceAttribute,
62
        ],
63
    ]);
64
65
    if (class_exists($identity->profileClass) && ($profile = $identity->profile)) {
66
        echo '<h2>Profile</h2>';
67
        /* @var $profile Profile */
68
        echo DetailView::widget([
69
            'model' => $profile,
70
            'attributes' => [
71
                'nickname' => $profile->contentAttribute,
72
                'first_name' => 'first_name',
73
                'last_name' => 'last_name',
74
                'gender' => [
75
                    'attribute' => 'gender',
76
                    'label' => Yii::t('user', 'Gender'),
77
                    'value' => function ($model, $widget) {
0 ignored issues
show
The parameter $widget 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...
78
                        /* @var $model Profile */
79
                        /* @var $widget DetailView */
80
                        return $model->getGenderDesc($model->gender);
81
                    },
82
                ],
83
                'gravatar_type' => 'gravatar_type',
84
                'gravatar' => 'gravatar',
85
                'timezone' => 'timezone',
86
                'individual_sign' => 'individual_sign',
87
                'created_at' => [
88
                    'attribute' => $profile->createdAtAttribute,
89
                    'format' => 'datetime',
90
                ],
91
                'updated_at' => [
92
                    'attribute' => $profile->updatedAtAttribute,
93
                    'format' => 'datetime',
94
                 ],
95
            ],
96
        ]);
97
    }
98
99
    $history = $identity->passwordHistories;
100
    if (!empty($history)) {
101
        /* @var $history PasswordHistory[] */
102
        echo '<h2>Password History</h2>';
103
104
        $historyProvider = new ArrayDataProvider([
105
            'allModels' => $history,
106
        ]);
107
        $historyProvider->pagination->pageSize = 20;
108
        $historyProvider->pagination->pageParam = 'password-history-page';
109
        $historyProvider->sort->sortParam = 'password-history-sort';
110
        Pjax::begin([
111
            'id' => 'password-history-pjax',
112
        ]);
113
        echo GridView::widget([
114
            'dataProvider' => $historyProvider,
115
            'columns' => [
116
                'guid' => [
117
                    'class' => 'yii\grid\DataColumn',
118
                    'header' => 'Readable GUID',
119
                    'content' => function ($model, $key, $index, $column) {
0 ignored issues
show
The parameter $key 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...
The parameter $index 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...
The parameter $column 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...
120
                        return $model->getReadableGUID();
121
                    }
122
                ],
123
                'pass_hash',
124
                'createdAt:datetime',
125
            ],
126
        ]);
127
        Pjax::end();
128
    }
129
130
    if ($panel->data['rolesProvider']) {
131
        echo '<h2>Roles</h2>';
132
        Pjax::begin([
133
            'id' => 'role-pjax',
134
        ]);
135
        echo GridView::widget([
136
            'dataProvider' => $panel->data['rolesProvider'],
137
            'columns' => [
138
                'color' => [
139
                    'class' => 'yii\grid\Column',
140
                    'header' => 'Color',
141
                    'content' => function ($model, $key, $index, $column) {
0 ignored issues
show
The parameter $key 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...
The parameter $index 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...
The parameter $column 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...
142
                        /* @var $model Item */
143
                        if (!is_numeric($model->color)) {
144
                            return null;
145
                        }
146
                        $model->color = (int)($model->color);
147
                        if ($model->color < 0 || $model->color > 0xffffff) {
148
                            return null;
149
                        }
150
                        return "<font color=\"#fff\">" . dechex($model->color) . "</font>";
151
                    },
152
                    'contentOptions' => function ($model, $key, $index, $column) {
0 ignored issues
show
The parameter $key 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...
The parameter $index 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...
The parameter $column 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...
153
                        /* @var $model Item */
154
                        if (!is_numeric($model->color)) {
155
                            return [];
156
                        }
157
                        $model->color = (int)($model->color);
158
                        if ($model->color < 0 || $model->color > 0xffffff) {
159
                            return [];
160
                        }
161
                        return ['bgcolor' => '#' . dechex($model->color)];
162
                    },
163
                ],
164
                'name',
165
                'description',
166
                'ruleName',
167
                'data',
168
                'createdAt:datetime',
169
                'updatedAt:datetime'
170
            ]
171
        ]);
172
        Pjax::end();
173
    }
174
175
    if ($panel->data['permissionsProvider']) {
176
        echo '<h2>Permissions</h2>';
177
        Pjax::begin([
178
            'id' => 'permission-pjax',
179
        ]);
180
        echo GridView::widget([
181
            'dataProvider' => $panel->data['permissionsProvider'],
182
            'columns' => [
183
                'color' => [
184
                    'class' => 'yii\grid\Column',
185
                    'header' => 'Color',
186
                    'content' => function ($model, $key, $index, $column) {
0 ignored issues
show
The parameter $key 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...
The parameter $index 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...
The parameter $column 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...
187
                        /* @var $model Item */
188
                        if (!is_numeric($model->color)) {
189
                            return null;
190
                        }
191
                        $model->color = (int)($model->color);
192
                        if ($model->color < 0 || $model->color > 0xffffff) {
193
                            return null;
194
                        }
195
                        return "<font color=\"#fff\">" . dechex($model->color) . "</font>";
196
                    },
197
                    'contentOptions' => function ($model, $key, $index, $column) {
0 ignored issues
show
The parameter $key 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...
The parameter $index 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...
The parameter $column 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...
198
                        /* @var $model Item */
199
                        if (!is_numeric($model->color)) {
200
                            return [];
201
                        }
202
                        $model->color = (int)($model->color);
203
                        if ($model->color < 0 || $model->color > 0xffffff) {
204
                            return [];
205
                        }
206
                        return ['bgcolor' => '#' . dechex($model->color)];
207
                    },
208
                ],
209
                'name',
210
                'description',
211
                'ruleName',
212
                'data',
213
                'createdAt:datetime',
214
                'updatedAt:datetime'
215
            ]
216
        ]);
217
        Pjax::end();
218
    }
219
220
    if ($panel->data['loginLogProvider']) {
221
        echo '<h2>Login Logs</h2>';
222
        if (is_string($panel->data['loginLogProvider'])) {
223
            echo $panel->data['loginLogProvider'];
224
        } else {
225
            Pjax::begin([
226
                'id' => 'login-log-pjax',
227
            ]);
228
            echo GridView::widget([
229
                'dataProvider' => $panel->data['loginLogProvider'],
230
                'columns' => [
231
                    'guid' => [
232
                        'class' => 'yii\grid\Column',
233
                        'header' => 'GUID',
234
                        'content' => function ($model, $key, $index, $column) {
0 ignored issues
show
The parameter $key 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...
The parameter $index 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...
The parameter $column 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...
235
                            return $model->getReadableGUID();
236
                        },
237
                    ],
238
                    'id' => [
239
                        'class' => 'yii\grid\Column',
240
                        'header' => 'ID',
241
                        'content' => function ($model, $key, $index, $column) {
0 ignored issues
show
The parameter $key 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...
The parameter $index 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...
The parameter $column 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...
242
                            return $model->getID();
243
                        },
244
                    ],
245
                    'ip' => [
246
                        'class' => 'yii\grid\Column',
247
                        'header' => 'IP Address',
248
                        'content' => function ($model, $key, $index, $column) {
0 ignored issues
show
The parameter $key 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...
The parameter $index 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...
The parameter $column 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...
249
                            return $model->getIPAddress();
250
                        },
251
                    ],
252
                    'time' => [
253
                        'header' => 'Time',
254
                        'value' => function ($model, $key, $index, $column) {
0 ignored issues
show
The parameter $key 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...
The parameter $index 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...
The parameter $column 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...
255
                            return $model->getCreatedAt();
256
                        },
257
                        'format' => 'datetime',
258
                    ],
259
                    'device' => [
260
                        'class' => 'yii\grid\Column',
261
                        'header' => 'Device',
262
                        'content' => function ($model, $key, $index, $column) {
0 ignored issues
show
The parameter $key 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...
The parameter $index 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...
The parameter $column 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...
263
                            return $model->getDeviceDesc();
264
                        },
265
                    ],
266
                    'status' => [
267
                        'class' => 'yii\grid\Column',
268
                        'header' => 'Status',
269
                        'content' => function ($model, $key, $index, $column) {
0 ignored issues
show
The parameter $key 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...
The parameter $index 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...
The parameter $column 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...
270
                            $content = $model->getStatusDesc();
271
                            if ($model->status > 0) {
272
                                $content = "<font color=\"#f00\">" . $content . "</font>";
273
                            }
274
                            return $content;
275
                        },
276
                    ],
277
                ],
278
            ]);
279
            Pjax::end();
280
        }
281
    }
282
}
283