Issues (68)

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.

app/src/Schema/RightSchema.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
namespace App\Schema;
3
4
use \Carbon\Carbon;
5
6
/**
7
 * @api {get} /right Список прав
8
 * @apiName GetRights
9
 * @apiGroup Right
10
 *
11
 * @apiDescription Метод для получения списка прав.
12
 *
13
 * @apiPermission user
14
 *
15
 * @apiHeader {String} Authorization Bearer TOKEN
16
 *
17
 * @apiSuccessExample {json} Успешно (200)
18
 *     HTTP/1.1 200 OK
19
 *     {
20
 *       "data": [
21
 *         {
22
 *           "type": "right",
23
 *           "id": "1",
24
 *           "attributes": {
25
 *             "name": "manageUsers",
26
 *             "description": "Управление пользователями",
27
 *             "created_at": "2016-10-17T07:38:21+0000",
28
 *             "updated_at": "2016-10-17T07:38:21+0000",
29
 *             "created_by": 0,
30
 *             "updated_by": null
31
 *           },
32
 *           "links": {
33
 *             "self": "http://bootstrapi.dev/api/right/1"
34
 *           }
35
 *         }
36
 *       ]
37
 *     }
38
 *
39
 * @apiUse StandardErrors
40
 * @apiUse UnauthorizedError
41
 */
42
43
/**
44
 * @api {get} /right/:id Получить право
45
 * @apiName GetRight
46
 * @apiGroup Right
47
 *
48
 * @apiDescription Метод для получения права.
49
 *
50
 * @apiPermission user
51
 *
52
 * @apiParam {Number} id Id права
53
 *
54
 * @apiHeader {String} Authorization Bearer TOKEN
55
 *
56
 * @apiSuccessExample {json} Успешно (200)
57
 *     HTTP/1.1 200 OK
58
 *     {
59
 *       "data": {
60
 *         "type": "right",
61
 *         "id": "1",
62
 *         "attributes": {
63
 *           "name": "manageUsers",
64
 *           "description": "Управление пользователями",
65
 *           "created_at": "2016-10-17T07:38:21+0000",
66
 *           "updated_at": "2016-10-17T07:38:21+0000",
67
 *           "created_by": 0,
68
 *           "updated_by": null
69
 *         },
70
 *         "links": {
71
 *           "self": "http://bootstrapi.dev/api/right/1"
72
 *         }
73
 *       }
74
 *     }
75
 *
76
 * @apiUse StandardErrors
77
 * @apiUse UnauthorizedError
78
 * @apiUse NotFoundError
79
 */
80
81
/**
82
 * @api {post} /right Создание права
83
 * @apiName CreateRight
84
 * @apiGroup Right
85
 *
86
 * @apiDescription Метод для создания нового права.
87
 *
88
 * @apiPermission admin
89
 *
90
 * @apiParam {String} name Имя права (уникальный)
91
 * @apiParam {String} description Человекопонятное описание
92
 *
93
 * @apiParamExample {json} Пример запроса:
94
 *    {
95
 *      "data": {
96
 *        "attributes": {
97
 *          "name": "manageUsers",
98
 *          "description": "Управление пользователями"
99
 *        }
100
 *      }
101
 *    }
102
 *
103
 * @apiHeader {String} Authorization Bearer TOKEN
104
 *
105
 * @apiSuccessExample {json} Успешно (200)
106
 *     HTTP/1.1 200 OK
107
 *     {
108
 *       "data": {
109
 *         "type": "right",
110
 *         "id": "1",
111
 *         "attributes": {
112
 *           "name": "manageUsers",
113
 *           "description": "Управление пользователями",
114
 *           "created_at": "2016-10-17T07:38:21+0000",
115
 *           "updated_at": "2016-10-17T07:38:21+0000",
116
 *           "created_by": 1,
117
 *           "updated_by": null
118
 *         },
119
 *         "links": {
120
 *           "self": "http://bootstrapi.dev/api/right/1"
121
 *         }
122
 *       }
123
 *     }
124
 *
125
 * @apiUse StandardErrors
126
 * @apiUse UnauthorizedError
127
 */
128
129
/**
130
 * @api {patch} /right/:id Изменение права
131
 * @apiName UpdateRight
132
 * @apiGroup Right
133
 *
134
 * @apiDescription Метод для изменения права.
135
 *
136
 * @apiPermission admin
137
 *
138
 * @apiParam {String} name Имя права (уникальный)
139
 * @apiParam {String} description Человекопонятное описание
140
 *
141
 * @apiParamExample {json} Пример запроса:
142
 *    {
143
 *      "data": {
144
 *        "attributes": {
145
 *          "name": "manageUsers",
146
 *          "description": "Управление пользователями"
147
 *        }
148
 *      }
149
 *    }
150
 *
151
 * @apiHeader {String} Authorization Bearer TOKEN
152
 *
153
 * @apiSuccessExample {json} Успешно (200)
154
 *     HTTP/1.1 200 OK
155
 *     {
156
 *       "data": {
157
 *         "type": "right",
158
 *         "id": "1",
159
 *         "attributes": {
160
 *           "name": "manageUsers",
161
 *           "description": "Управление пользователями",
162
 *           "created_at": "2016-10-17T07:38:21+0000",
163
 *           "updated_at": "2016-10-17T07:38:21+0000",
164
 *           "created_by": 1,
165
 *           "updated_by": 1
166
 *         },
167
 *         "links": {
168
 *           "self": "http://bootstrapi.dev/api/right/1"
169
 *         }
170
 *       }
171
 *     }
172
 *
173
 * @apiUse StandardErrors
174
 * @apiUse UnauthorizedError
175
 * @apiUse NotFoundError
176
 */
177
178
/**
179
 * @api {delete} /right/:id Удаление права
180
 * @apiName DeleteRight
181
 * @apiGroup Right
182
 *
183
 * @apiDescription Метод для удаления права.
184
 *
185
 * @apiPermission admin
186
 *
187
 * @apiParam {Number} id Id права
188
 *
189
 * @apiHeader {String} Authorization Bearer TOKEN
190
 *
191
 * @apiSuccessExample {json} Успешно (204)
192
 *     HTTP/1.1 204 OK
193
 *
194
 * @apiUse UnauthorizedError
195
 * @apiUse StandardErrors
196
 * @apiUse NotFoundError
197
 */
198
199 View Code Duplication
final class RightSchema extends BaseSchema
0 ignored issues
show
This class 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...
200
{
201
    protected $resourceType = 'right';
202
203
    public function getId($right)
204
    {
205
        return $right->id;
206
    }
207
208
    public function getAttributes($right)
209
    {
210
        return [
211
            'name'        => $right->name,
212
            'description' => $right->description,
213
            'created_at'  => Carbon::parse($right->created_at)->setTimezone('UTC')->format(Carbon::ISO8601),
214
            'updated_at'  => Carbon::parse($right->updated_at)->setTimezone('UTC')->format(Carbon::ISO8601),
215
            'created_by'  => $right->created_by,
216
            'updated_by'  => $right->updated_by,
217
        ];
218
    }
219
}
220