aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlnaz Nizametdinov <i.nizametdinov@gmail.com>2022-06-06 14:52:33 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-06-06 14:52:33 +0300
commit54177ae9aa8e3734fb098d2ad23a17ec7306279a (patch)
tree23f1e9bb07d5b0e0438293a4d2fe89ab975e6141
parent9fb7cf183a555e64fbdf203a26dcd4a973ad383c (diff)
downloadydb-54177ae9aa8e3734fb098d2ad23a17ec7306279a.tar.gz
22-2: Do not allow empty database names KIKIMR-14852
merge from trunk: r9428494 REVIEW: 2526788 x-ydb-stable-ref: ef2db5a690122c8f33db8f31b72bc1f4fdc8a8c7
-rw-r--r--ydb/core/grpc_services/grpc_request_proxy.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/ydb/core/grpc_services/grpc_request_proxy.cpp b/ydb/core/grpc_services/grpc_request_proxy.cpp
index c44c7f8f6d..ead710df28 100644
--- a/ydb/core/grpc_services/grpc_request_proxy.cpp
+++ b/ydb/core/grpc_services/grpc_request_proxy.cpp
@@ -210,6 +210,11 @@ private:
skipCheckConnectRigths = true;
}
}
+ if (databaseName.empty()) {
+ Counters->IncDatabaseUnavailableCounter();
+ requestBaseCtx->ReplyUnauthenticated("Empty database name");
+ return;
+ }
auto it = Databases.find(databaseName);
if (it != Databases.end() && it->second.IsDatabaseReady()) {
database = &it->second;
@@ -320,6 +325,8 @@ void TGRpcRequestProxyImpl::Bootstrap(const TActorContext& ctx) {
InitializeGRpcProxyDbCountersRegistry(ctx.ActorSystem());
RootDatabase = DatabaseFromDomain();
+ Y_VERIFY(!RootDatabase.empty());
+
TDatabaseInfo& database = Databases[RootDatabase];
database.DatabaseType = TDatabaseInfo::TDatabaseType::Root;
database.State = NKikimrTenantPool::EState::TENANT_OK;