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

This commit is contained in:
Krishnan Parthasarathi 2020-08-13 17:05:24 -07:00 committed by GitHub
parent 43e6d1ce2d
commit 4e00b47b52
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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