Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qneLc-00BXph-J0 for pgsql-hackers@arkaria.postgresql.org; Tue, 03 Oct 2023 12:17:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qneLa-004xgL-Tu for pgsql-hackers@arkaria.postgresql.org; Tue, 03 Oct 2023 12:17:55 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qneLa-004xfY-H7 for pgsql-hackers@lists.postgresql.org; Tue, 03 Oct 2023 12:17:54 +0000 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qneLX-007yLO-VZ for pgsql-hackers@lists.postgresql.org; Tue, 03 Oct 2023 12:17:53 +0000 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-4064876e8b8so8583825e9.0 for ; Tue, 03 Oct 2023 05:17:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696335350; x=1696940150; darn=lists.postgresql.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=KkbdDWuvTFUY+FZeB/4Z/xiJoPPDGwyKnsQ5rVt1bKI=; b=XLXeTYz4xY6OfeAcw7LocmE/lgKUAbJB38yxFbDYz4vhH1HrN1EAXzKhl6HYaEF3Ku ZWdeUCwFRHYtW3WWw6Bs6yRaAZbJqVCnHQMAvCf77ZxoOZlXByaTtYjtJf7686j77D1K ZVr0Ul6TWkEZ09d5qFdF+ykdYPeLXY1STFv0UwBEFUTD0c7CjaSOU4Alcv2bHO7FtwHr LXUpAccxCgKD2ZB7UENpKVVq83xN5Si+jVBZBoknrJEjn9LndHY3l8pBjrNRs3jehh2j AbjzEGprc0KT6esZD/mOhud+3aHQ2j6fBpDFEhcL7em1knZbK7sf4yReRs/lrDzfNy0b it3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696335350; x=1696940150; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=KkbdDWuvTFUY+FZeB/4Z/xiJoPPDGwyKnsQ5rVt1bKI=; b=TKqSLBNBBlaepOYcG/wvSG+5gbPGLjCRv6fUFkxSttkL02oRl/uF0IiuaVN576bpa8 cRB6VXJOrnD0XqLD3jB0sYPyYSKGpI78WYs37oG2C1iEjxiW0XRDbalBKTSDzxnOShJv zeUQqEAl66EUGkWTn4/uzjwImF6n8TtiTtRBQDICfTPS43xDp/cnTJb49KM7IOaUPNPk ywqTcuBGIiORQ/MdlzhXzJRNqqL70946XwWvcclTox2i0oJR7RhIhZg4jDvyiD2snVk2 Xvo50shkz+QOoP25o73RmBJG1jC7q8/J84XLfDtC5BDIzpjBQ7Y6WDoCRqIq1sKRE39F oZFA== X-Gm-Message-State: AOJu0YxN0GHgT1Cf90Vw3cbdaa8v6LFGDxkOnpKwDad+9Wsn/d39jjBo u5wpBcHKGBGkeenVtTqJgR0= X-Google-Smtp-Source: AGHT+IEZ9fYIbYbJPCbt+r3x1G6iIEcXpu8gTOo8Bq1Yh3a4+FdcLQmhQLMFm+y6Ixnu05BVZmyyZw== X-Received: by 2002:a05:600c:21c5:b0:406:45c1:a657 with SMTP id x5-20020a05600c21c500b0040645c1a657mr13196998wmj.6.1696335349835; Tue, 03 Oct 2023 05:15:49 -0700 (PDT) Received: from ?IPV6:2a01:cb11:55e:1700:e4c2:e3d0:6fdc:8db4? ([2a01:cb11:55e:1700:e4c2:e3d0:6fdc:8db4]) by smtp.gmail.com with ESMTPSA id v11-20020a1cf70b000000b004065d67c3c9sm1166556wmh.8.2023.10.03.05.15.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 03 Oct 2023 05:15:49 -0700 (PDT) Message-ID: <73de543e-712b-4468-8ffa-74a686235597@gmail.com> Date: Tue, 3 Oct 2023 14:15:48 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Add a new BGWORKER_BYPASS_ROLELOGINCHECK flag To: Bharath Rupireddy Cc: Michael Paquier , PostgreSQL Hackers References: Content-Language: en-US From: "Drouvot, Bertrand" In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 10/3/23 11:21 AM, Bharath Rupireddy wrote: > On Mon, Oct 2, 2023 at 4:58 PM Drouvot, Bertrand > wrote: >> >> On 9/29/23 8:19 AM, Michael Paquier wrote: >>> On Thu, Sep 28, 2023 at 02:37:02PM +0200, Drouvot, Bertrand wrote: >>>> This patch allows the role provided in BackgroundWorkerInitializeConnection() >>>> and BackgroundWorkerInitializeConnectionByOid() to lack login authorization. >>> >>> Interesting. Yes, there would be use cases for that, I suppose. > > Correct. It allows the roles that don't have LOGIN capabilities to > start and use bg workers. > >>> This may be more adapted with a bits32 for the flags. >> >> Done that way in v2 attached. > > While I like the idea of the flag to skip login checks for bg workers, > I don't quite like the APIs being changes InitializeSessionUserId and > InitPostgres (adding a new input parameter), > BackgroundWorkerInitializeConnection and > BackgroundWorkerInitializeConnectionByOid (changing of input parameter > type) given that all of these functions are available for external > modules and will break things for sure. > > What if BGWORKER_BYPASS_ROLELOGINCHECK be part of bgw_flags? With > this, none of the API needs to be changed, so no compatibility > problems as such for external modules and the InitializeSessionUserId > can just do something like [1]. We might be tempted to add > BGWORKER_BYPASS_ALLOWCONN also to bgw_flags, but I'd prefer not to do > it for the same compatibility reasons. > > Thoughts? > Thanks for looking at it! I did some research and BGWORKER_BYPASS_ALLOWCONN has been added in eed1ce72e1 and at that time the bgw_flags did already exist. In this the related thread [1], Tom mentioned: " We change exported APIs in new major versions all the time. As long as it's just a question of an added parameter, people can deal with it. " And I agree with that. Now, I understand your point but it looks to me that bgw_flags is more about the capabilities (Access to shared memory with BGWORKER_SHMEM_ACCESS or ability to establish database connection with BGWORKER_BACKEND_DATABASE_CONNECTION), While with BGWORKER_BYPASS_ROLELOGINCHECK (and BGWORKER_BYPASS_ALLOWCONN) it's more related to the BGW behavior once the capability is in place. So, I think I'm fine with the current proposal and don't see the need to move BGWORKER_BYPASS_ROLELOGINCHECK in bgw_flags. [1]: https://www.postgresql.org/message-id/22769.1519323861%40sss.pgh.pa.us Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com