Skip to content

Commit

Permalink
Merge pull request #1823 from ooooooo-q/fix/redos
Browse files Browse the repository at this point in the history
fix ReDoS
  • Loading branch information
jkowens committed Oct 9, 2022
2 parents b88c232 + 441c06a commit 8ff496b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rack-protection/lib/rack/protection/ip_spoofing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class IPSpoofing < Base
def accepts?(env)
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_X_REAL_IP') && (!ips.include? env['HTTP_X_REAL_IP'])

Expand Down

0 comments on commit 8ff496b

Please sign in to comment.