On self-hosted upgrades the sticky parts are usually TLS and the reverse proxy in front of the app: keep the public URL on https, make sure the proxy forwards the right headers, and re-check that Let’s Encrypt / cert paths still match after the version bump. Also worth confirming the service units or containers for the app and any job workers came back cleanly—upgrade can look fine while websocket or file uploads break behind a stale proxy config.
FIPS-mode Postgres refuses md5 outright, so pin down which layer calls it: a role password re-hash (fix: password_encryption=scram-sha-256, reset the role) or migration SQL. Which step throws it?
Yup. After a bunch of digging, I found found some interesting logs.
Mattermost is doing a bunch of calls similar to this:
CASE
WHEN jsonb_typeof(o.opt->'id') = 'string'
AND o.opt->>'id' <> ''
AND o.idclaim = 1
THEN o.opt->>'id'
ELSE substr(
md5(random()::text ||
clock_timestamp()::text ||
o.fieldid ||
o.ord::text
),
1, 26
)
END
The “md5(random()” is what is failing.
gen_random_uuid()
Would be a much better replacement.
Since we have a support agreement with MM, I sent everything to them and they agreed with the assessment but do not have a fix yet. (Didn’t remember about the support agreement until later unfortunately.)
One detail worth checking before replacing that expression with gen_random_uuid() is the expected ID format.
The current migration takes the first 26 characters of an MD5 hex string, while gen_random_uuid() returns a 36-character UUID with hyphens. If the destination column or application code expects the existing 26-character format, a direct replacement may introduce a different failure.
A possible alternative would be to generate a UUID, remove the hyphens and truncate it to the expected length, assuming that format is actually required. But I’d want to check the column definition, uniqueness constraints and any application-side validation first.
Since Mattermost support has already acknowledged the issue, I’d avoid modifying an applied or pending production migration locally unless they provide an approved workaround. Otherwise a later upgrade could become harder to reconcile.
It might also be worth having the fix covered by a migration test running PostgreSQL with FIPS restrictions enabled. That would catch this class of problem before the next release.
The important part seems to be preserving the ID contract while removing the dependency on MD5.