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/smallnest/resp3
The first redis RESP3 protocol library, written in Go.
You can use it to communicte with Redis 6 via RESP3, or you can wrap it as redis client lib.
Value
represents a redis command or an redis response, which supports all RESP3 types:
Reader
is used to read a Value
object from the connection. It can be used by both redis clients and redis servers.
you can use it to test the client cache feature in Redis 6.0.
func TestReader_IT_Tracking(t *testing.T) {
conn, err := net.DialTimeout("tcp", "127.0.0.1:6379", 5*time.Second)
if err != nil {
t.Logf("can't found one of redis 6.0 server")
return
}
defer conn.Close()
w := NewWriter(conn)
r := NewReader(conn)
w.WriteCommand("HELLO", "3")
helloResp, _, err := r.ReadValue()
if err != nil {
t.Fatalf("failed to send a HELLO 3")
}
if helloResp.KV.Size() == 0 {
t.Fatalf("expect some info but got %+v", helloResp)
}
t.Logf("hello response: %c, %v", helloResp.Type, helloResp.SmartResult())
w.WriteCommand("CLIENT", "TRACKING", "on")
resp, _, err := r.ReadValue()
if err != nil {
t.Fatalf("failed to TRACKING: %v", err)
}
t.Logf("TRACKING result: %c, %+v", resp.Type, resp.SmartResult())
w.WriteCommand("GET", "a")
resp, _, err = r.ReadValue()
if err != nil {
t.Fatalf("failed to GET: %v", err)
}
t.Logf("GET result: %c, %+v", resp.Type, resp.SmartResult())
go func() {
conn, err := net.DialTimeout("tcp", "127.0.0.1:9999", 5*time.Second)
if err != nil {
t.Logf("can't found one of redis 6.0 server")
return
}
defer conn.Close()
w := NewWriter(conn)
r := NewReader(conn)
for i := 0; i < 10; i++ {
//PUBLISH
w.WriteCommand("set", "a", strconv.Itoa(i))
resp, _, err = r.ReadValue()
if err != nil {
t.Fatalf("failed to set: %v", err)
}
t.Logf("set result: %c, %+v", resp.Type, resp.SmartResult())
time.Sleep(200 * time.Millisecond)
}
}()
for i := 0; i < 10; i++ {
resp, _, err = r.ReadValue()
if err != nil {
t.Fatalf("failed to receive a message: %v", err)
}
if resp.Type == TypePush && len(resp.Elems) >= 2 && resp.Elems[0].SmartResult().(string) == "invalidate" {
t.Logf("received TRACKING result: %c, %+v", resp.Type, resp.SmartResult())
// refresh cache "a"
w.WriteCommand("GET", "a")
resp, _, err = r.ReadValue()
}
}
}
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.