mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Resurrect doc explaining HTTP Basic behavior
Bring back comment (mislaid in commit a5b2fff
) that explains why HTTP Basic Auth check uses `&`; it is useful for learners and mitigates `&` being accidentally replaced with `&&` one day.
This commit is contained in:
parent
3ddf6b66bc
commit
ab6329bf4f
1 changed files with 2 additions and 0 deletions
|
@ -76,6 +76,8 @@ module ActionController
|
|||
|
||||
def http_basic_authenticate_or_request_with(name:, password:, realm: nil, message: nil)
|
||||
authenticate_or_request_with_http_basic(realm, message) do |given_name, given_password|
|
||||
# This comparison uses & so that it doesn't short circuit and
|
||||
# uses `secure_compare` so that length information isn't leaked.
|
||||
ActiveSupport::SecurityUtils.secure_compare(given_name, name) &
|
||||
ActiveSupport::SecurityUtils.secure_compare(given_password, password)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue