Skip to content

noset

Module for blocking SET variables for non-super users.

pg_noset · Module for blocking SET variables for non-super users.

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
7430nosetpg_noset0.3.0SECAGPL-3.0C
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
--sLd--NoYesYesYesnono

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXTPIGSTY0.3.019 18 17 16 15pg_noset-
RPMPIGSTY0.3.019 18 17 16 15noset_$v-
DEBPIGSTY0.3.019 18 17 16 15postgresql-$v-noset-
Linux / PGPG19PG18PG17PG16PG15
el8.x86_64N/APIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0
el8.aarch64N/APIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0
el9.x86_64PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0
el9.aarch64PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0
el10.x86_64PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0
el10.aarch64PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0
d12.x86_64PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0
d12.aarch64PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0
d13.x86_64PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0
d13.aarch64PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0
u22.x86_64PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0
u22.aarch64PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0
u24.x86_64PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0
u24.aarch64PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0
u26.x86_64PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0
u26.aarch64PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0PIGSTY 0.3.0

Source

pig build pkg pg_noset;		# build rpm/deb

Install

Make sure PGDG and PIGSTY repo available:

pig repo add pgsql -u   # add both repo and update cache

Install this extension with pig:

pig install pg_noset;		# install by package name
pig install noset;		# install by extension name

pig install noset -v 19;   # install for PG 19
pig install noset -v 18;   # install for PG 18
pig install noset -v 17;   # install for PG 17
pig install noset -v 16;   # install for PG 16
pig install noset -v 15;   # install for PG 15

Config this extension to shared_preload_libraries:

shared_preload_libraries = 'noset';

Create this extension with:

CREATE EXTENSION noset;

Usage

noset: Prevent users from changing session parameters via SET/RESET

noset is a loadable module that prevents specific users from using SET or RESET commands to change session parameters.

CREATE EXTENSION noset;

Configuration

Add to postgresql.conf:

shared_preload_libraries = 'noset'

GUC Parameters

ParameterDefaultDescription
noset.enabledfalseEnable SET/RESET blocking for the role
noset.parameters*Parameters to block (comma-separated, * = all)

Setting Up Per-User Restrictions

-- Block ALL SET/RESET for a user
ALTER USER appuser SET noset.enabled = true;

-- Block only specific parameters
ALTER USER appuser SET noset.enabled = true;
ALTER USER appuser SET noset.parameters = 'work_mem,jit';

Example

-- As appuser:
SET work_mem = '1GB';
-- ERROR: permission denied to set/reset parameter 'set work_mem = '1GB';'

SET maintenance_work_mem = '1GB';
-- SET (allowed, not in blocked list)

Finding Restricted Users

SELECT usename, useconfig FROM pg_user
WHERE useconfig IS NOT NULL
  AND array['noset.enabled=on'] <@ useconfig;

Notes

  • Does not apply to superusers
  • The extension revokes access to the set_config function from PUBLIC

Table reader