Skip to content
pgextwlist

pgextwlist

pgextwlist : PostgreSQL Extension Whitelisting

Overview

ID Extension Package Version Category License Language
7390
pgextwlist
pgextwlist
1.20
SEC
PostgreSQL
C
Attribute Has Binary Has Library Need Load Has DDL Relocatable Trusted
--sL---
No
Yes
Yes
No
no
no
Relationships
See Also
ddlx
pgdd
pg_permissions
adminpack
pgaudit
set_user
pg_catcheck
noset

Packages

Type Repo Version PG Major Compatibility Package Pattern Dependencies
EXT
PGDG
1.20
18
17
16
15
14
pgextwlist -
RPM
PGDG
1.20
18
17
16
15
14
pgextwlist_$v -
DEB
PGDG
1.20
18
17
16
15
14
postgresql-$v-pgextwlist -
Linux / PG PG18 PG17 PG16 PG15 PG14
el8.x86_64
PGDG 1.20
PGDG 1.20
PGDG 1.20
PGDG 1.20
PGDG 1.20
el8.aarch64
PGDG 1.20
PGDG 1.20
PGDG 1.20
PGDG 1.20
PGDG 1.20
el9.x86_64
PGDG 1.20
PGDG 1.20
PGDG 1.20
PGDG 1.20
PGDG 1.20
el9.aarch64
PGDG 1.20
PGDG 1.20
PGDG 1.20
PGDG 1.20
PGDG 1.20
el10.x86_64
PGDG 1.20
PGDG 1.20
PGDG 1.20
PGDG 1.20
PGDG 1.20
el10.aarch64
PGDG 1.20
PGDG 1.20
PGDG 1.20
PGDG 1.20
PGDG 1.20
d12.x86_64
PGDG 1.20
PGDG 1.20
PGDG 1.20
PGDG 1.20
PGDG 1.20
d12.aarch64
PGDG 1.20
PGDG 1.20
PGDG 1.20
PGDG 1.20
PGDG 1.20
d13.x86_64
PGDG 1.20
PGDG 1.20
PGDG 1.20
PGDG 1.20
PGDG 1.20
d13.aarch64
PGDG 1.20
PGDG 1.20
PGDG 1.20
PGDG 1.20
PGDG 1.20
u22.x86_64
PGDG 1.20
PGDG 1.20
PGDG 1.20
PGDG 1.20
PGDG 1.20
u22.aarch64
PGDG 1.20
PGDG 1.20
PGDG 1.20
PGDG 1.20
PGDG 1.20
u24.x86_64
PGDG 1.20
PGDG 1.20
PGDG 1.20
PGDG 1.20
PGDG 1.20
u24.aarch64
PGDG 1.20
PGDG 1.20
PGDG 1.20
PGDG 1.20
PGDG 1.20
u26.x86_64
PGDG 1.20
PGDG 1.20
PGDG 1.20
PGDG 1.20
PGDG 1.20
u26.aarch64
PGDG 1.20
PGDG 1.20
PGDG 1.20
PGDG 1.20
PGDG 1.20
Package Version OS ORG SIZE File URL
pgextwlist_18 1.20 el8.x86_64 pgdg 22.7 KiB pgextwlist_18-1.20-1PGDG.rhel8.10.x86_64.rpm
pgextwlist_18 1.19 el8.x86_64 pigsty 20.3 KiB pgextwlist_18-1.19-1PIGSTY.el8.x86_64.rpm
pgextwlist_18 1.19 el8.x86_64 pgdg 20.7 KiB pgextwlist_18-1.19-1PGDG.rhel8.10.x86_64.rpm
pgextwlist_18 1.20 el8.aarch64 pgdg 22.3 KiB pgextwlist_18-1.20-1PGDG.rhel8.10.aarch64.rpm
pgextwlist_18 1.19 el8.aarch64 pigsty 20.2 KiB pgextwlist_18-1.19-1PIGSTY.el8.aarch64.rpm
pgextwlist_18 1.19 el8.aarch64 pgdg 20.4 KiB pgextwlist_18-1.19-1PGDG.rhel8.10.aarch64.rpm
pgextwlist_18 1.20 el9.x86_64 pgdg 22.8 KiB pgextwlist_18-1.20-1PGDG.rhel9.8.x86_64.rpm
pgextwlist_18 1.19 el9.x86_64 pigsty 20.4 KiB pgextwlist_18-1.19-1PIGSTY.el9.x86_64.rpm
pgextwlist_18 1.19 el9.x86_64 pgdg 20.8 KiB pgextwlist_18-1.19-1PGDG.rhel9.8.x86_64.rpm
pgextwlist_18 1.19 el9.x86_64 pgdg 20.8 KiB pgextwlist_18-1.19-1PGDG.rhel9.7.x86_64.rpm
pgextwlist_18 1.19 el9.x86_64 pgdg 20.9 KiB pgextwlist_18-1.19-1PGDG.rhel9.6.x86_64.rpm
pgextwlist_18 1.20 el9.aarch64 pgdg 21.9 KiB pgextwlist_18-1.20-1PGDG.rhel9.8.aarch64.rpm
pgextwlist_18 1.19 el9.aarch64 pigsty 20.0 KiB pgextwlist_18-1.19-1PIGSTY.el9.aarch64.rpm
pgextwlist_18 1.19 el9.aarch64 pgdg 20.1 KiB pgextwlist_18-1.19-1PGDG.rhel9.8.aarch64.rpm
pgextwlist_18 1.19 el9.aarch64 pgdg 20.1 KiB pgextwlist_18-1.19-1PGDG.rhel9.7.aarch64.rpm
pgextwlist_18 1.19 el9.aarch64 pgdg 20.2 KiB pgextwlist_18-1.19-1PGDG.rhel9.6.aarch64.rpm
pgextwlist_18 1.20 el10.x86_64 pgdg 22.8 KiB pgextwlist_18-1.20-1PGDG.rhel10.2.x86_64.rpm
pgextwlist_18 1.19 el10.x86_64 pigsty 20.2 KiB pgextwlist_18-1.19-1PIGSTY.el10.x86_64.rpm
pgextwlist_18 1.19 el10.x86_64 pgdg 20.8 KiB pgextwlist_18-1.19-1PGDG.rhel10.2.x86_64.rpm
pgextwlist_18 1.19 el10.x86_64 pgdg 20.8 KiB pgextwlist_18-1.19-1PGDG.rhel10.1.x86_64.rpm
pgextwlist_18 1.19 el10.x86_64 pgdg 21.2 KiB pgextwlist_18-1.19-1PGDG.rhel10.0.x86_64.rpm
pgextwlist_18 1.20 el10.aarch64 pgdg 22.3 KiB pgextwlist_18-1.20-1PGDG.rhel10.2.aarch64.rpm
pgextwlist_18 1.19 el10.aarch64 pigsty 20.2 KiB pgextwlist_18-1.19-1PIGSTY.el10.aarch64.rpm
pgextwlist_18 1.19 el10.aarch64 pgdg 20.4 KiB pgextwlist_18-1.19-1PGDG.rhel10.2.aarch64.rpm
pgextwlist_18 1.19 el10.aarch64 pgdg 20.4 KiB pgextwlist_18-1.19-1PGDG.rhel10.1.aarch64.rpm
pgextwlist_18 1.19 el10.aarch64 pgdg 20.4 KiB pgextwlist_18-1.19-1PGDG.rhel10.0.aarch64.rpm
postgresql-18-pgextwlist 1.20 d12.x86_64 pgdg 34.6 KiB postgresql-18-pgextwlist_1.20-1.pgdg12+1_amd64.deb
postgresql-18-pgextwlist 1.19 d12.x86_64 pgdg 29.1 KiB postgresql-18-pgextwlist_1.19-2.pgdg12+1_amd64.deb
postgresql-18-pgextwlist 1.20 d12.aarch64 pgdg 34.0 KiB postgresql-18-pgextwlist_1.20-1.pgdg12+1_arm64.deb
postgresql-18-pgextwlist 1.19 d12.aarch64 pgdg 28.7 KiB postgresql-18-pgextwlist_1.19-2.pgdg12+1_arm64.deb
postgresql-18-pgextwlist 1.20 d13.x86_64 pgdg 34.6 KiB postgresql-18-pgextwlist_1.20-1.pgdg13+1_amd64.deb
postgresql-18-pgextwlist 1.19 d13.x86_64 pgdg 29.1 KiB postgresql-18-pgextwlist_1.19-2.pgdg13+1_amd64.deb
postgresql-18-pgextwlist 1.20 d13.aarch64 pgdg 34.1 KiB postgresql-18-pgextwlist_1.20-1.pgdg13+1_arm64.deb
postgresql-18-pgextwlist 1.19 d13.aarch64 pgdg 28.8 KiB postgresql-18-pgextwlist_1.19-2.pgdg13+1_arm64.deb
postgresql-18-pgextwlist 1.20 u22.x86_64 pgdg 35.2 KiB postgresql-18-pgextwlist_1.20-1.pgdg22.04+1_amd64.deb
postgresql-18-pgextwlist 1.19 u22.x86_64 pgdg 30.1 KiB postgresql-18-pgextwlist_1.19-2.pgdg22.04+1_amd64.deb
postgresql-18-pgextwlist 1.20 u22.aarch64 pgdg 34.8 KiB postgresql-18-pgextwlist_1.20-1.pgdg22.04+1_arm64.deb
postgresql-18-pgextwlist 1.19 u22.aarch64 pgdg 29.3 KiB postgresql-18-pgextwlist_1.19-2.pgdg22.04+1_arm64.deb
postgresql-18-pgextwlist 1.20 u24.x86_64 pgdg 34.6 KiB postgresql-18-pgextwlist_1.20-1.pgdg24.04+1_amd64.deb
postgresql-18-pgextwlist 1.19 u24.x86_64 pgdg 29.2 KiB postgresql-18-pgextwlist_1.19-2.pgdg24.04+1_amd64.deb
postgresql-18-pgextwlist 1.20 u24.aarch64 pgdg 34.0 KiB postgresql-18-pgextwlist_1.20-1.pgdg24.04+1_arm64.deb
postgresql-18-pgextwlist 1.19 u24.aarch64 pgdg 28.6 KiB postgresql-18-pgextwlist_1.19-2.pgdg24.04+1_arm64.deb
postgresql-18-pgextwlist 1.20 u26.x86_64 pgdg 33.9 KiB postgresql-18-pgextwlist_1.20-1.pgdg26.04+1_amd64.deb
postgresql-18-pgextwlist 1.19 u26.x86_64 pgdg 29.1 KiB postgresql-18-pgextwlist_1.19-2.pgdg26.04+1_amd64.deb
postgresql-18-pgextwlist 1.20 u26.aarch64 pgdg 33.4 KiB postgresql-18-pgextwlist_1.20-1.pgdg26.04+1_arm64.deb
postgresql-18-pgextwlist 1.19 u26.aarch64 pgdg 28.6 KiB postgresql-18-pgextwlist_1.19-2.pgdg26.04+1_arm64.deb

