Skip to content

Commit a6024ba

Browse files
committed
docs: add docs
1 parent 249c915 commit a6024ba

File tree

5 files changed

+20
-0
lines changed

5 files changed

+20
-0
lines changed

user_guide_src/source/changelogs/v4.3.5.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ Release Date: Unreleased
1212
SECURITY
1313
********
1414

15+
- *Remote Code Execution Vulnerability in Validation Placeholders* was fixed.
16+
See the `Security advisory GHSA-m6m8-6gq8-c9fj <https://github.com/codeigniter4/CodeIgniter4/security/advisories/GHSA-m6m8-6gq8-c9fj>`_
17+
for more information.
1518
- Fixed that ``Session::stop()`` did not destroy the session.
1619
See :ref:`Session Library <session-stop>` for details.
1720

user_guide_src/source/installation/upgrade_435.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ Mandatory File Changes
1818
Breaking Changes
1919
****************
2020

21+
Validation Placeholders
22+
=======================
23+
24+
- To use :ref:`validation-placeholders` securely, when you use validation placeholders
25+
and if you don't set the validation rules for the placeholder field, you need
26+
to set the validation rules for it.
27+
2128
Session::stop()
2229
===============
2330

user_guide_src/source/libraries/validation.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,8 @@ This method sets a rule group from the validation configuration to the validatio
436436

437437
.. literalinclude:: validation/018.php
438438

439+
.. _validation-placeholders:
440+
439441
Validation Placeholders
440442
=======================
441443

@@ -446,6 +448,9 @@ replaced by the **value** of the matched incoming field. An example should clari
446448

447449
.. literalinclude:: validation/020.php
448450

451+
.. note:: Since v4.3.5, you must set the validation rules for the placeholder
452+
field (``id``).
453+
449454
In this set of rules, it states that the email address should be unique in the database, except for the row
450455
that has an id matching the placeholder's value. Assuming that the form POST data had the following:
451456

@@ -457,6 +462,9 @@ then the ``{id}`` placeholder would be replaced with the number **4**, giving th
457462

458463
So it will ignore the row in the database that has ``id=4`` when it verifies the email is unique.
459464

465+
.. note:: Since v4.3.5, if the placeholder (``id``) value does not pass the
466+
validation, the placeholder would not be replaced.
467+
460468
This can also be used to create more dynamic rules at runtime, as long as you take care that any dynamic
461469
keys passed in don't conflict with your form data.
462470

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?php
22

33
$validation->setRules([
4+
'id' => 'is_natural_no_zero',
45
'email' => 'required|valid_email|is_unique[users.email,id,{id}]',
56
]);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?php
22

33
$validation->setRules([
4+
'id' => 'is_natural_no_zero',
45
'email' => 'required|valid_email|is_unique[users.email,id,4]',
56
]);

0 commit comments

Comments
 (0)