Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
mvdan.cc/xurls
Extract urls from text using regular expressions.
go get -u github.com/mvdan/xurls
import "github.com/mvdan/xurls"
func main() {
xurls.Relaxed.FindString("Do gophers live in golang.org?")
// "golang.org"
xurls.Strict.FindAllString("foo.com is http://foo.com/.", -1)
// []string{"http://foo.com/"}
}
Relaxed
is around five times slower than Strict
since it does more
work to find the URLs without relying on the scheme:
BenchmarkStrictEmpty-4 1000000 1885 ns/op
BenchmarkStrictSingle-4 200000 8356 ns/op
BenchmarkStrictMany-4 100000 22547 ns/op
BenchmarkRelaxedEmpty-4 200000 7284 ns/op
BenchmarkRelaxedSingle-4 30000 58557 ns/op
BenchmarkRelaxedMany-4 10000 130251 ns/op
go get -u github.com/mvdan/xurls/cmd/xurls
$ echo "Do gophers live in http://golang.org?" | xurls
http://golang.org
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
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.