Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
warden_cookie_session
Advanced tools
Warden Cookie Session is a warden strategy to store auth in custom encrypted cookie(instead of rack:session).
The main puprpose to allow store authorization between multiple rails applications, without sharing secret_key_base
.
Setup Warden::CookieSession
in initializer and provide wrapper.
Warden::CookieSession.configure do |config|
config.cookie = Rails.application.secrets['shared_cookie']
config.secret = Rails.application.secrets['shared_secret']
config.wrapper = Warden::CookieSession::DefaultWrapper.new(User)
end
Default wrapper just fetch user from model:
module Warden
module CookieSession
class DefaultWrapper
def initialize(klass = nil)
@klass = klass
end
def serialize_record(record)
# like in https://github.com/plataformatec/devise/blob/master/lib/devise/models/authenticatable.rb
[record.to_key, record.authenticatable_salt]
end
def fetch_record(key)
@klass.find(key.first)
end
def validate_record(record, salt)
# like in https://github.com/plataformatec/devise/blob/master/lib/devise/models/authenticatable.rb
record if record && record.authenticatable_salt == salt
end
end
end
end
With Warden::CookieSession
we can fetch user data remotly ex. from API:
Warden::CookieSession.configure do |config|
config.cookie = Rails.application.secrets['shared_cookie']
config.secret = Rails.application.secrets['shared_secret']
class RemoteWrapper
def serialize_record(record)
[record.to_key, record.authenticatable_salt]
end
def fetch_record(key)
FetchRemoteUserAndSalt.run!(key)
end
def validate_record(record, salt)
record if record && record.authenticatable_salt == salt
end
end
config.wrapper = Warden::CookieSession::DefaultWrapper.new(User)
end
It's a gem:
gem install warden_cookie_session
There's also the wonders of the Gemfile:
gem 'warden_cookie_session'
FAQs
Unknown package
We found that warden_cookie_session 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
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.