Skip to content

Commit 3d6e9c0

Browse files
utkarash2991mmlb
authored andcommitted
fix: Add wal2json to output_plugin_libraries
PG 15.19/17.11 introduces output_plugin_libraries (CVE-2026-6471) defaulting to pgoutput and test_decoding only, which breaks wal2json slots (Realtime, CI wal2json tests). Allow wal2json in the shared config, but comment it out for orioledb builds (17.9 base, GUC absent, unknown parameter is fatal at startup).
1 parent 15d327e commit 3d6e9c0

9 files changed

Lines changed: 33 additions & 1 deletion

File tree

‎Dockerfile-orioledb-17‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,10 @@ RUN sed -i \
150150
chown -R postgres:postgres /etc/postgresql-custom
151151

152152
# Remove timescaledb, plv8, postgis, pgrouting references (not available in orioledb build)
153+
# and output_plugin_libraries (GUC does not exist before PG 17.11; orioledb is on an older base)
153154
RUN sed -i 's/ timescaledb,//g;' "/etc/postgresql/postgresql.conf" && \
154155
sed -i 's/db_user_namespace = off/#db_user_namespace = off/g;' "/etc/postgresql/postgresql.conf" && \
156+
sed -i 's/^output_plugin_libraries/#output_plugin_libraries/g;' "/etc/postgresql/postgresql.conf" && \
155157
sed -i 's/ timescaledb,//g; s/ plv8,//g; s/ postgis,//g; s/ pgrouting,//g' "/etc/postgresql-custom/supautils.conf"
156158

157159
# OrioleDB configuration

‎ansible/files/postgresql_config/postgresql.conf.j2‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,9 @@ shared_buffers = 128MB # min 128kB
204204

205205
wal_level = logical # minimal, replica, or logical
206206
# (change requires restart)
207+
output_plugin_libraries = 'pgoutput, test_decoding, wal2json' # allowlist of logical decoding
208+
# output plugins (PG 15.19 / 17.11+); wal2json is
209+
# required by Realtime and shipped in the image
207210
#fsync = on # flush data to disk for crash safety
208211
# (turning this off can cause
209212
# unrecoverable data corruption)

‎ansible/tasks/stage2-setup-postgres.yml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@
3636
when: stage2 and is_psql_oriole
3737
become: true
3838
block:
39+
- name: Comment out output_plugin_libraries if orioledb build (GUC does not exist before PG 17.11)
40+
ansible.builtin.replace:
41+
path: '/etc/postgresql/postgresql.conf'
42+
regexp: '^output_plugin_libraries'
43+
replace: '#output_plugin_libraries'
44+
3945
- name: Append orioledb to shared_preload_libraries append within closing quote
4046
ansible.builtin.replace:
4147
path: '/etc/postgresql/postgresql.conf'

‎docker/pgctld/postgresql.conf.tmpl‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ max_parallel_maintenance_workers = {{.MaxParallelMaintenanceWorkers}} # taken fr
8383

8484
wal_level = logical # minimal, replica, or logical
8585
# (change requires restart)
86+
output_plugin_libraries = 'pgoutput, test_decoding, wal2json' # allowlist of logical decoding
87+
# output plugins (PG 15.19 / 17.11+)
8688
wal_buffers = {{.WalBuffers}} # min 32kB, -1 sets based on shared_buffers
8789
# (change requires restart)
8890
min_wal_size = {{.MinWalSize}}

‎nix/checks.nix‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,10 @@
411411
# Add orioledb to shared_preload_libraries
412412
perl -pi -e "s/(shared_preload_libraries = ')/\$1orioledb, /" "$PGTAP_CLUSTER/postgresql.conf"
413413
log info "OrioleDB added to shared_preload_libraries"
414+
else
415+
# PG 15.19 / 17.11+: allowlist wal2json for logical decoding (GUC does not
416+
# exist on the orioledb 17.9 base, hence the else branch)
417+
echo "output_plugin_libraries = 'pgoutput, test_decoding, wal2json'" >> "$PGTAP_CLUSTER"/postgresql.conf
414418
fi
415419
416420
# Check if postgresql.conf exists

