
Security News
Follow-up and Clarification on Recent Malicious Ruby Gems Campaign
A clarification on our recent research investigating 60 malicious Ruby gems.
rails_browser_timezone
Advanced tools
The purpose of this gem is to track browser's timezone and run rails controller code in the time zone detected for each request.
For background and thoughts, please refer - http://developerstream.blogspot.in/2015/09/handling-requests-in-browser-time-zone.html
gem 'rails_browser_timezone', '0.2.0', :git => 'https://github.com/udayakiran/rails_browser_timezone'
# Say in config/initializers/rails_browser_tz_init.rb
RailsBrowserTimezone::Setting.baseline_year = 2014 #default value is 2011. Accepted values - any valid year or string - "current"
#Rails 4.1.x or earlier (inlcuding Rails 2,3 and 4)
class MyTimeZoneController < ApplicationController #Or in your application_controller.rb
prepend_around_filter RailsBrowserTimezone::Filter
.......
.......
end
#Rails 4.2.x or later
class MyTimeZoneController < ApplicationController #Or in your application_controller.rb
prepend_around_action RailsBrowserTimezone::Filter
.......
.......
end
If you like to save the last_known_timezone of any user in the database, it can be done by using "Time.zone.name" any where in your controller, once 'RailsBrowserTimezone::Filter' is done with the determining of the time zone from offsets.
Use Time.zone.* not Time.* :- Most of the scenarios we need to deal with times in the current time zone not in the system time zone on which app is running. So, we should use Time.zone.now, Time.zone.parse and time_obj.in_time_zone(Time.zone) when we are dealing with time information.
Use Time.use_zone :- When we need to operate in other time zones than the current system, enlose that code in Time.use_zone block. This sets back the system time zone once the code completes execution or even when exception occurs. Otherwise we should always remember to set the system's time zone back to default.
Add specs and tests.
Please help with your contribution by filing any issues if found. Pull requests are welcomed :)
FAQs
Unknown package
We found that rails_browser_timezone 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.