mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-20 02:56:10 +00:00
861f6ba789
The plugin SQL guard was the only thing between a plugin and TREK's tables on Postgres, and two gaps in it were enough to leave the plugin schema. Two layers now hold even when the guard is fooled. A plugin write with no bound args went over the simple query protocol, which runs every statement in its text. Plugin statements now go through extendedQuery, which pg sends over the extended protocol whatever the args, so a second statement is a syntax error instead of a statement that runs. A marker parameter carries the request to the pool's clients, and a client without the hook binds one value too many, so it fails closed. pg_temp is searched before the search_path unless the path names it, and a temporary table lives as long as its pooled connection, so one left behind would stand in for users, sessions and every other table for the next caller. Every connection of TREK's pool now puts pg_temp last on the search_path the role configured, and a plugin transaction sets its schema with pg_temp last.