Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
github.com/Jarnpher553/tcp-shaker
This package is used to perform TCP handshake without ACK, which useful for TCP health checking.
HAProxy does this exactly the same, which is:
This implementation has been running on tens of thousands of production servers for years.
In most cases when you establish a TCP connection(e.g. via net.Dial
), these are the first three packets between the client and server(TCP three-way handshake):
This package tries to avoid the last ACK when doing handshakes.
By sending the last ACK, the connection is considered established.
However, as for TCP health checking the server could be considered alive right after it sends back SYN-ACK,
that renders the last ACK unnecessary or even harmful in some cases.
By avoiding the last ACK
The second one is essential because it bothers the server less.
This means the application level server will not notice the health checking traffic at all, thus the act of health checking will not be considered as some misbehavior of client.
There is a fake implementation for non-Linux platform which is equivalent to:
conn, err := net.DialTimeout("tcp", addr, timeout)
conn.Close()
The reason for a fake implementation is that there is currently no way to perform an equivalent operation on certain platforms, specifically macOS. A fake implementation is a degradation on those platforms and ensures a successful compilation.
import "github.com/Jarnpher553/tcp-shaker"
// Initializing the checker
// It is expected to be shared among goroutines, only one instance is necessary.
c := NewChecker()
ctx, stopChecker := context.WithCancel(context.Background())
defer stopChecker()
go func() {
if err := c.CheckingLoop(ctx); err != nil {
fmt.Println("checking loop stopped due to fatal error: ", err)
}
}()
<-c.WaitReady()
// Checking google.com
timeout := time.Second * 1
err := c.CheckAddr("google.com:80", timeout)
switch err {
case ErrTimeout:
fmt.Println("Connect to Google timed out")
case nil:
fmt.Println("Connect to Google succeeded")
default:
fmt.Println("Error occurred while connecting: ", err)
}
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.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.