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.
sinatra-decorator is a gem for Sinatra.
Adds an object-oriented layer of presentation logic to your Sinatra application.
Add the following to your Gemfile
:
gem 'sinatra/decorator'
And then execute:
$ bundle
# app.rb
require 'sinatra'
require 'slim'
require 'sinatra/decorator'
require_relative 'models/post'
require_relative 'decorators/post_decorator'
get '/' do
@post = Post.new.decorate # will try to find "#{self.class}Decorator" class
slim :show
end
# models/post.rb
#class Post < ActiveRecord::Base
# include Sinatra::Decorator::Decoratable
#end
class Post
include Sinatra::Decorator::Decoratable
attr_accessor :id, :body
def initialize(params = {})
@id = params[:id] || 1
@body = params[:body] || "body"
end
end
# decorators/post_decorator.rb
class PostDecorator < Sinatra::Decorator::Base
def formated_body
object.body.gsub('b', 'a')
end
end
# views/show.slim
h1 = @post.id
div
= @post.formated_body
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)This gem was made on the basis of the padrino-decorator. I greatly appreciate for the orignal author Mr. @tyabe.
FAQs
Unknown package
We found that sinatra-decorator 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.