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.
Fernet allows you to easily generate and verify HMAC based authentication tokens for issuing API requests between remote servers. It also encrypts the message so it can be used to transmit secure data over the wire.
Fernet is usually served as a digestif after a meal but may also be served with coffee and espresso or mixed into coffee and espresso drinks.
Fernet about it!
Fernet is distributed as a rubygem, so
either add gem 'fernet'
to your application's Gemfile or install it yourself
by running gem install fernet
.
Both server and client must share a secret.
You want to encode some data in the token as well, for example, an email address can be used to verify it on the other end.
token = Fernet.generate(secret, 'harold@heroku.com')
On the server side, the receiver can use this token to verify whether it's legit:
verifier = Fernet.verifier(secret, token)
if verifier.valid?
operate_on(verifier.message) # the original, decrypted message
end
The verifier is valid if:
Otherwise, verified
will be false, and you should deny the request with an
HTTP 401, for example.
The specs (spec/fernet_spec.rb) have more usage examples.
It's possible to configure fernet via the Configuration
class. To do so, put
this in an initializer:
# default values shown here
Fernet::Configuration.run do |config|
config.enforce_ttl = true
config.ttl = 60
end
Generating appropriate secrets is beyond the scope of Fernet
, but you should
generate it using /dev/random
in a *nix. To generate a base64-encoded 256 bit
(32 byte) random sequence, try:
dd if=/dev/urandom bs=32 count=1 2>/dev/null | openssl base64
Fernet is compatible with Ruby 1.9 and above. It is tested on the rubies available on this Travis CI configuration file
This library was largely made possible by Mr. Tom Maher, who clearly articulated the mechanics behind this process, and further found ways to make it more secure.
Similarly, Mr. Keith Rarick who implemented a Go version and put together the Fernet spec which is used by this project to verify interoparability.
Contributions are welcome via github pull requests.
To run the test suite:
git submodule init && git submodule update
bundle exec rspec spec
Thanks to all contributors.
If you find a security issue with Fernet, please report it by emailing the fernet security list: fernet-secure@googlegroups.com
Fernet is copyright (c) Harold Giménez and is released under the terms of the MIT License found in the LICENSE file.
FAQs
Unknown package
We found that fernet 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.