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: panic when patching empty secret #1474

Merged
merged 1 commit into from Feb 29, 2024

Conversation

alemorcuq
Copy link
Collaborator

When patching an empty secret, i.e. one with no data field, the controller will panic as it's trying to assign to a nil map. Same will happen with the labels.

  • Always initialize the Data and Labels maps if they are empty
  • Add a test to cover this use case

fixes: #1282

Copy link
Collaborator

@alvneiayu alvneiayu left a comment

Choose a reason for hiding this comment

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

LGTM

When patching an empty secret, i.e. one with no data field, the controller will panic
as it's trying to assign to a nil map. Same will happen with the labels.

- Always initialize the Data and Labels maps if they are empty
- Add a test to cover this use case

Signed-off-by: Alejandro Moreno <amorenoc@vmware.com>
Copy link
Member

@agarcia-oss agarcia-oss left a comment

Choose a reason for hiding this comment

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

Great fix, @alemorcuq 👏

@alemorcuq alemorcuq merged commit 5fd7424 into bitnami-labs:main Feb 29, 2024
15 checks passed
@alemorcuq alemorcuq deleted the 1282-empty-secret branch February 29, 2024 13:01
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.

Controller crashed: Observed a panic: "assignment to entry in nil map"
3 participants