-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use github.com/golang-jwt/jwt #1916
Conversation
Because Echo has direct import from Some remarks - Echo middleware is not using
if ok := claims.VerifyAudience("https://mysite.com", false) // false makes check optional
// you code is only affected when it is set to `false` Please see what that vuln actually is: #1663 (comment) Workarounds:
import (
"github.com/golang-jwt/jwt"
)
// ...
// ...
signingKey := []byte("secret")
config := middleware.JWTConfig{
TokenLookup: "query:token",
ParseTokenFunc: func(auth string, c echo.Context) (interface{}, error) {
keyFunc := func(t *jwt.Token) (interface{}, error) {
if t.Method.Alg() != "HS256" {
return nil, fmt.Errorf("unexpected jwt signing method=%v", t.Header["alg"])
}
return signingKey, nil
}
// claims are of type `jwt.MapClaims` when token is created with `jwt.Parse`
token, err := jwt.Parse(auth, keyFunc)
if err != nil {
return nil, err
}
if !token.Valid {
return nil, errors.New("invalid token")
}
return token, nil
},
}
e.Use(middleware.JWTWithConfig(config)) |
@aldas you're right. This will be a breaking change. I might take care of that if there is such need. |
Current plan is to remove fields/methods related to I have done it already in separate branch but time will tell what solution actually lands in |
@aldas, I know, that it echo is not affected, but it can be displayed in various security scans as vulnerable. |
We might think about accepting the breaking change in a minor release due to the indirect vulnerability (we show up as vulnerable because we are using that version) and move to https://github.com/golang-jwt/jwt/releases/tag/v3.2.1 Although developers may need to adjust their code to golang-jwt/jwt this can be considered a good thing, as they are vulnerable too (or show up due to the dependency). So with some documentation we could do a v4.5.0 with a security notice. Not 100% sure though... |
@aldas
(I also saw golang-jwt/jwt/MIGRATION_GUIDE.md.)
Do you know how to resolve this error? |
Any updates? |
done in #1946 |
https://github.com/golang-jwt/jwt/releases/tag/v3.2.1
from release notes:
Import Path Change: See MIGRATION_GUIDE.md for tips on updating your code
Changed the import path from github.com/dgrijalva/jwt-go to github.com/golang-jwt/jwt
Fixed type confusion issue between string and []string in VerifyAudience (#12). This fixes CVE-2020-26160