licverifier: fail verify if accountId is missing in license metadata (#10258)

master
Krishnan Parthasarathi 4 years ago committed by GitHub
parent 43e6d1ce2d
commit 4e00b47b52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      pkg/licverifier/verifier.go

@ -64,7 +64,7 @@ func NewLicenseVerifier(pemBytes []byte) (*LicenseVerifier, error) {
// the claim values are invalid. // the claim values are invalid.
func toLicenseInfo(claims jwt.MapClaims) (LicenseInfo, error) { func toLicenseInfo(claims jwt.MapClaims) (LicenseInfo, error) {
accID, ok := claims[accountID].(float64) accID, ok := claims[accountID].(float64)
if ok && accID <= 0 { if !ok || ok && accID <= 0 {
return LicenseInfo{}, errors.New("Invalid accountId in claims") return LicenseInfo{}, errors.New("Invalid accountId in claims")
} }
email, ok := claims[sub].(string) email, ok := claims[sub].(string)

Loading…
Cancel
Save