puppetlabs / puppetlabs/puppetlabs-postgresql

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

Open Beginner friendly
#1,684 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bugfix
Dominant language
Ruby
Stars
232
Forks
610
Avg merge
5d 23h
Merged PRs (30d)
4

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at manifests/server/default_privileges.pp around lines 108 and 113, where the issue identifies the ALL and TRIGGER privilege checks. Compare those checks with the PostgreSQL privilege letters described in the report, then inspect any corresponding tests. Done means Puppet recognizes these grants correctly and does not reapply the resource on every run.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, ruby
Domain
databases
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
82/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.