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.
A wrapper around strongbox to store and encrypt data.
Install strongbox and safe
config.gem "spikex-strongbox", :lib => "strongbox", :source => "http://gems.github.com"
config.gem "bitzesty-safe", :lib => "safe", :source => "http://gems.github.com"
rake gems:install
rake gems:unpack
Generate a migration with script/generate migration CreateSafeCabinet
and add the following
class CreateSafeCabinet < ActiveRecord::Migration
def self.up
create_table :safe_cabinets, :force => true do |t|
t.binary :data
t.binary :data_key
t.binary :data_iv
t.integer :encryptable_id
t.string :encryptable_type
t.timestamps
end
add_index :safe_cabinets, [:encryptable_id, :encryptable_type]
end
def self.down
drop_table :safe_cabinet
end
end
In your model that you want to store the encrypted data add:
class MyModel
include Safe::Keys
attr_accessor :password #length must be > 3
has_many :safe_cabinets, :as => :encryptable #or has_one
after_create :make_keys!
end
Make sure you are not logging the data/password by adding the following in your ApplicationController
filter_parameter_logging :data
filter_parameter_logging :password
N.B. A password must be used when creating an instance of MyModel.
To create and use safe_cabinets:
m = MyModel.create(:password => "1234")
c = m.safe_cabinets.new
c.data = "super secret data"
c.save
c.data
=> #<Strongbox::Lock:0x1f372d...
c.data.read_data("1234")
=> "super secret data"
Copyright (c) 2009 Matthew Ford and Bit Zesty Ltd, See LICENSE for details.
FAQs
Unknown package
We found that bitzesty-safe 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.