Source

pig build pkg pgextwlist;		# build rpm

Install

Make sure PGDG repo available:

pig repo add pgdg -u    # add pgdg repo and update cache

Install this extension with pig:

pig install pgextwlist;		# install via package name, for the active PG version

pig install pgextwlist -v 18;   # install for PG 18
pig install pgextwlist -v 17;   # install for PG 17
pig install pgextwlist -v 16;   # install for PG 16
pig install pgextwlist -v 15;   # install for PG 15
pig install pgextwlist -v 14;   # install for PG 14

Config this extension to shared_preload_libraries:

shared_preload_libraries = 'pgextwlist';

This extension does not need CREATE EXTENSION DDL command

Usage

Sources:

pgextwlist lets selected non-superusers run extension lifecycle commands for an explicit allowlist. It temporarily executes those commands with bootstrap-superuser authority, so the allowlist and any custom scripts are part of the database’s security boundary.

The module is preloaded and does not itself need CREATE EXTENSION.

Configure the Allowlist

Load the module for each backend:

local_preload_libraries = 'pgextwlist'
extwlist.extensions = 'hstore,cube,pg_stat_statements'

The list may also be assigned per role:

ALTER ROLE extension_admin
  SET extwlist.extensions = 'hstore,pg_stat_statements';

Reconnect after changing local_preload_libraries. A whitelisted user can then run:

