You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: user_guide_src/source/changelogs/v4.3.0.rst
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -291,6 +291,7 @@ The following items are affected:
291
291
292
292
- Typography class: Creation of ``br`` tag
293
293
- View Parser: The ``nl2br`` filter
294
+
- Honeypot: ``input`` tag
294
295
- Form helper
295
296
- HTML helper
296
297
- Common Functions
@@ -364,3 +365,4 @@ Bugs Fixed
364
365
- Fixed a bug when all types of ``Prepared Queries`` were returning a ``Result`` object instead of a bool value for write-type queries.
365
366
- Fixed a bug with variable filtering in JSON requests using with ``IncomingRequest::getVar()`` or ``IncomingRequest::getJsonVar()`` methods.
366
367
- Fixed a bug when variable type may be changed when using a specified index with ``IncomingRequest::getVar()`` or ``IncomingRequest::getJsonVar()`` methods.
368
+
- Fixed a bug that Honeypot field appears when CSP is enabled. See also :ref:`upgrade-430-honeypot-and-csp`.
The Honeypot Class makes it possible to determine when a Bot makes a request to a CodeIgniter4 application,
6
-
if it's enabled in ``Application\Config\Filters.php`` file. This is done by attaching form fields to any form,
6
+
if it's enabled in **app\Config\Filters.php** file. This is done by attaching form fields to any form,
7
7
and this form field is hidden from a human but accessible to a Bot. When data is entered into the field, it's
8
8
assumed the request is coming from a Bot, and you can throw a ``HoneypotException``.
9
9
10
10
.. contents::
11
11
:local:
12
12
:depth: 2
13
13
14
+
*****************
14
15
Enabling Honeypot
15
-
=====================
16
+
*****************
16
17
17
18
To enable a Honeypot, changes have to be made to the **app/Config/Filters.php**. Just uncomment honeypot
18
19
from the ``$globals`` array, like:
19
20
20
21
.. literalinclude:: honeypot/001.php
21
22
22
-
A sample Honeypot filter is bundled, as ``system/Filters/Honeypot.php``.
23
-
If it is not suitable, make your own at ``app/Filters/Honeypot.php``,
23
+
A sample Honeypot filter is bundled, as **system/Filters/Honeypot.php**.
24
+
If it is not suitable, make your own at **app/Filters/Honeypot.php**,
24
25
and modify the ``$aliases`` in the configuration appropriately.
25
26
27
+
********************
26
28
Customizing Honeypot
27
-
=====================
29
+
********************
28
30
29
31
Honeypot can be customized. The fields below can be set either in
30
32
**app/Config/Honeypot.php** or in **.env**.
31
33
32
-
* ``hidden`` - true|false to control visibility of the honeypot field; default is ``true``
33
-
* ``label`` - HTML label for the honeypot field, default is 'Fill This Field'
34
-
* ``name`` - name of the HTML form field used for the template; default is 'honeypot'
35
-
* ``template`` - form field template used for the honeypot; default is '<label>{label}</label><input type="text" name="{name}" value=""/>'
34
+
* ``$hidden`` - ``true`` or ``false`` to control visibility of the honeypot field; default is ``true``
35
+
* ``$label`` - HTML label for the honeypot field, default is ``'Fill This Field'``
36
+
* ``$name`` - name of the HTML form field used for the template; default is ``'honeypot'``
37
+
* ``$template`` - form field template used for the honeypot; default is ``'<label>{label}</label><input type="text" name="{name}" value="">'``
38
+
* ``$container`` - container tag for the template; default is ``'<div style="display:none">{template}</div>'``.
39
+
If you enables CSP, you can remove ``style="display:none"``.
40
+
* ``$containerId`` - [Since v4.3.0] this setting is used only when you enables CSP. You can change the id attribute for the container tag; default is ``'hpc'``
0 commit comments