Skip to content

Commit 9bf98c1

Browse files
nevanssikachu
authored andcommitted
Make TokenVerifier#call safely reentrant
In a multi-threaded app, two threads might update `@request` before either thread is able to evaluate `verified_request?`. In order to retain backward-compatibility, this is fixed by using `dup` and then calling the original implementation on that copy.
1 parent 6bcc98a commit 9bf98c1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/omniauth/rails_csrf_protection/token_verifier.rb

+4
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ class TokenVerifier
2828
end
2929

3030
def call(env)
31+
dup._call(env)
32+
end
33+
34+
def _call(env)
3135
@request = ActionDispatch::Request.new(env.dup)
3236

3337
unless verified_request?

0 commit comments

Comments
 (0)