Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
github.com/bigbasket/go-web-middleware
go get github.com/BigBasket/go-web-middleware
The Objective of this package is to manage common middlewares needed for golang web applications.
web apis that are using rsa-jwt token for security can instrument the middleware to parse and validate the token.
import (
"github.com/BigBasket/go-web-middleware/auth/jwt"
"github.com/gorilla/mux"
"github.com/lestrrat-go/jwx/jwa"
)
func testHandler (w http.ResponseWriter, r *http.Request) {
w.Write(http.StatusOK)
}
func main() {
router := mux.NewRouter()
jwtDecode := &RSADecode{
PublicKey : "key" // base64 encoded rsa public key
Algorithm: jwa.RS256
}
router.Use(jwtDecode.InstrumentJWTBearerToken)
router.HandleFunc("/order/1", testHandler).Methods(http.MethodGet)
}
import (
"github.com/BigBasket/go-web-middleware/profiling/newrelic"
log "github.com/sirupsen/logrus"
)
func testHandler (w http.ResponseWriter, r *http.Request) {
tx := newrelic.FetchTransaction(r.Context())
// use the newrelic transaction for creating segments etc..
w.Write(http.StatusOK)
}
func main() {
router := mux.NewRouter()
nConn, err := NewConnection(ctx, ConnectionConfig{
newrelic.Config{AppName: "newrelic-test",
License: "testkey"},
})
if err != nil {
// handle errors
return
}
router.Use(nConn.InstrumentNewRelic)
router.HandleFunc("/order/1", testHandler).Methods(http.MethodGet)
}
import (
"github.com/BigBasket/go-web-middleware/profiling/tracker"
)
func testHandler (w http.ResponseWriter, r *http.Request) {
tracker := FetchXTracker(r.Context())
w.Write(http.StatusOK)
}
func main() {
router := mux.NewRouter()
router.Use(profiling.InstrumentXTracker)
router.HandleFunc("/order/1", testHandler).Methods(http.MethodGet)
}
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
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.