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

fix: show field name in error message when base64 decoding fails #1519

Merged
merged 1 commit into from
May 23, 2024

Conversation

mxey
Copy link
Contributor

@mxey mxey commented Apr 29, 2024

Description of the change

unsealing errors usually show the field name that caused the error - except for base64 decoding. This change fixes that.

Benefits

clearer error message

Possible drawbacks

none

Applicable issues

Additional information

Copy link
Collaborator

@alemorcuq alemorcuq left a comment

Choose a reason for hiding this comment

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

Thanks for the PR. I've left some comments.

}

if !strings.Contains(err.Error(), "foo") {
t.Errorf("Unseal error did not contain field name %q: %v", "foo", err)
Copy link
Collaborator

Choose a reason for hiding this comment

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

For consistency with the other tests:

Suggested change
t.Errorf("Unseal error did not contain field name %q: %v", "foo", err)
t.Errorf("Expecting error: %v to contain field %q", err, "foo")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed


_, err := sealedSecret.Unseal(codecs, keys)
if err == nil {
t.Fatalf("Unseal did not return expected error: %v", err)
Copy link
Collaborator

Choose a reason for hiding this comment

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

For consistency with the other tests:

Suggested change
t.Fatalf("Unseal did not return expected error: %v", err)
t.Fatalf("Expecting error: got nil instead")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed

Signed-off-by: Maximilian Gaß <m.gass@babiel.com>
@mxey mxey force-pushed the base64-error-field-name branch from 6227b53 to f742928 Compare May 10, 2024 09:04
@alemorcuq alemorcuq merged commit a22910f into bitnami-labs:main May 23, 2024
15 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.

2 participants