Skip to content

Commit 05f03f8

Browse files
author
AlexanderPavlenko
committed
amend random string generation
1 parent 844aa40 commit 05f03f8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/omniauth/strategies/oauth2.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ def request_phase
4848

4949
def authorize_params
5050
if options.authorize_params[:state].to_s.empty?
51-
options.authorize_params[:state] = 3.times.map{ rand.to_s[2..-1] }.reduce(&:concat)
51+
require 'securerandom'
52+
options.authorize_params[:state] = SecureRandom.hex(24)
5253
end
5354
params = options.authorize_params.merge(options.authorize_options.inject({}){|h,k| h[k.to_sym] = options[k] if options[k]; h})
5455
if OmniAuth.config.test_mode

0 commit comments

Comments
 (0)