Re: Fix bug with accessing to temporary tables of other sessions
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jim Jones <jim.jones@uni-muenster.de>
Cc: Soumya S Murali <soumyamurali.work@gmail.com>,
Daniil Davydov <3danissimo@gmail.com>,
Stepan Neretin <slpmcf@gmail.com>,
PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2026-03-23T13:44:06Z
Lists: pgsql-hackers
Jim Jones <jim.jones@uni-muenster.de> writes: > This is a step forward in really isolating contents of temp tables from > other sessions, but the more I think about it, the more I'm concerned > with the current approach -- I spent some time investigating this > problem a bit deeper last week. Yeah. I think this entire approach is wrongheaded: we do not enforce permissions checks against superusers. Moreover, if we try to fix it at the permissions level, it seems nearly certain that there will be bypass paths, simply because superusers bypass so many other checks. The actual problem is that the buffer manager is incapable of dealing with other sessions' temp tables, and we need to un-break the buffer manager's defense for that implementation restriction. So I feel the correct approach is something similar to what I described here: https://www.postgresql.org/message-id/flat/2736425.1758475979%40sss.pgh.pa.us I'm not wedded to that specific patch, but that is the implementation level where the fix is needed. regards, tom lane
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Prevent access to other sessions' temp tables
- 4dfae59a1d31 17 (unreleased) landed
- 1b0dd08157bf 18 (unreleased) landed
- ce146621f786 19 (unreleased) landed
-
Add tests for cross-session temp table access
- 40927d458fe1 17 (unreleased) landed
- 1cd37a7a8dc6 18 (unreleased) landed
- 1fee0e857e33 19 (unreleased) landed
-
Doc: use "an SQL" consistently rather than "a SQL"
- b51f86e49a7f 18.0 cited
-
Modify the relcache to record the temp status of both local and nonlocal
- 948d6ec90fd3 8.4.0 cited