public inbox for [email protected]  
help / color / mirror / Atom feed
pgsql: Avoid exposing WAL receiver raw conninfo during timeline jumps
6+ messages / 1 participants
[nested] [flat]

* pgsql: Avoid exposing WAL receiver raw conninfo during timeline jumps
@ 2026-05-22 23:18 Michael Paquier <[email protected]>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2026-05-22 23:18 UTC (permalink / raw)
  To: [email protected]

Avoid exposing WAL receiver raw conninfo during timeline jumps

When reusing an existing WAL receiver after it has reached
WALRCV_WAITING for new instructions, RequestXLogStreaming() copied
PrimaryConnInfo into WalRcv->conninfo before switching the state to
WALRCV_RESTARTING.  At that point ready_to_display could still be true,
so pg_stat_wal_receiver could expose the raw connection string,
including sensitive fields, but it should only show the user-displayable
version of the connection string.

WALRCV_RESTARTING does not establish a new connection.  The waiting WAL
receiver reuses its existing connection and only needs a new startpoint
and timeline, so there is no need to copy the raw connection string into
shared memory again.  Let's only copy conninfo when launching a new WAL
receiver after WALRCV_STOPPED, not while waiting for instructions.

This commit adds coverage for the case fixed by this commit to the
timeline-switch test by verifying that the WAL receiver conninfo remains
consistent across the jump.

Backpatch all the way down, as this issue is possible since
pg_stat_wal_receiver has been introduced.

Author: Chao Li <[email protected]>
Reviewed-by: Michael Paquier <[email protected]>
Discussion: https://postgr.es/m/[email protected]
Backpatch-through: 14

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/b903d17927eecab8dd741eb71f04eee5a1182eff

Modified Files
--------------
src/backend/replication/walreceiverfuncs.c | 14 +++++++++-----
src/test/recovery/t/004_timeline_switch.pl | 15 +++++++++++++--
2 files changed, 22 insertions(+), 7 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Avoid exposing WAL receiver raw conninfo during timeline jumps
@ 2026-05-22 23:18 Michael Paquier <[email protected]>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2026-05-22 23:18 UTC (permalink / raw)
  To: [email protected]

Avoid exposing WAL receiver raw conninfo during timeline jumps

When reusing an existing WAL receiver after it has reached
WALRCV_WAITING for new instructions, RequestXLogStreaming() copied
PrimaryConnInfo into WalRcv->conninfo before switching the state to
WALRCV_RESTARTING.  At that point ready_to_display could still be true,
so pg_stat_wal_receiver could expose the raw connection string,
including sensitive fields, but it should only show the user-displayable
version of the connection string.

WALRCV_RESTARTING does not establish a new connection.  The waiting WAL
receiver reuses its existing connection and only needs a new startpoint
and timeline, so there is no need to copy the raw connection string into
shared memory again.  Let's only copy conninfo when launching a new WAL
receiver after WALRCV_STOPPED, not while waiting for instructions.

This commit adds coverage for the case fixed by this commit to the
timeline-switch test by verifying that the WAL receiver conninfo remains
consistent across the jump.

Backpatch all the way down, as this issue is possible since
pg_stat_wal_receiver has been introduced.

Author: Chao Li <[email protected]>
Reviewed-by: Michael Paquier <[email protected]>
Discussion: https://postgr.es/m/[email protected]
Backpatch-through: 14

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/e18b77153c740122a0eadde39ebfd5899156143e

Modified Files
--------------
src/backend/replication/walreceiverfuncs.c | 14 +++++++++-----
src/test/recovery/t/004_timeline_switch.pl | 17 ++++++++++++++---
2 files changed, 23 insertions(+), 8 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Avoid exposing WAL receiver raw conninfo during timeline jumps
@ 2026-05-22 23:18 Michael Paquier <[email protected]>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2026-05-22 23:18 UTC (permalink / raw)
  To: [email protected]

Avoid exposing WAL receiver raw conninfo during timeline jumps

When reusing an existing WAL receiver after it has reached
WALRCV_WAITING for new instructions, RequestXLogStreaming() copied
PrimaryConnInfo into WalRcv->conninfo before switching the state to
WALRCV_RESTARTING.  At that point ready_to_display could still be true,
so pg_stat_wal_receiver could expose the raw connection string,
including sensitive fields, but it should only show the user-displayable
version of the connection string.

WALRCV_RESTARTING does not establish a new connection.  The waiting WAL
receiver reuses its existing connection and only needs a new startpoint
and timeline, so there is no need to copy the raw connection string into
shared memory again.  Let's only copy conninfo when launching a new WAL
receiver after WALRCV_STOPPED, not while waiting for instructions.

This commit adds coverage for the case fixed by this commit to the
timeline-switch test by verifying that the WAL receiver conninfo remains
consistent across the jump.

Backpatch all the way down, as this issue is possible since
pg_stat_wal_receiver has been introduced.

Author: Chao Li <[email protected]>
Reviewed-by: Michael Paquier <[email protected]>
Discussion: https://postgr.es/m/[email protected]
Backpatch-through: 14

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/c37b38806a1f7269a25caa9d90d67bf2da363842

Modified Files
--------------
src/backend/replication/walreceiverfuncs.c | 14 +++++++++-----
src/test/recovery/t/004_timeline_switch.pl | 15 +++++++++++++--
2 files changed, 22 insertions(+), 7 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Avoid exposing WAL receiver raw conninfo during timeline jumps
@ 2026-05-22 23:18 Michael Paquier <[email protected]>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2026-05-22 23:18 UTC (permalink / raw)
  To: [email protected]

Avoid exposing WAL receiver raw conninfo during timeline jumps

