Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with prepared update #40

Closed
Nyquest opened this issue Dec 18, 2017 · 2 comments
Closed

Problem with prepared update #40

Nyquest opened this issue Dec 18, 2017 · 2 comments
Assignees
Labels

Comments

@Nyquest
Copy link

Nyquest commented Dec 18, 2017

I'm added audit to read table:
grant select on audited_file to auditor;
but I see in a log 'update' statement.
I reproduced the situation this way:

PREPARE fh(varchar(255),int) as UPDATE audited_file set file_hash=$1 where id=$2;

EXECUTE fh('test', 1)

In the log appeared:

LOG: AUDIT: OBJECT,30,1,WRITE,UPDATE,TABLE,public.audited_file,"PREPARE fh(varchar(255),int) as UPDATE audited_file set file_hash=$1 where id=$2","test,1"

p.s. For prepred insert and prepared delete works normally

@dwsteele dwsteele self-assigned this Dec 19, 2017
@dwsteele
Copy link
Contributor

Well, that certainly doesn't look right.

So, to be clear, this audit record is showing up even though it should not be based on the permissions given to auditor, i.e. there are too many audit records rather than too few.

MasahikoSawada added a commit to MasahikoSawada/pgaudit that referenced this issue Jan 31, 2018
Previously, replication command is triggered to set the log class
to LOG_SYSTEM mistakenly.

Resolve issue pgaudit#40, reporeted by harada-toshi.
@dwsteele
Copy link
Contributor

dwsteele commented Oct 3, 2018

Any delete/update contains an implied select on the table, and that's what pgaudit is picking up on. It also happens for deletes if there is a where clause.

It might be possible to filter this out, but I'm not sure what unintended consequences that would have, or even if it would be correct. Any thoughts @sfrost?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants