From 0fde528b96b2f456a900e4c6b1158ef513e68411 Mon Sep 17 00:00:00 2001 From: Vitaly Baranov Date: Thu, 28 Sep 2023 00:45:44 +0200 Subject: [PATCH] Support "S3" database engine while hiding secrets in AST. --- src/Parsers/ASTFunction.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/Parsers/ASTFunction.cpp b/src/Parsers/ASTFunction.cpp index d75862107a8..4314059c219 100644 --- a/src/Parsers/ASTFunction.cpp +++ b/src/Parsers/ASTFunction.cpp @@ -409,6 +409,11 @@ namespace /// PostgreSQL('host:port', 'database', 'user', 'password') findMySQLDatabaseSecretArguments(); } + else if (engine_name == "S3") + { + /// S3('url', 'access_key_id', 'secret_access_key') + findS3DatabaseSecretArguments(); + } } void findMySQLDatabaseSecretArguments() @@ -425,6 +430,20 @@ namespace } } + void findS3DatabaseSecretArguments() + { + if (isNamedCollectionName(0)) + { + /// S3(named_collection, ..., secret_access_key = 'password', ...) + findSecretNamedArgument("secret_access_key", 1); + } + else + { + /// S3('url', 'access_key_id', 'secret_access_key') + markSecretArgument(2); + } + } + void findBackupNameSecretArguments() { const String & engine_name = function.name;