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

Encode bytea fields #72

Merged
merged 1 commit into from
May 21, 2024
Merged

Conversation

rjpmestre
Copy link

@rjpmestre rjpmestre commented Apr 8, 2024

Aims to fix https://github.com/SUSE/spacewalk/issues/23726

We detected a case where binary data contained backslashes. We've been using pq.QuoteLiteral but in these cases we end up getting invalid insert statements.
Besides, it also had some line breaks and contained sensitive information.

My suggestion here is to encode this type of data to hexadecimal as it would address the problems with escaping characters, keeps the statements tighter and also does not directly exposes any sensitive information that may be copied around servers.

We apply the same escape method to varchar fields. However i wanted to exclude them, at least for now. Encoding and decoding means having an additional processing overhead and this hasn't been a problem so far.

@rjpmestre rjpmestre self-assigned this Apr 8, 2024
@rjpmestre rjpmestre requested a review from rjmateus April 9, 2024 09:43
@rjpmestre rjpmestre force-pushed the encode_bytea_fields branch 5 times, most recently from 548b1d4 to b9622ee Compare April 9, 2024 12:31
Copy link
Member

@rjmateus rjmateus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Contributor

@aaannz aaannz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changelog entry is needed

Copy link
Contributor

@aaannz aaannz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@aaannz aaannz merged commit 5d0d7b1 into uyuni-project:main May 21, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants