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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mxey
Copy link

@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
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
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
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.

None yet

2 participants