mirror of
https://github.com/sinatra/sinatra
synced 2023-03-27 23:18:01 -04:00
fix ReDoS
This commit is contained in:
parent
ceb49f043c
commit
441c06a7eb
1 changed files with 1 additions and 1 deletions
|
@ -16,7 +16,7 @@ module Rack
|
||||||
def accepts?(env)
|
def accepts?(env)
|
||||||
return true unless env.include? 'HTTP_X_FORWARDED_FOR'
|
return true unless env.include? 'HTTP_X_FORWARDED_FOR'
|
||||||
|
|
||||||
ips = env['HTTP_X_FORWARDED_FOR'].split(/\s*,\s*/)
|
ips = env['HTTP_X_FORWARDED_FOR'].split(',').map(&:strip)
|
||||||
return false if env.include?('HTTP_CLIENT_IP') && (!ips.include? env['HTTP_CLIENT_IP'])
|
return false if env.include?('HTTP_CLIENT_IP') && (!ips.include? env['HTTP_CLIENT_IP'])
|
||||||
return false if env.include?('HTTP_X_REAL_IP') && (!ips.include? env['HTTP_X_REAL_IP'])
|
return false if env.include?('HTTP_X_REAL_IP') && (!ips.include? env['HTTP_X_REAL_IP'])
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue