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.
github.com/abuarque/simple-compression-service/src/libs/redis
To use it import to your project:
$ go get github.com/ABuarque/simple-compression-service/src/libs/redis
It provides an API to publish and subscribe to topics on a redis server instance. To use it first create a pointer to Client:
// New returns a new Client
func New() *Client {
redisHost := os.Getenv("REDIS_HOST")
if redisHost == "" {
redisHost = "localhost"
}
var redispool *redis.Pool
redispool = &redis.Pool{
Dial: func() (redis.Conn, error) {
return redis.Dial("tcp", fmt.Sprintf("%s:6379", redisHost))
},
}
conn := redispool.Get()
defer conn.Close()
_, err := conn.Do("PING")
if err != nil {
log.Fatalf("can't connect to the redis database, got error:\n%v", err)
}
return &Client{
pool: redispool,
}
}
To publish data to a topic the method Publish should be called:
// Publish publishes a new key value pair
func (c *Client) Publish(key string, value string) error {
conn := c.pool.Get()
_, err := conn.Do("PUBLISH", key, value)
return err
}
To subscribe to a topic invoke Subscribe method:
// Subscribe subscribes a client to a topic
func (c *Client) Subscribe(key string, msg chan []byte) error {
rc := c.pool.Get()
psc := redis.PubSubConn{Conn: rc}
if err := psc.PSubscribe(key); err != nil {
return err
}
go func() {
for {
switch v := psc.Receive().(type) {
case redis.PMessage:
msg <- v.Data
}
}
}()
return nil
}
FAQs
Unknown package
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.