
Security News
Follow-up and Clarification on Recent Malicious Ruby Gems Campaign
A clarification on our recent research investigating 60 malicious Ruby gems.
Dates and times passed in as strings date-pickers or time-pickers need to be converted from their string format to a ruby Date or DateTime to be able to be saved and manipulated. This gem provides two simple controller add-ons to facilitate the conversion.
Rails 3.x and Ruby 1.9.3 or 2.x required.
Add this line to your application's Gemfile:
gem 'date_params'
And then execute:
$ bundle
Or install it yourself as:
$ gem install date_params
Specify the dates to be parsed:
class UsersController < ApplicationController
# e.g. parameters come in as: { sign_up_on: '01/05/2013' }
date_params :sign_up_on
# and now params[:sign_up_on] is a Date object
end
Any options that a before_filter
accepts can be passed in:
date_params :sign_up_on, only: [:index]
If date fields are namespaced in a model that can be specified with the
namespace
option:
# will parse parameters in the format of: { user: { searched_on: '01/04/2013', sign_up_on: '04/03/2013' } }
date_params :searched_on, :sign_up_on, namespace: :user
Date format can be passed as an option (default is %m/%d/%Y
):
date_params :search_on, :sign_up_on, date_format: '%d-%m-%Y'
Specify the datetime fields that need to be parsed:
class UsersController < ApplicationController
# e.g. parameters come in as: { sign_up_at_date: '01/05/2013', sign_up_at_time: '7:30 pm' }
datetime_params :sign_up_at
# and now params[:sign_up_at] is a timezone-aware DateTime object
end
In addition to the :namespace
and :date_format
options, the time format can be specified
(default is %I:%M %p
):
date_params :sign_up_at, time_format: '%H:%M:%S'
To specify exactly which fields should be parsed:
date_params { date: :sign_up_on, time: :sign_up_time, field: :sign_up_at }, only: :create
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that date_params 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.