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.
github.com/mbranch/jsonrest-go
Package jsonrest implements a microframework for writing RESTful web applications.
Endpoints are defined as:
func(ctx context.Context, req *jsonrest.Request) (interface{}, error)
If an endpoint returns a value along with a nil error, the value will be rendered to the client as JSON.
If an error is returned, it will be sanitized and returned to the client as
json. Errors generated by a call to jsonrest.Error(status, code, message)
will be rendered in the following form:
{
"error": {
"message": message,
"code": code
}
}
along with the given HTTP status code.
If the error returned implements HTTPErrorResponse (i.e. has a StatusCode() int
method), it will be marshaled as-is to the client with the provided status
code.
Any other errors will be obfuscated to the caller (unless router.DumpError
is
enabled).
Example:
func main() {
r := jsonrest.NewRouter()
r.Use(logging)
r.Get("/", hello)
}
func hello(ctx context.Context, req *jsonrest.Request) (interface{}, error) {
return jsonrest.M{"message": "Hello, world"}, nil
}
func logging(next jsonrest.Endpoint) jsonrest.Endpoint {
return func(ctx context.Context, req *jsonrest.Request) (interface{}, error) {
start := time.Now()
defer func() {
log.Printf("%s (%v)\n", req.URL().Path, time.Since(start))
}()
return next(ctx, req)
}
}
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.