Преглед на файлове

auth: nil check AuthInfo when checking admin permissions

If the context does not include auth information, get authinfo will
return a nil auth info and a nil error. This is then passed to
IsAdminPermitted, which would dereference the nil auth info.
Anthony Romano преди 9 години
родител
ревизия
52bc997e0b
променени са 1 файла, в които са добавени 3 реда и са изтрити 0 реда
  1. 3 0
      auth/store.go

+ 3 - 0
auth/store.go

@@ -744,6 +744,9 @@ func (as *authStore) IsAdminPermitted(authInfo *AuthInfo) error {
 	if !as.isAuthEnabled() {
 	if !as.isAuthEnabled() {
 		return nil
 		return nil
 	}
 	}
+	if authInfo == nil {
+		return ErrUserEmpty
+	}
 
 
 	tx := as.be.BatchTx()
 	tx := as.be.BatchTx()
 	tx.Lock()
 	tx.Lock()