From e735c6e5f583e36ed95bbda739c82caa65befdbc Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Thu, 4 Jul 2013 14:51:36 +0400 Subject: [PATCH] #192: Checks ip address in api defender --- lib/api_defender.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/api_defender.rb b/lib/api_defender.rb index dd3489a7b..de24917d2 100644 --- a/lib/api_defender.rb +++ b/lib/api_defender.rb @@ -51,7 +51,9 @@ class ApiDefender < Rack::Throttle::Hourly # only API calls should be throttled def need_defense?(request) - request.env['PATH_INFO'] =~ /^\/api\/v1\// && !system_user?(request) + APP_CONFIG['allowed_addresses'].exclude?(request.ip) && + request.env['PATH_INFO'] =~ /^\/api\/v1\// && + !system_user?(request) end def authorized?(request)