未验证 提交 ab6329bf 编写于 作者: E Eliot Sykes 提交者: GitHub

Resurrect doc explaining HTTP Basic behavior

Bring back comment (mislaid in commit a5b2fff6) that explains why HTTP Basic Auth check uses `&`; it is useful for learners and mitigates `&` being accidentally replaced with `&&` one day.
上级 3ddf6b66
......@@ -76,6 +76,8 @@ def http_basic_authenticate_with(name:, password:, realm: nil, **options)
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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册