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.
This gem provides uniq and random ids generation in distributed services but at the same time gives some ordering (timestamp) and debug (context) information
The gem is inspired by Twitter Snowflake and other algorithms.
The main difference is that ids generated by gem are not fully sequenced. We want to have large random part that can be used as a simple guard against enumeration attack.
While we designed format and gem we used these as requirements:
Suggested algorithm is based on the Twitter snowflake and other similar alghorithms:
TTTTTTTT-II-RRRRRRRRRRRRRRRRRRRRRR
TTTTTTTT
- time in seconds since 2000 (just cool number) represented as hex - Gives us ~150 years of uniq sequencesII
- 1 byte for System Identification in hexRRRRRRRRRRRRRRRRRRRRRR
- 11 bytes secure random number as hexCode to generate is pretty straightforward:
time = format('%08x', Time.now.to_i - Time.new(2000).to_i)
id = '6a'
random = SecureRandom.hex(11)
id = "#{time}-#{id}-#{random}" # "21dc3680-6a-910df0665e5e29b9f89e21"
Add gem to your application's Gemfile:
gem 'id_generator'
# Somewhere during project start
context_id = 165 # value from 0 to 255
IdGenerator.configuration.context_id = context_id
# Or using block
IdGenerator.configure { |config| config.context_id = context_id }
#Inside of the actual code
IdGenerator.generate
Bug reports and pull requests are welcome on GitHub at https://github.com/matic-insurance/id_generator.
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that id_generator 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.