‎nix/ext/tests/default.nix‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,11 @@ let
155155
self.packages.${pkgs.pkgsLinux.stdenv.hostPlatform.system}.postgresql_orioledb-17
156156
);
157157
settings = lib.mkForce (
158-
((installedExtension "17").defaultSettings or { })
158+
# output_plugin_libraries does not exist before PG 17.11; orioledb is on an
159+
# older base, so strip it from any extension's defaultSettings (e.g. wal2json)
160+
(removeAttrs ((installedExtension "17").defaultSettings or { }) [
161+
"output_plugin_libraries"
162+
])
159163
// {
160164
jit = "off";
161165
shared_preload_libraries = [

‎nix/ext/tests/lib.nix‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ let
115115
${
116116
if majorVersion == "orioledb-17" then
117117
''
118+
# OrioleDB: comment out output_plugin_libraries (GUC does not exist before PG 17.11;
119+
# orioledb line is on a 17.9 base and would fail to start on an unknown parameter)
120+
sed -i 's/^output_plugin_libraries/#output_plugin_libraries/' $out/postgresql.conf
118121
# OrioleDB: also remove pgjwt from supautils privileged_extensions
119122
sed -i 's/ pgjwt,//g;' $out/supautils.conf
120123
# OrioleDB: append orioledb to shared_preload_libraries

‎nix/ext/wal2json.nix‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ pkgs.buildEnv {
116116
"multi-" + lib.concatStringsSep "-" (map (v: lib.replaceStrings [ "." ] [ "-" ] v) versions);
117117
defaultSettings = {
118118
wal_level = "logical";
119+
# PG 15.19 / 17.11+ only load output plugins named here (CVE-2026-6471);
120+
# stripped for the orioledb specialisation in nix/ext/tests/default.nix
121+
# (GUC does not exist on orioledb's older base)
122+
output_plugin_libraries = "pgoutput, test_decoding, wal2json";
119123
};
120124
};
121125
}

‎nix/tools/run-server.sh.in‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,8 @@ orioledb_config_items() {
254254
sed -i 's/ timescaledb,//g;' "$DATDIR/postgresql.conf"
255255
sed -i 's/db_user_namespace = off/#db_user_namespace = off/g;' "$DATDIR/postgresql.conf"
256256
sed -i 's/ timescaledb,//g; s/ plv8,//g; s/ pgjwt,//g;' "$DATDIR/supautils.conf"
257+
# output_plugin_libraries does not exist before PG 17.11 (orioledb is on an older base)
258+
sed -i 's/^output_plugin_libraries/#output_plugin_libraries/g;' "$DATDIR/postgresql.conf"
257259
sed -i 's/\(shared_preload_libraries.*\)'\''\(.*\)$/\1, orioledb'\''\2/' "$DATDIR/postgresql.conf"
258260
echo "default_table_access_method = 'orioledb'" >> "$DATDIR/postgresql.conf"
259261
elif [[ "$1" = "orioledb-17" && "$CURRENT_SYSTEM" = "aarch64-darwin" ]]; then
@@ -264,6 +266,8 @@ orioledb_config_items() {
264266
# Use perl instead of sed for macOS
265267
perl -pi -e 's/ timescaledb,//g' "$DATDIR/postgresql.conf"
266268
perl -pi -e 's/db_user_namespace = off/#db_user_namespace = off/g' "$DATDIR/postgresql.conf"
269+
# output_plugin_libraries does not exist before PG 17.11 (orioledb is on an older base)
270+
perl -pi -e 's/^output_plugin_libraries/#output_plugin_libraries/' "$DATDIR/postgresql.conf"
267271

268272
perl -pi -e 's/ timescaledb,//g' "$DATDIR/supautils.conf"
269273
perl -pi -e 's/ plv8,//g' "$DATDIR/supautils.conf"

0 commit comments

Comments
 (0)