improve postgres bind params audit logging#34321
Merged
GavinFrazar merged 1 commit intomasterfrom Nov 9, 2023
Merged
Conversation
* log with same format for all params when one format code is given * log binary format params as base64 encoded string
Contributor
|
The PR changelog entry failed validation: The changelog entry must start with a letter. |
smallinsky
approved these changes
Nov 8, 2023
| // one format code applies the same format code to all params. | ||
| // https://www.postgresql.org/docs/current/protocol-message-formats.html#PROTOCOL-MESSAGE-FORMATS-BIND | ||
| // https://www.postgresql.org/docs/current/protocol-message-formats.html#PROTOCOL-MESSAGE-FORMATS-FUNCTIONCALL | ||
| if len(formatCodes) > 1 && len(formatCodes) != len(parameters) { |
Contributor
There was a problem hiding this comment.
Should we handle the case where len(formatCodes) == 1 and len(parameters) == 0 ?
Contributor
Author
There was a problem hiding this comment.
if using a prepared statement with > 0 parameters, then passing 0 parameters will be a postgres error.
If the prepared statement has 0 parameters and you pass 0 parameters with 1 format code, it's not an error, but you didn't bind anything so there's no parameters to log anyway. I don't think there's any point in generating a log warning
jentfoo
approved these changes
Nov 8, 2023
gzdunek
approved these changes
Nov 9, 2023
|
@GavinFrazar See the table below for backport results.
|
GavinFrazar
added a commit
that referenced
this pull request
Nov 9, 2023
Backport #34321 to branch/v13. * log with same format for all params when one format code is given * log binary format params as base64 encoded string
GavinFrazar
added a commit
that referenced
this pull request
Nov 9, 2023
Backport #34321 to branch/v12. * log with same format for all params when one format code is given * log binary format params as base64 encoded string
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Nov 10, 2023
Backport #34321 to branch/v13. * log with same format for all params when one format code is given * log binary format params as base64 encoded string
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Nov 10, 2023
Backport #34321 to branch/v12. * log with same format for all params when one format code is given * log binary format params as base64 encoded string
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR affects Postgres Bind/FunctionCall event audit logging:
changelog: Added binary formatted parameters as base64 encoded strings to PostgreSQL Statement Bind audit log events