CREATE EXTENSION hstore;
ALTER EXTENSION hstore UPDATE;
COMMENT ON EXTENSION hstore IS 'approved utility';
DROP EXTENSION hstore;

An extension not named in extwlist.extensions is rejected.

Restrict Database Ownership

Version 1.20 adds:

extwlist.restrict_to_database_owner = on

When enabled, the caller must also own the current database. This is off by default for compatibility. Enable it when extension administration should not cross database-ownership boundaries.

Custom Lifecycle Scripts

Set extwlist.custom_path to an existing readable directory. Version 1.20 raises an error for a missing or unreadable path rather than silently skipping it.

For extension extname, scripts under extname/ can include:

  • before–1.0.sql and after–1.0.sql around creation of a specific version.
  • before-create.sql and after-create.sql as creation fallbacks.
  • before-update.sql and after-update.sql around an update.
  • before-drop.sql and after-drop.sql around removal.

Templates can use @extschema@, @current_user@, and @database_owner@. Only trusted administrators should be able to write this directory because scripts execute with elevated authority.

Configuration Index

  • local_preload_libraries: loads pgextwlist into new sessions.
  • extwlist.extensions: comma-separated allowlist.
  • extwlist.custom_path: base directory for lifecycle scripts.
  • extwlist.restrict_to_database_owner: additionally require database ownership.

Security and Compatibility Notes

  • Version 1.20 rejects substitution names containing quote, dollar, apostrophe, or backslash characters, addressing the command-injection class tracked as CVE-2023-39417.
  • CREATE EXTENSION, DROP EXTENSION, ALTER EXTENSION UPDATE, and COMMENT ON EXTENSION are supported. ALTER EXTENSION ADD and DROP are not supported.
  • Objects created through the elevated path are owned according to the extension/bootstrap-superuser behavior, not necessarily by the requesting role.
  • Review extension SQL and custom scripts before adding a name. Whitelisting an extension grants the caller the power embodied by its install and update scripts.
Last updated on