Skip to content

Wrong privilege checks in postgresql::server::default_privileges (object_type => 'TABLES') for ALL and TRIGGER #1684

Description

@oxtortek

Describe the Bug

When using postgresql::server::default_privileges with object_type => 'TABLES' and privilege => 'ALL', ALL privileges are set in PostgreSQL, but the unless check failed because of an additional 'm' (MAINTAIN) privilege added by PostgreSQL 17.

A similar issue exists when granting TRIGGER. Here the $_check_privilege = 'd' matches for delete instead.

Expected Behavior

Puppet Agent recognizes, that "ALL" privileges are granted and does not apply the resource on every run.

Steps to Reproduce

What I did (some steps might be not necessary):

# create db
postgresql::server::database { 'testdb': }

# create roles
postgresql::server::database_grant { 'testrole_owner@testdb':
  privilege => 'ALL',
  db        => 'testdb',
  role      => 'testrole_owner',
}

postgresql::server::database_grant { 'testrole_group@testdb':
  privilege => 'ALL',
  db        => 'testdb',
  role      => 'testrole_group',
}

# create schema
postgresql::server::schema { 'testschema':
  db    => 'testdb',
  owner => 'testrole_owner',
}

postgresql::server::default_privileges { 'testrole_group@testdb/testschema/*':
  target_role => 'testrole_owner',
  role        => 'testrole_group',
  db          => 'testdb',
  object_type => 'TABLES',
  privilege   => 'ALL',
  schema      => 'testschema',
  require     => Postgresql::Server::Database_grant['testrole_owner@testdb'],
}

Environment

  • Platform: Debian Trixie
  • PostgreSQL version: 17.10
  • Module version: 10.6.1

Additional Context

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions