@@ -5,15 +5,25 @@ NoSuspiciousCharacters
5
5
6
6
The ``NoSuspiciousCharacters `` constraint was introduced in Symfony 6.3.
7
7
8
- A good thing about Unicode is that it allows to use (almost) every imaginable character.
9
- A bad thing is that this makes spoofing rather easy: "symfony.com" and "ѕymfony.com"
10
- look similar, but the latter actually starts with a `cyrillic small letter dze `_.
8
+ ..
9
+
10
+ Because Unicode contains such a large number of characters and incorporates
11
+ the varied writing systems of the world, incorrect usage can expose programs
12
+ or systems to possible security attacks.
13
+
14
+ `Unicode® Technical Standard #39 `_
15
+
16
+ "symfony.com" and "ѕymfony.com" look similar, but the latter actually starts with a
17
+ `cyrillic small letter dze `_. It could make a user think they'll navigate to Symfony's
18
+ website, whereas it would be somewhere else.
19
+ This is a kind of `spoofing attack `_ (called "IDN homograph attack"): it tries to
20
+ identify something as something else to exploit the resulting confusion.
11
21
This is why it is recommended to check user-submitted, public-facing identifiers for
12
- suspicious characters to prevent spoofing attempts .
22
+ suspicious characters in order to prevent such attacks .
13
23
14
- This constraint performs such validation on strings or :phpclass: `Stringable`s.
15
- As it leverages PHP's :phpclass:`Spoofchecker `, the intl extension must be enabled to
16
- use it.
24
+ This constraint ensures strings or :phpclass: `Stringable`s do not include any
25
+ suspicious characters. As it leverages PHP's :phpclass:`Spoofchecker `, the intl
26
+ extension must be enabled to use it.
17
27
18
28
========== ===================================================================
19
29
Applies to :ref: `property or method <validation-property-target >`
@@ -138,7 +148,9 @@ You can accept all characters by setting this option to
138
148
139
149
.. include :: /reference/constraints/_payload-option.rst.inc
140
150
151
+ .. _`Unicode® Technical Standard #39` : https://unicode.org/reports/tr39/
141
152
.. _`cyrillic small letter dze` : https://graphemica.com/%D1%95
153
+ .. _`spoofing attack` : https://en.wikipedia.org/wiki/Spoofing_attack
142
154
.. _`single-script` : https://unicode.org/reports/tr39/#def-single-script
143
155
.. _`covered` : https://unicode.org/reports/tr39/#def-cover
144
156
.. _`Recommended` : https://www.unicode.org/reports/tr31/#Table_Recommended_Scripts
0 commit comments