
Security News
Follow-up and Clarification on Recent Malicious Ruby Gems Campaign
A clarification on our recent research investigating 60 malicious Ruby gems.
rack_do_app_platform_safelist
Advanced tools
Simple rack middleware for ruby applications hosted on Digital Ocean app platform to block ip addresses that are not safelisted via an environment variable.
Simply add an environment variable called ALLOWED_IPS that contains a comma seperated list of ips that are allowed to access you application (you can use CIDR notation as well to safelist ips).
Example:
ALLOWED_IPS = "8.8.8.8, 8.8.4.4, 1.2.3.0/24"
Add this line to your application's Gemfile:
# In your Gemfile
gem "rack_do_app_platform_safelist"
And then execute:
$ bundle
Or install it yourself as:
$ gem install rack_do_app_platform_safelist
Then tell your ruby web application to use the middleware.
a) For rails applications.
# In config/initializers/rack_do_app_platform_safelist.rb
require "rack_do_app_platform_safelist"
if Rails.env.production?
Rails.application.config.middleware.insert_before(0, RackDoAppPlatformSafelist, logger: Rails.logger)
end
This will insert the middleware at the top of the middleware stack so it can block request before reaching any other middleware in your application. You would only want to enable this middleware in production.
b) For rack applications:
# In config.ru
require "rack_do_app_platform_safelist"
use RackDoAppPlatformSafelist
run App.new
If you want to use a different environment variable for the safelisted IPs you can pass it as an argument
a) For rails applications.
# In config/initializers/rack_do_app_platform_safelist.rb
require "rack_do_app_platform_safelist"
Rails.application.config.middleware.insert_before(0, RackDoAppPlatformSafelist, logger: Rails.logger,
env_key: "SAFELISTED_IPS")
b) For rack applications:
# In config.ru
require "rack_do_app_platform_safelist"
use RackDoAppPlatformSafelist, env_key: "SAFELISTED_IPS"
run App.new
The middleware will now look for the IP addresses to safelist in the SAFELISTED_IPS environment variable.
FAQs
Unknown package
We found that rack_do_app_platform_safelist demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.
Research
/Security News
A malicious Go module posing as an SSH brute forcer exfiltrates stolen credentials to a Telegram bot controlled by a Russian-speaking threat actor.