bug fixes (#918)

* bug fixes

* fix for backward compatibility

* fix init

* cleanup

* possible fix

* optimize permission check

* Revert "possible fix"

This reverts commit 003f1bbb2aa368aade6702e6019922b7f4871a39.
This commit is contained in:
UUBulb
2024-12-26 23:38:40 +08:00
committed by GitHub
parent b876909a8a
commit 85818c2630
5 changed files with 16 additions and 10 deletions

View File

@@ -38,7 +38,7 @@ func (a *authHandler) Check(ctx context.Context) (uint64, error) {
singleton.UserLock.RLock()
userId, ok := singleton.AgentSecretToUserId[clientSecret]
if !ok && clientSecret != singleton.Conf.AgentSecretKey {
if !ok {
singleton.UserLock.RUnlock()
model.BlockIP(singleton.DB, ip, model.WAFBlockReasonTypeAgentAuthFail, model.BlockIDgRPC)
return 0, status.Error(codes.Unauthenticated, "客户端认证失败")