PostgreSQL 14 support is ending; the real risk is not upgrade day but the next password change
The final PostgreSQL 14 release arrives on November 12. Even if the upgrade goes smoothly, older Java services may fail to log in at the next password change.
The final PostgreSQL 14 release arrives on November 12, and no security fixes will follow it. In most of the teams I talk to, the upgrade sits on a list as a pending item. Their concerns are usually about the data: how pg_upgrade will behave, whether extensions are compatible, and how long the downtime will last.
The problem I think deserves more attention is smaller and shows up later. It is not on upgrade day. It is a login failure a few weeks afterward, when someone changes an application's database password.
What changed in PostgreSQL 14
With PostgreSQL 14, the default for the password_encryption setting changed from md5 to scram-sha-256. Unless you change this setting manually, every newly created password is stored as a SCRAM verifier.
The sneaky part is here. pg_upgrade keeps existing MD5 hashes exactly as they are. So when you upgrade a server from 12 or 13 to 14 (or directly to 18), applications reconnect, everything looks green, and the ticket gets closed.
A few weeks later, when the password of the application's database user is rotated, the new password is saved as SCRAM. A Java service that has worked without problems for years starts failing with this error:
The error message contains "authentication type 10 is not supported". Type 10 is the code for SCRAM authentication, and the driver does not support this method.
Migrating with dump and restore does not solve this problem. pg_dumpall --globals-only also carries MD5 hashes over as they are, so the situation stays the same. The problem only shows up on day one if you create the roles manually on the new server, because then every password is set fresh.
Which pgjdbc versions can log in
pgjdbc added SCRAM-SHA-256 support in version 42.2.0, but only in Java 8 and later builds. However, 42.2.0 shipped with a known problem: the SCRAM client classes were not included in the package, so the feature did not really work. The issue was fixed a week later in 42.2.1.
So the lower bound is 42.2.1. In addition, builds whose names end in .jre6 or .jre7 do not support SCRAM in any version. People often get this wrong here: a 42.2.x.jre7 jar looks newer than 42.2.1 by version number, but it still cannot log in.
The same change affects other clients too. The minimum versions I checked were taken from each client's own changelog or source code:
- On the Go side,
lib/pq1.1.0 andpgx3.4.0 - On the Node side,
pg7.9.0 - On the .NET side, Npgsql 3.2.7
- For everything built on libpq, libpq 10
- For PgBouncer, 1.11; if you look up passwords with
auth_queryor keep SCRAM secrets inauth_file, 1.14
How to check before upgrading
All of the checks below are read-only and do not write anything to the system.
First, find the PostgreSQL 14 servers in your cluster. If you use Kubernetes, listing the pod images and filtering by version number is enough. If an operator manages the database (such as CloudNativePG, Crunchy, or Zalando), you also need to check the image information in the operator's cluster resource.
Next, look at how the password of every role that can log in is currently stored. To do this as a superuser, you can check the value of password_encryption and the prefix of the rolpassword field in the pg_authid table. Any row starting with md5 is a record that will turn into SCRAM on the next password reset. Pulling this list once quickly shows which services are at risk.
The third step is to find out which driver each Java service actually carries. A version number in the pom file from two years ago can be misleading; what matters is the jar inside the running image. Searching for postgresql-*.jar inside the pod clears this up. Any version below 42.2.1, or any version with .jre6 or .jre7 in its name, should be updated before the upgrade, not after the first failed password change.
Why this is worth an hour this week
The support end date is a visible deadline. This error is not visible: the upgrade succeeds, the dashboards stay green, and the problem stays hidden until the day a password is rotated. And that is usually not a day anyone is thinking about the upgrade.
The check takes three queries and a few commands. Trying to find this problem during an incident takes much longer.
Key takeaways
- With PostgreSQL 14, the default password encryption changed from MD5 to SCRAM-SHA-256, but
pg_upgradekeeps existing MD5 hashes. - The problem does not show up right after the upgrade; when a password changes, a new SCRAM record is created and older drivers cannot connect.
- For pgjdbc, the lower bound is 42.2.1;
.jre6and.jre7builds do not support SCRAM in any version. - Other clients such as Go, Node, .NET, libpq, and PgBouncer also have their own minimum versions and should be checked.
- By reading the
rolpasswordprefix per role, you can see read-only which accounts still have MD5 passwords.
When to use this
If you are planning a move from PostgreSQL 14 to 18 or to another version, run these checks as the first step of the upgrade. If you are migrating with dump and restore, or creating roles manually on the new server, knowing the state of your passwords and your Java driver versions in advance matters even more. If the application teams and the database teams are not the same people, sending this list to both sides often prevents the outage that would otherwise hit during the first password rotation.
Comments (0)
No comments yet; be the first.
Leave a comment