
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
HasSecureUuid provides an easy way to generate uniques random uuid's for any model in ruby on rails. SecureRandom::uuid is used to generate the unique id's, so collisions are highly unlikely.
Note If you're worried about possible collissions, there's a way to generate a race condition in the database in the same way that validates_uniqueness_of can. You're encouraged to add an unique index in the database to deal with this even more unlikely scenario.
Add this line to your application's Gemfile:
gem 'has_secure_uuid'
And then run:
$ bundle
Or install it yourself as:
$ gem install has_secure_uuid
The first step is to generate a migration in order to add the uuid key field.
rails g migration AddidentifierToUsers uuid:string
=>
invoke active_record
create db/migrate/20150424010931_add_uuid_to_users.rb
Then run rake db:migrate
in order to update users table in the database. The next step is to add has_secure_uuid
to the model:
# Schema: User(uuid:string, identifier:string)
class User < ActiveRecord::Base
has_secure_uuid
end
user = User.new
user.save
user.uuid # => "6c3d256c-aaa7-443a-a16b-75a99ecde277"
user.regenerate_uuid # => true
To use a custom column to store the uuid field you can specify the column_name option. See example above (e.g: identifier):
# Schema: User(uuid:string, identifier:string)
class User < ActiveRecord::Base
has_secure_uuid :identifier
end
user = User.new
user.save
user.identifier # => "6c3d256c-aaa7-443a-a16b-75a99ecde277"
user.regenerate_identifier # => true
Running
$ rake test
Should return
3 runs, 5 assertions, 0 failures, 0 errors, 0 skips
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)Modified from: https://github.com/robertomiranda/has_secure_token
FAQs
Unknown package
We found that has_secure_uuid 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
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.