mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Use AS secure_compare for CSRF token comparison
This commit is contained in:
parent
4b11dea391
commit
0073d274de
1 changed files with 2 additions and 2 deletions
|
@ -1,5 +1,6 @@
|
|||
require 'rack/session/abstract/id'
|
||||
require 'action_controller/metal/exceptions'
|
||||
require 'active_support/security_utils'
|
||||
|
||||
module ActionController #:nodoc:
|
||||
class InvalidAuthenticityToken < ActionControllerError #:nodoc:
|
||||
|
@ -305,8 +306,7 @@ module ActionController #:nodoc:
|
|||
end
|
||||
|
||||
def compare_with_real_token(token, session)
|
||||
# Borrow a constant-time comparison from Rack
|
||||
Rack::Utils.secure_compare(token, real_csrf_token(session))
|
||||
ActiveSupport::SecurityUtils.secure_compare(token, real_csrf_token(session))
|
||||
end
|
||||
|
||||
def real_csrf_token(session)
|
||||
|
|
Loading…
Reference in a new issue