Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Model usage
class User < ApplicationRecord
include Ordy::Orm::ActiveRecord::Orderable
has_many :comments
orderable_by do
# order by field
columns :name, :email
# order by relations field
associations comments: :scripts
# sort by specified order
specified(state: %w(new, pending, active, removed))
# custom query
query :custom_query do |scope, args|
scope.where(name: 'example').order(email: args[:direction])
end
end
end
Code usage
# order by columns
User.order_by(name: :asc)
# or
User.order_by('name-asc')
# order by multiple columns
User.order_by(name: :asc, email: :desc)
# or
User.order_by(name: :asc).order_by(email: :desc)
# order by association column
User.order_by(comments: :asc)
# order by specified column values
User.order_by_specified(:state)
# order by custom query
User.order_by(custom_query: :asc)
# default ordering
User.order_by('')
# or
User.order_by(nil)
# ordering by more than one criteria
User.order_by(email: :asc, state: :desc)
Helper inclusion
# users_helper.rb
include Ordy::Helpers::ActionView::OrderableLinkHelper
Html usage
# index.html
<%= order_link('link_title', 'ordering_filed') %>
Controller usage
class UsersController
def index
if params[:order_by].present? && params[:direction].present?
@users = User.order_by(params[:order_by] => params[:direction])
else
@users = User.all
end
end
end
# position in gem dir
cd ordy
# build app
docker-compose build app
# run app and attach with bash
docker-compose run app /bin/bash
# install dependencies
bundle exec appraisal install
# run tests for rails 4 env
bundle exec appraisal rails-4 rspec
# run tests for rails 5 env
bundle exec appraisal rails-5 rspec
Bug reports and pull requests are very welcome on GitHub.
Before opening a PR, please
extend the existing specs
#License The gem is available as open source under the terms of the MIT License.
This gem is currently maintained and funded by nine.
FAQs
Unknown package
We found that ordy 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.