Skip to content

Commit

Permalink
Enable multiple entries in IP whitelist
Browse files Browse the repository at this point in the history
  • Loading branch information
Artur Beljajev committed May 24, 2018
1 parent 417adf3 commit 403fd7a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion app/controllers/whois_records_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ def log_message(params, whois_record)

def ip_in_whitelist?
return unless ENV['whitelist_ip'].present?
ENV['whitelist_ip'] == request.remote_ip
whitelist = ENV['whitelist_ip'].split(',').map(&:strip)
whitelist.include?(request.remote_ip)
end

def captcha_solved?
Expand Down
2 changes: 1 addition & 1 deletion config/application-example.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
whitelist_ip: '127.0.0.1'
whitelist_ip: '127.0.0.1, 127.0.0.2'
recaptcha_site_key: test
recaptcha_secret_key: test

Expand Down
6 changes: 6 additions & 0 deletions test/integration/whois_records/html_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -275,4 +275,10 @@ def test_hide_sensitive_data_of_legal_entity_when_ip_is_not_in_whitelist
)
assert_button 'View full whois info'
end

def test_multiple_entries_in_ip_whitelist
ENV['whitelist_ip'] = '127.0.0.1, 127.0.0.2'
visit '/v1/company-domain.test'
assert_no_text 'Not Disclosed'
end
end

0 comments on commit 403fd7a

Please sign in to comment.