Gin Missing JWT Middleware
Description
API endpoints lack JWT authentication middleware protection.
What Shoulder detects
How to fix
Add JWT middleware to protect API routes.
```go
import jwt "github.com/appleboy/gin-jwt/v2"
auth, _ := jwt.New(&jwt.GinJWTMiddleware{
Realm: "api",
Key: []byte(os.Getenv("JWT_SECRET")),
})
api := r.Group("/api")
api.Use(auth.MiddlewareFunc())
api.POST("/transfer", transferHandler)
```
Learn more: https://shoulder.dev/learn/go/cwe-306/jwt-middleware
Applies to
Languages
Frameworks
gin
Scan for this issue
Detect with Shoulder CLI
npx @shoulderdev/cli trust --rule=go-gin-missing-jwt .