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/goware/urlx
Golang pkg for URL parsing and normalization.
The urlx.Parse() is compatible with the same function from net/url pkg, but has slightly different behavior. It enforces default scheme and favors absolute URLs over relative paths.
github.com/goware/urlx | net/url |
---|---|
urlx.Parse("example.com") |
url.Parse("example.com") |
urlx.Parse("localhost:8080") |
url.Parse("localhost:8080") |
urlx.Parse("user.local:8000/path") |
url.Parse("user.local:8000/path") |
import "github.com/goware/urlx"
func main() {
url, _ := urlx.Parse("example.com")
// url.Scheme == "http"
// url.Host == "example.com"
fmt.Print(url)
// Prints http://example.com
}
The urlx.Normalize() function normalizes the URL using the predefined subset of Purell flags.
import "github.com/goware/urlx"
func main() {
url, _ := urlx.Parse("localhost:80///x///y/z/../././index.html?b=y&a=x#t=20")
normalized, _ := urlx.Normalize(url)
fmt.Print(normalized)
// Prints http://localhost/x/y/index.html?a=x&b=y#t=20
}
The urlx.SplitHostPort() is compatible with the same function from net pkg, but has slightly different behavior. It doesn't remove brackets from [IPv6]
host.
import "github.com/goware/urlx"
func main() {
url, _ := urlx.Parse("localhost:80")
host, port, _ := urlx.SplitHostPort(url)
fmt.Print(host)
// Prints localhost
fmt.Print(port)
// Prints 80
}
The urlx.Resolve() is compatible with ResolveIPAddr() from net.
url, _ := urlx.Parse("localhost")
ip, _ := urlx.Resolve(url)
fmt.Print(ip)
// Prints 127.0.0.1
URLx is licensed under the MIT License.
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.