Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Fetch your environment variables. Raise errors or set defaults when a variable does not exist.
Add this line to your application's Gemfile:
gem 'duffel'
And then execute:
$ bundle
Or install it yourself as:
$ gem install duffel
Duffel is a simple gem for reading things out of your environment.
You have something in your environment named SUPER_SECRET_PASSWORD
? No problem. To get it out, just do the following:
Duffel.super_secret_password
Simple, right? But why add a layer of abstraction here? Well, there are a few reasons:
Most people get their environment variables like so: ENV['SUPER_SECRET_PASSWORD']
. This will return nil if the variable is not found. Duffel will return a KeyError, so you are told about missing things.
That's fine too, you can specify a fallback for Duffel in case something isn't found. Example:
Duffel.super_secret_password(fallback: 'another-password')
No problem, we can set our fallback to nil:
Duffel.super_secret_password(fallback: nil)
I actually started writing this because I noticed was using a combination of ENV['SOME_VARIABLE_NAME_HERE']
and Settings.some_method_name
. I wanted to just use the Settings.method_name
pattern everywhere, so I wrote Duffel.
So while Duffel by default gets things out of your environment, you can use it as a general purpose settings drawer.
Let's say you wanted to actually have a constant called Settings but still take advantage of Duffel. You could do something like this:
class Settings < Duffel
def self.some_other_awesome_setting
'awesome setting return value'
end
end
Calling Settings.env_variable_name
will still return you your environment variable, should it exist.
I know.
Because I probably don't know the obviously better way. Feel free to submit a pull request or open an issue and I'll look into it!
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that duffel 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
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
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.