Skip to content

Commit 70d881c

Browse files
authored
Merge pull request from GHSA-7528-7jg5-6g62
Hotfix 4.1.8
2 parents 99e0797 + 2dd3968 commit 70d881c

File tree

10 files changed

+154
-79
lines changed

10 files changed

+154
-79
lines changed

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## [v4.1.8](https://github.com/codeigniter4/CodeIgniter4/tree/v4.1.8) (2022-01-24)
4+
5+
[Full Changelog](https://github.com/codeigniter4/CodeIgniter4/compare/v4.1.7...v4.1.8)
6+
7+
**SECURITY**
8+
9+
* *XSS Vulnerability* in the `API\ResponseTrait` was fixed. See the [Security advisory](https://github.com/codeigniter4/CodeIgniter4/security/advisories/GHSA-7528-7jg5-6g62) for more information.
10+
311
## [v4.1.7](https://github.com/codeigniter4/CodeIgniter4/tree/v4.1.7) (2022-01-09)
412

513
[Full Changelog](https://github.com/codeigniter4/CodeIgniter4/compare/v4.1.6...v4.1.7)

admin/framework/composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"ext-intl": "*",
1111
"ext-json": "*",
1212
"ext-mbstring": "*",
13-
"kint-php/kint": "^3.3",
13+
"kint-php/kint": "^4.0",
1414
"laminas/laminas-escaper": "^2.9",
1515
"psr/log": "^1.1"
1616
},

system/API/ResponseTrait.php

+30-30
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ trait ResponseTrait
8585
*
8686
* @param array|string|null $data
8787
*
88-
* @return mixed
88+
* @return Response
8989
*/
90-
public function respond($data = null, ?int $status = null, string $message = '')
90+
protected function respond($data = null, ?int $status = null, string $message = '')
9191
{
9292
if ($data === null && $status === null) {
9393
$status = 404;
@@ -119,9 +119,9 @@ public function respond($data = null, ?int $status = null, string $message = '')
119119
* @param int $status HTTP status code
120120
* @param string|null $code Custom, API-specific, error code
121121
*
122-
* @return mixed
122+
* @return Response
123123
*/
124-
public function fail($messages, int $status = 400, ?string $code = null, string $customMessage = '')
124+
protected function fail($messages, int $status = 400, ?string $code = null, string $customMessage = '')
125125
{
126126
if (! is_array($messages)) {
127127
$messages = ['error' => $messages];
@@ -145,9 +145,9 @@ public function fail($messages, int $status = 400, ?string $code = null, string
145145
*
146146
* @param mixed $data
147147
*
148-
* @return mixed
148+
* @return Response
149149
*/
150-
public function respondCreated($data = null, string $message = '')
150+
protected function respondCreated($data = null, string $message = '')
151151
{
152152
return $this->respond($data, $this->codes['created'], $message);
153153
}
@@ -157,9 +157,9 @@ public function respondCreated($data = null, string $message = '')
157157
*
158158
* @param mixed $data
159159
*
160-
* @return mixed
160+
* @return Response
161161
*/
162-
public function respondDeleted($data = null, string $message = '')
162+
protected function respondDeleted($data = null, string $message = '')
163163
{
164164
return $this->respond($data, $this->codes['deleted'], $message);
165165
}
@@ -169,9 +169,9 @@ public function respondDeleted($data = null, string $message = '')
169169
*
170170
* @param mixed $data
171171
*
172-
* @return mixed
172+
* @return Response
173173
*/
174-
public function respondUpdated($data = null, string $message = '')
174+
protected function respondUpdated($data = null, string $message = '')
175175
{
176176
return $this->respond($data, $this->codes['updated'], $message);
177177
}
@@ -180,9 +180,9 @@ public function respondUpdated($data = null, string $message = '')
180180
* Used after a command has been successfully executed but there is no
181181
* meaningful reply to send back to the client.
182182
*
183-
* @return mixed
183+
* @return Response
184184
*/
185-
public function respondNoContent(string $message = 'No Content')
185+
protected function respondNoContent(string $message = 'No Content')
186186
{
187187
return $this->respond(null, $this->codes['no_content'], $message);
188188
}
@@ -192,9 +192,9 @@ public function respondNoContent(string $message = 'No Content')
192192
* or had bad authorization credentials. User is encouraged to try again
193193
* with the proper information.
194194
*
195-
* @return mixed
195+
* @return Response
196196
*/
197-
public function failUnauthorized(string $description = 'Unauthorized', ?string $code = null, string $message = '')
197+
protected function failUnauthorized(string $description = 'Unauthorized', ?string $code = null, string $message = '')
198198
{
199199
return $this->fail($description, $this->codes['unauthorized'], $code, $message);
200200
}
@@ -203,31 +203,31 @@ public function failUnauthorized(string $description = 'Unauthorized', ?string $
203203
* Used when access is always denied to this resource and no amount
204204
* of trying again will help.
205205
*
206-
* @return mixed
206+
* @return Response
207207
*/
208-
public function failForbidden(string $description = 'Forbidden', ?string $code = null, string $message = '')
208+
protected function failForbidden(string $description = 'Forbidden', ?string $code = null, string $message = '')
209209
{
210210
return $this->fail($description, $this->codes['forbidden'], $code, $message);
211211
}
212212

213213
/**
214214
* Used when a specified resource cannot be found.
215215
*
216-
* @return mixed
216+
* @return Response
217217
*/
218-
public function failNotFound(string $description = 'Not Found', ?string $code = null, string $message = '')
218+
protected function failNotFound(string $description = 'Not Found', ?string $code = null, string $message = '')
219219
{
220220
return $this->fail($description, $this->codes['resource_not_found'], $code, $message);
221221
}
222222

223223
/**
224224
* Used when the data provided by the client cannot be validated.
225225
*
226-
* @return mixed
226+
* @return Response
227227
*
228228
* @deprecated Use failValidationErrors instead
229229
*/
230-
public function failValidationError(string $description = 'Bad Request', ?string $code = null, string $message = '')
230+
protected function failValidationError(string $description = 'Bad Request', ?string $code = null, string $message = '')
231231
{
232232
return $this->fail($description, $this->codes['invalid_data'], $code, $message);
233233
}
@@ -237,19 +237,19 @@ public function failValidationError(string $description = 'Bad Request', ?string
237237
*
238238
* @param string|string[] $errors
239239
*
240-
* @return mixed
240+
* @return Response
241241
*/
242-
public function failValidationErrors($errors, ?string $code = null, string $message = '')
242+
protected function failValidationErrors($errors, ?string $code = null, string $message = '')
243243
{
244244
return $this->fail($errors, $this->codes['invalid_data'], $code, $message);
245245
}
246246

247247
/**
248248
* Use when trying to create a new resource and it already exists.
249249
*
250-
* @return mixed
250+
* @return Response
251251
*/
252-
public function failResourceExists(string $description = 'Conflict', ?string $code = null, string $message = '')
252+
protected function failResourceExists(string $description = 'Conflict', ?string $code = null, string $message = '')
253253
{
254254
return $this->fail($description, $this->codes['resource_exists'], $code, $message);
255255
}
@@ -259,19 +259,19 @@ public function failResourceExists(string $description = 'Conflict', ?string $co
259259
* Not Found, because here we know the data previously existed, but is now gone,
260260
* where Not Found means we simply cannot find any information about it.
261261
*
262-
* @return mixed
262+
* @return Response
263263
*/
264-
public function failResourceGone(string $description = 'Gone', ?string $code = null, string $message = '')
264+
protected function failResourceGone(string $description = 'Gone', ?string $code = null, string $message = '')
265265
{
266266
return $this->fail($description, $this->codes['resource_gone'], $code, $message);
267267
}
268268

269269
/**
270270
* Used when the user has made too many requests for the resource recently.
271271
*
272-
* @return mixed
272+
* @return Response
273273
*/
274-
public function failTooManyRequests(string $description = 'Too Many Requests', ?string $code = null, string $message = '')
274+
protected function failTooManyRequests(string $description = 'Too Many Requests', ?string $code = null, string $message = '')
275275
{
276276
return $this->fail($description, $this->codes['too_many_requests'], $code, $message);
277277
}
@@ -285,7 +285,7 @@ public function failTooManyRequests(string $description = 'Too Many Requests', ?
285285
*
286286
* @return Response The value of the Response's send() method.
287287
*/
288-
public function failServerError(string $description = 'Internal Server Error', ?string $code = null, string $message = ''): Response
288+
protected function failServerError(string $description = 'Internal Server Error', ?string $code = null, string $message = ''): Response
289289
{
290290
return $this->fail($description, $this->codes['server_error'], $code, $message);
291291
}
@@ -346,7 +346,7 @@ protected function format($data = null)
346346
*
347347
* @return $this
348348
*/
349-
public function setResponseFormat(?string $format = null)
349+
protected function setResponseFormat(?string $format = null)
350350
{
351351
$this->format = strtolower($format);
352352

system/CodeIgniter.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class CodeIgniter
4545
/**
4646
* The current version of CodeIgniter Framework
4747
*/
48-
public const CI_VERSION = '4.1.7';
48+
public const CI_VERSION = '4.1.8';
4949

5050
private const MIN_PHP_VERSION = '7.3';
5151

0 commit comments

Comments
 (0)