Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Add this line to your application's Gemfile:
gem 'interage-request', '~> 0.2'
And then execute:
bundle install
Or install it yourself as:
gem install interage-request
You can use a Rails generator to install:
rails g interage:request:install
Or you can create the ApplicationRequest
:
# app/requests/application_request.rb
class ApplicationRequest < ::Interage::ApplicationRequest
end
And ApplicationBuilder
# app/builders/application_builder.rb
class ApplicationBuilder < ::Interage::ApplicationBuilder
end
To create a request and builder classes you also can use a Rails generator:
rails g interage:request:create store/order client_name payment_form
This will create this classes:
# app/requests/store/base_request.rb
module Store
class BaseRequest < ::ApplicationRequest
private
def api_base_url
"#{ENV.fetch('STORE_BASE_URL')}/v1/"
end
def headers
{ 'Authorization-Token': ENV.fetch('STORE_AUTHORIZATION_TOKEN') }
end
end
end
# app/requests/store/orders_request.rb
module Store
class OrdersRequest < ::Store::BaseRequest
private
def key_name
:order
end
def klass
::Store::Order
end
end
end
# app/builders/store/order.rb
module Store
class Order < ApplicationBuilder
attr_accessor :client_name,
:payment_form
def requester
@requester ||= ::Store::OrdersRequest.new
end
private
def changeable_attributes
{ client_name: client_name,
payment_form: payment_form }
end
end
end
# frozen_string_literal: true
class OrdersController < ApplicationController
before_action :set_new_order, only: [:new, :create]
before_action :set_order, only: [:show, :edit, :update, :destroy]
def index
@orders = Order.paginate(params[:page])
end
def new
end
def create
if @order.create(order_params)
redirect_to orders_path
else
render :new
end
end
def edit
end
def update
if @order.update(order_params)
redirect_to orders_path
else
render :edit
end
end
def show
end
def destroy
@order.destroy
redirect_to orders_path
end
private
def order_params
params.require(:order).permit(:name, :age)
end
def set_new_order
@order = Order.new
end
def set_order
@order = Order.find(params[:id])
end
end
Bug reports and merge requests are welcome on GitLab at https://github.com/[USERNAME]/interage-request.
FAQs
Unknown package
We found that interage-request 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.