
Security News
Follow-up and Clarification on Recent Malicious Ruby Gems Campaign
A clarification on our recent research investigating 60 malicious Ruby gems.
Simple wrapper for GeoIP gem with some redundancy on GeoKit to get a two-letter country code or locale from an IP and, (optionally) request headers if a service like cloudflare is used.
Detect application user's origin and display app in that language.
Ruby 2.0.0 and greater.
# in Gemfile
gem 'geo_locale', '~> 0.9.5' # and bundle
Configure default locales
# in /config/initializers/geo_locale.rb
GeoLocale.configure do |config|
config.localhost_country = "lv" # set the country to return for localhost, this country's locale and lcid will also be used for localhost
config.default_country = "de" # set to nil or false if you want to catch fails in geolocation
config.default_locale = "en" # country->locale conversion is minimal for now, set this explicitly to ensure GeoLocale.locale returns useful value
config.default_lcid = "en-us"
config.overrides["ee"] = "en" # hash used to override standard country codes
end
GeoLocale.country_code(ip: request.remote_ip, request_headers: request.headers)
# => "en"
GeoLocale.locale(country_code: "gb", request_headers: request.headers)
#=> "en"
GeoLocale.locale(country_code: "gb", lcid: true)
#=> "en-gb"
GeoLocale.locale(ip: "97.77.25.20")
#=> "en"
GeoLocale.locale(ip: "97.77.25.20", lcid: true)
#=> "en-us"
country_code is prioritized as it does not require external calls.
GeoLocale.locale(ip: "97.77.25.20", country_code: "lv")
#=> "lv"
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that geo_locale 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.