Delimit query-cache key to prevent collisions

From: Koshino Taiki <koshino(at)sraoss(dot)co(dot)jp>
To: "pgpool-hackers(at)lists(dot)postgresql(dot)org" <pgpool-hackers(at)lists(dot)postgresql(dot)org>
Cc: Emond Papegaaij <emond(dot)papegaaij(at)gmail(dot)com>
Subject: Delimit query-cache key to prevent collisions
Date: 2026-07-21 05:55:47
Message-ID: TY4PR01MB17374DD1C2B89248B8714F84394C22@TY4PR01MB17374.jpnprd01.prod.outlook.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgpool-hackers

I have reviewed the patch(009-encode-key-delimiter) from Emond.
It has also passed all regression tests.

encode_key() constructs the cache key using md5(user || query || database) without delimiters.
This allows different sessions to produce identical keys
(e.g., "admin" + "Q" + "testdb" and "adm" + "Q" + "intestdb"),
leading to data leakage between users/databases.

Changes:
Explicit Delimiters: Insert NUL bytes between the user, query, and database fields in the buffer.
Hash Full Range: Updated the hash function to process the entire byte range (including NUL separators)
instead of stopping at the first NUL byte.

Thank you, Emond.

Taiki Koshino<koshino(at)sraoss(dot)co(dot)jp>
SRA OSS K.K.
TEL: 03-5979-2701 FAX: 03-5979-2702
URL: https://www.sraoss.co.jp/

Attachment Content-Type Size
v1-0001-Delimit-query-cache-key-to-prevent-collisions.patch application/octet-stream 2.8 KB

Responses

Browse pgpool-hackers by date

  From Date Subject
Next Message Koshino Taiki 2026-07-21 05:59:11 Fix unsigned underflow in inject_cached_message
Previous Message Tatsuo Ishii 2026-07-07 22:19:42 Re: Reject sub-minimum ErrorResponse length in read_kind_from_backend.