Skip to content

Commit c2128fb

Browse files
committed
[Security] Document the new expose_security_errors option
1 parent 326e7e5 commit c2128fb

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

reference/configuration/security.rst

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ key in your application configuration.
2323

2424
* `access_denied_url`_
2525
* `erase_credentials`_
26-
* `hide_user_not_found`_
26+
* `expose_security_errors`_
2727
* `session_fixation_strategy`_
2828

2929
**Advanced Options**:
@@ -71,11 +71,38 @@ after authentication::
7171
Since Symfony 7.3, ``eraseCredentials()`` methods are deprecated and are
7272
not called if they have the ``#[\Deprecated]`` attribute.
7373

74+
expose_security_errors
75+
----------------------
76+
77+
**type**: ``string`` **default**: ``'none'``
78+
79+
.. deprecated:: 7.3
80+
81+
The ``expose_security_errors`` option was introduced in Symfony 7.3
82+
83+
User enumeration is a common security issue where attackers infer valid usernames
84+
based on error messages. For example, a message like "This user does not exist"
85+
shown by your login form reveals whether a username is valid.
86+
87+
This options lets you hide some/all errors related to user accounts (e.g. blocked
88+
or expired accounts) to avoid this issue. Instead, these errors will return a
89+
generic ``BadCredentialsException``. The value of this option can be any of:
90+
91+
* ``'none'``: hides all user-related security exceptions;
92+
* ``'account_status'``: shows account-related exceptions (e.g. blocked or expired
93+
accounts) but only for users who provided the correct password;
94+
* ``'all'``: shows all security-related exceptions.
95+
7496
hide_user_not_found
7597
-------------------
7698

7799
**type**: ``boolean`` **default**: ``true``
78100

101+
.. deprecated:: 7.3
102+
103+
The ``hide_user_not_found`` option was deprecated in favor of the
104+
``expose_security_errors`` option in Symfony 7.3.
105+
79106
If ``true``, when a user is not found a generic exception of type
80107
:class:`Symfony\\Component\\Security\\Core\\Exception\\BadCredentialsException`
81108
is thrown with the message "Bad credentials".

0 commit comments

Comments
 (0)