New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

country_rejector

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

country_rejector

  • 0.1.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

CountryRejector Build Status GitHub version Coverage Status

Rack middleware that ban any IP located in a ban list.

Installation

Add this line to your application's Gemfile:

gem 'country_rejector'

And then execute:

$ bundle

Or install it yourself as:

$ gem install country_rejector

Usage

Add this line in your application.rb

config.middleware.use "CountryRejector::Middleware"

Create an initializer file (rack_reject_countries.rb)

CountryRejector::Middleware.configure do |config|
  config.banned_list = ::Gaston.countries.banned # is an array that list all country codes that are banished
  # config.country_detector = lambda {|ip| ::TZInfo::detect_country(ip) } # is the processor that is executed to get the associated country code
  # config.env_ip_tag = "HTTP_X_REAL_IP" # is the key checked in ENV for the current ip
end

Advice

Don't use this middleware in your test environnement! ( It's a bad idea ). So add this line in your environments/test.rb for example:

  config.middleware.delete ::CountryRejector::Middleware

Testing the Gem

  • Run the RSpec tests:
bundle exec rspec

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/Vodeclic/country_rejector.

License

Copyright © 2016 Vodeclic SAS released under the MIT License.

FAQs

Package last updated on 20 Jan 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc