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.96) (envelope-from ) id 1vrvtG-00Dc8U-0x for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Feb 2026 10:31:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vrvsF-001NrF-2A for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Feb 2026 10:30:39 +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.96) (envelope-from ) id 1vrvsF-001Nqw-0o for pgsql-hackers@lists.postgresql.org; Mon, 16 Feb 2026 10:30:39 +0000 Received: from mail-ej1-x629.google.com ([2a00:1450:4864:20::629]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vrvsC-00000000s8T-2wzw for pgsql-hackers@lists.postgresql.org; Mon, 16 Feb 2026 10:30:38 +0000 Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-b8f992167dcso361399666b.1 for ; Mon, 16 Feb 2026 02:30:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1771237836; cv=none; d=google.com; s=arc-20240605; b=Be+gu676wc411e49DHnBBr4UtwEsZsMNItii/NH4ehDk4A4OW7cgC5/o79auztm6NK 4WsrAzb3vUyvBYFxtlf/wMUAp49ziVG7B/WDRL4y3qOAiE7Cos4t1AWzR2D8LL0ispRU GVj9ZDJPEC22T/d9/jQoFs69wOqH0m8sDxXfbcx1b7TYlUIOK2dIIeY8NbL6Q/2Crv7g dY4ZNbRPKRcUWXNMng9I2X9IZu9OaiZ6IZKxFxZRop4Z/hNU48761JOS+yWq8WH2PCMs zo7JgfTUC/+2exGj5bYWaI0Z+S/deaaEnPXIu2wsQJXb2OrJJGy0og4HKaNrF4/rf7SD bppg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=7rkVp6pqAUVoFL0GYAHMTq+BMDSPsDExm/7EwHKjgAM=; fh=Z7UPG/RaN8/9NQ8mjDcc4u5QPxMydS2xFTACLGCiRv4=; b=OHLUto4fe3rpFfb/9SenbbkrXAPBXdnSDfdoIKwuWnkXvoGScGq+vYvPIrIoul+RFO /WGcKVFGO3yYQZbovcVbrMbLPgB7oNbg2RKgq5ISP2+Wy4TFGl1BYsdKhDO98ZydhgLP Ju1GebQm3vfswVoQRQNw/ft9j5cWuoPkC7v1gHYNLGDloTxDuKCaM5g2Blw7hvrbnola tlCb7RMJEsT1tEtkgAygSJvquNeCrdB5vFGhVIfi9IA7m8E+iMEe9D/zk6TKzflEmc5p oWsrSv4SzGI6CZxYvnpWndpAPg+H3acA6O2elGACp8k2Bsl+Amkd109qeL5ZW6MkR3eK 9KAA==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771237836; x=1771842636; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=7rkVp6pqAUVoFL0GYAHMTq+BMDSPsDExm/7EwHKjgAM=; b=SK5K+UCW3+Uu4flsNfFozcFJMcpUwoknou4FUKVwHztSHpn/2PrV5gHveAqlbmtngX +PJwBI+w5cf89ZD92XP+VHCiDKTklSm2RBLbD0y6naLZMJBusQdethyHTzNaR3+si8g4 NKdcMGlHKSW3eODL2/fNlzcuSUd8Ik8P/VSpBBYEVNhZM7ce0V9boijQjZ/UTny6fZgz RZ3m8YvELe6F8lnom2BtCsINGC5kOYBUqPvzx/TUTKQMGPCmd7X6KmV8t0m9oHJGwya0 DOfZ1USBIM5W5luznIbMdKsPp0IM9HidL7jpACrzZ4vaRo/VJuk2YM8jieMA6knKUOo7 upWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771237836; x=1771842636; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=7rkVp6pqAUVoFL0GYAHMTq+BMDSPsDExm/7EwHKjgAM=; b=pb3Fu7bO8Xu87+U/U6HLH+fndfPNy9pIJGGIliwjGAP8iJdri++gmiZs/6P4ObpoqX QW/mzSwhtgyARkeQdwkXp9+R2YnjlHjKnup0naI6Ws8fILkrKN0UaEMcPsUN5wnxZ97u 2CrDzo1FVfrslzDmAJ093g0iaSQzqIyh/jk8mzcjIBOqoddo5MCeXhb58zXSfK3/4jF2 FQ7ymWP28J2PJ0jRBjXilTNETt/GRBQ7DJYfosueieZ3AtLENE4YL+UgpD5yvLbzEG64 f/dQ2v6Oei2gaFEexuLBXGL3MTD7Te/6EgYB699/CBvsrRidz2nbUn/300w3whJHq9pU hCVg== X-Gm-Message-State: AOJu0Yx9PH2sJPXccHHnCiIPBi91Phh//HAspd1WQybpOEoVz4lD3w9r JqtHBRpggB33UG9mMp6R8wOWd3pJWQFLdcQ8aZtn+vTYKA6tEpWWZ7c8PkTm0SR70LfzbfwKHOC 7T3UkevNXL5Erl2GsC7HwC9jKdZEVEsYX24ZY X-Gm-Gg: AZuq6aJjyRJPLuy5n8lJHXpMxiNhp5mFwVAQpRyeqK43fbbWOWdmMyctGrt0bv3ixZd 8AotEfqnikytC2kvaSQHYYZ+ctukw3S3TbeB2M2xgp5C7TfHILvY+/Kizx0yUabiqTz0ZprEgFg sii5n7QWJr/ezFHS6pwLcxVz7dCuhC9+Y6JSQiGk8DvO2k/qKg3boB5ZF7WZObX38WkAbAGGB/P WbY64JIUZpWvEBqOQtV5ASLfG7oQojYhyIUPzQO6i6DH51ssk5mRvWvEdeQw3wGlV7ezWmr0Wrn +gNdFss= X-Received: by 2002:a17:907:2686:b0:b8e:7dcb:7f1b with SMTP id a640c23a62f3a-b8fb42200eemr533730566b.21.1771237835600; Mon, 16 Feb 2026 02:30:35 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: VASUKI M Date: Mon, 16 Feb 2026 16:00:45 +0530 X-Gm-Features: AaiRm51WCXCPg3hkmCtpcEL7YnsvNdjn6q7u4vBxK5WOvmCwHnu4ggIKQGjSJa4 Message-ID: Subject: Re: [OAuth2] Infrastructure for tracking token expiry time To: Ajit Awekar Cc: PostgreSQL Hackers Content-Type: multipart/alternative; boundary="00000000000000f8b5064aee725b" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000000f8b5064aee725b Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Feb 16, 2026 at 3:44=E2=80=AFPM Ajit Awekar wrote: > Hi Hackers, > > Currently, during OAuth2 authentication, the ValidatorModuleResult > structure allows a validator(extension) to return the authentication stat= us > and the authn_id. > However, we ignore the token expiry time (exp claim). > > Once a token is validated, the backend has no record of when that token > actually expires. A session can remain open indefinitely even if the > underlying access token has expired shortly after the connection was > established. > > This patch adds the infrastructure to capture and store this expiration > timestamp within the backend session state. It does not implement an > enforcement policy (such as auto-termination). > Hi Ajit, Thanks for working on this. Storing the token expiry in the backend session state makes sense as groundwork for future enforcement. I had a couple of questions while reading the patch. First, is Port always zero-initialized? If not, we might want to explicitly initialize the new expiry field to a known value. Right now it looks like we=E2=80=99re relying on zero to mean =E2=80=9Cnot provided=E2=80=9D, but s= ince TimestampTz value 0 is a valid timestamp (Postgres epoch), I=E2=80=99m wondering whether it wou= ld be clearer to use an explicit invalid/sentinel value instead. Also, in the case where the validator returns an expiry that is already in the past, should we reject the authentication immediately? Or is that expected to be fully handled inside the validator module? Finally, do you have a particular enforcement model in mind for follow-up work (e.g., check at statement start, transaction boundaries, or via some timeout mechanism)? It would help to understand how you see this being used= . The change itself looks straightforward, just trying to clarify the intended semantics. Best regards, Vasuki M C-DAC,Chennai. --00000000000000f8b5064aee725b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Mon, Feb 16, 2026 at 3:44=E2=80= =AFPM Ajit Awekar <ajitpostgre= s@gmail.com> wrote:
Hi Hackers,

Currently, during OAuth2 authentication, =C2=A0the V= alidatorModuleResult structure allows a validator(extension) to return the = authentication status and the authn_id.
However, we ignore the token exp= iry time (exp claim).

Once a token is validated, the backend has no= record of when that token actually expires. A session can remain open inde= finitely even if the underlying access token has expired shortly after the = connection was established.

This patch adds the infrastructure to ca= pture and store this expiration timestamp within the backend session state.= It does not implement an enforcement policy (such as auto-termination).

Hi Ajit,

Thanks for working= on this. Storing the token expiry in the backend session state makes sense= as groundwork for future enforcement.

I had a couple of questions w= hile reading the patch.

First, is Port always zero-initialized? If n= ot, we might want to explicitly initialize the new expiry field to a known = value. Right now it looks like we=E2=80=99re relying on zero to mean =E2=80= =9Cnot provided=E2=80=9D, but since TimestampTz value 0 is a valid timestam= p (Postgres epoch), I=E2=80=99m wondering whether it would be clearer to us= e an explicit invalid/sentinel value instead.

Also, in the case wher= e the validator returns an expiry that is already in the past, should we re= ject the authentication immediately? Or is that expected to be fully handle= d inside the validator module?

Finally, do you have a particular enf= orcement model in mind for follow-up work (e.g., check at statement start, = transaction boundaries, or via some timeout mechanism)? It would help to un= derstand how you see this being used.

The change itself looks straig= htforward, just trying to clarify the intended semantics.

Best regar= ds,
Vasuki M
C-DAC,Chennai.=C2=A0
--00000000000000f8b5064aee725b--