Skip to content

Add test coverage for go zero value reads writes #52

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

Merged
merged 2 commits into from
Oct 30, 2024

Conversation

fimac
Copy link
Contributor

@fimac fimac commented Oct 30, 2024

When inserting a jsonb value as nil, or an empty map, or not including the field on insert, the value coming through to todb is an empty map[]. This is because go sets these values to the go zero value https://go.dev/ref/spec#The_zero_value.

This PR will add a change to check for this in the EncryptedJsonb type in goeql so that we don't serialize the value into the jsonb shape. The proxy will encrypt the value as "null", and will encrypt this. But, when trying to read, this error will return
handle] rewrite_results Error: Unknown variant code 11``.

I have been testing by pointing to this branch locally cipherstash/goeql#3

I will do a release of goeql and then open this PR.
Bumped goeql and ran tests:

Screenshot 2024-10-30 at 5 01 47 PM

@fimac fimac force-pushed the fix/add-tests-for-null-checks branch from 74986ef to 8c5b754 Compare October 30, 2024 05:34
@fimac fimac marked this pull request as ready for review October 30, 2024 06:01
Copy link
Contributor

@auxesis auxesis left a comment

Choose a reason for hiding this comment

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

Nice work @fimac.

@fimac fimac merged commit 89dd8a7 into main Oct 30, 2024
@fimac fimac deleted the fix/add-tests-for-null-checks branch October 30, 2024 06:07
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.

2 participants