When reusing an existing WAL receiver after it has reached
WALRCV_WAITING for new instructions, RequestXLogStreaming() copied
PrimaryConnInfo into WalRcv->conninfo before switching the state to
WALRCV_RESTARTING.  At that point ready_to_display could still be true,
so pg_stat_wal_receiver could expose the raw connection string,
including sensitive fields, but it should only show the user-displayable
version of the connection string.

WALRCV_RESTARTING does not establish a new connection.  The waiting WAL
receiver reuses its existing connection and only needs a new startpoint
and timeline, so there is no need to copy the raw connection string into
shared memory again.  Let's only copy conninfo when launching a new WAL
receiver after WALRCV_STOPPED, not while waiting for instructions.

This commit adds coverage for the case fixed by this commit to the
timeline-switch test by verifying that the WAL receiver conninfo remains
consistent across the jump.

Backpatch all the way down, as this issue is possible since
pg_stat_wal_receiver has been introduced.

Author: Chao Li <[email protected]>
Reviewed-by: Michael Paquier <[email protected]>
Discussion: https://postgr.es/m/[email protected]
Backpatch-through: 14

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/065cbfb883a06b5e32535b34eedbb8823782070d

Modified Files
--------------
src/backend/replication/walreceiverfuncs.c | 14 +++++++++-----
src/test/recovery/t/004_timeline_switch.pl | 15 +++++++++++++--
2 files changed, 22 insertions(+), 7 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Avoid exposing WAL receiver raw conninfo during timeline jumps
@ 2026-05-22 23:18 Michael Paquier <[email protected]>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2026-05-22 23:18 UTC (permalink / raw)
  To: [email protected]

Avoid exposing WAL receiver raw conninfo during timeline jumps

When reusing an existing WAL receiver after it has reached
WALRCV_WAITING for new instructions, RequestXLogStreaming() copied
PrimaryConnInfo into WalRcv->conninfo before switching the state to
WALRCV_RESTARTING.  At that point ready_to_display could still be true,
so pg_stat_wal_receiver could expose the raw connection string,
including sensitive fields, but it should only show the user-displayable
version of the connection string.

WALRCV_RESTARTING does not establish a new connection.  The waiting WAL
receiver reuses its existing connection and only needs a new startpoint
and timeline, so there is no need to copy the raw connection string into
shared memory again.  Let's only copy conninfo when launching a new WAL
receiver after WALRCV_STOPPED, not while waiting for instructions.

This commit adds coverage for the case fixed by this commit to the
timeline-switch test by verifying that the WAL receiver conninfo remains
consistent across the jump.

Backpatch all the way down, as this issue is possible since
pg_stat_wal_receiver has been introduced.

Author: Chao Li <[email protected]>
Reviewed-by: Michael Paquier <[email protected]>
Discussion: https://postgr.es/m/[email protected]
Backpatch-through: 14

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/e037a4199617a678ebeb68d2ba722c5ed1cfeb6f

Modified Files
--------------
src/backend/replication/walreceiverfuncs.c | 14 +++++++++-----
src/test/recovery/t/004_timeline_switch.pl | 15 +++++++++++++--
2 files changed, 22 insertions(+), 7 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Avoid exposing WAL receiver raw conninfo during timeline jumps
@ 2026-05-22 23:18 Michael Paquier <[email protected]>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2026-05-22 23:18 UTC (permalink / raw)
  To: [email protected]

Avoid exposing WAL receiver raw conninfo during timeline jumps

When reusing an existing WAL receiver after it has reached
WALRCV_WAITING for new instructions, RequestXLogStreaming() copied
PrimaryConnInfo into WalRcv->conninfo before switching the state to
WALRCV_RESTARTING.  At that point ready_to_display could still be true,
so pg_stat_wal_receiver could expose the raw connection string,
including sensitive fields, but it should only show the user-displayable
version of the connection string.

WALRCV_RESTARTING does not establish a new connection.  The waiting WAL
receiver reuses its existing connection and only needs a new startpoint
and timeline, so there is no need to copy the raw connection string into
shared memory again.  Let's only copy conninfo when launching a new WAL
receiver after WALRCV_STOPPED, not while waiting for instructions.

This commit adds coverage for the case fixed by this commit to the
timeline-switch test by verifying that the WAL receiver conninfo remains
consistent across the jump.

Backpatch all the way down, as this issue is possible since
pg_stat_wal_receiver has been introduced.

Author: Chao Li <[email protected]>
Reviewed-by: Michael Paquier <[email protected]>
Discussion: https://postgr.es/m/[email protected]
Backpatch-through: 14

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/c89499a79898c20907308a009000a8967c8c272c

Modified Files
--------------
src/backend/replication/walreceiverfuncs.c | 14 +++++++++-----
src/test/recovery/t/004_timeline_switch.pl | 15 +++++++++++++--
2 files changed, 22 insertions(+), 7 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2026-05-22 23:18 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-05-22 23:18 pgsql: Avoid exposing WAL receiver raw conninfo during timeline jumps Michael Paquier <[email protected]>
2026-05-22 23:18 pgsql: Avoid exposing WAL receiver raw conninfo during timeline jumps Michael Paquier <[email protected]>
2026-05-22 23:18 pgsql: Avoid exposing WAL receiver raw conninfo during timeline jumps Michael Paquier <[email protected]>
2026-05-22 23:18 pgsql: Avoid exposing WAL receiver raw conninfo during timeline jumps Michael Paquier <[email protected]>
2026-05-22 23:18 pgsql: Avoid exposing WAL receiver raw conninfo during timeline jumps Michael Paquier <[email protected]>
2026-05-22 23:18 pgsql: Avoid exposing WAL receiver raw conninfo during timeline jumps Michael Paquier <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox