pg.ddx.io  pgaudit/pgaudit GitHub issues and pull requests  
help / color / mirror / Atom feed
From: TheOtherBrian1 (@TheOtherBrian1) <noreply+TheOtherBrian1@github.com>
To: pgaudit/pgaudit <noreply+pgaudit-pgaudit@github.com>
Subject: [pgaudit/pgaudit] issue #335: SET pgaudit.log = 'none' isn’t logged, leaving no trace that auditing was disabled
Date: Fri, 09 Oct 2026 04:48:51 +0000
Message-ID: <gh-pgaudit-pgaudit-335@github.com> (raw)

### Description

When `pgaudit.log` is set to `misc` at the role or global level, it should log all `SET config = 'so-and-so'` commands.

However, it fails to log statements that disable `pgaudit.log`:

```sql
ALTER ROLE postgres SET pgaudit.log = 'misc';

SET statement_timeout = '10s'; -- logged
SET pgaudit.log = 'none';      -- not logged (should be logged) <------
SET statement_timeout = '1s';  -- not logged (disabled for the session)
```

Any adversary can start their session by executing `SET pgaudit.log = 'none';` and, as an administrator, I'd have no way of knowing that my monitoring system was disabled. I don't expect logging to continue once the session variable is set to `none`, but I definitely would want to know that someone put in an effort to hide their activity.

For comparison, PostgreSQL's built-in `log_statement = 'all'` does record the statement that disables it:

```sql
ALTER ROLE postgres SET log_statement = 'all';

SELECT 1;                   -- logged
SET log_statement = 'none'; -- logged
SELECT 1;                   -- not logged (disabled for the session)
```


### Expected behavior

`SET pgaudit.log = 'none'` should be logged, since it runs while auditing is still active. Statements after it don't need to be.

view thread (5+ messages)  latest in thread

Message-ID: <gh-pgaudit-pgaudit-335@github.com>
Permalink:  ../gh-pgaudit-pgaudit-335@github.com/

 · 


This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox