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

client: fix corner cases in secret declaration #124

Merged
merged 1 commit into from
Oct 25, 2024
Merged

Conversation

creachadair
Copy link
Member

  1. Don't allow an empty secret name to be declared. While in principle this
    could be fine, it is weird and not worth supporting.

  2. Deduplicate secret names before initialization. I originally thought this
    was not needed, but because of the way we merge cached results with the
    initialization step, duplicates can "poison" the initialization state.

1. Don't allow an empty secret name to be declared.  While in principle this
   could be fine, it is weird and not worth supporting.

2. Deduplicate secret names before initialization. I originally thought this
   was not needed, but because of the way we merge cached results with the
   initialization step, duplicates can "poison" the initialization state.
@creachadair creachadair enabled auto-merge (squash) September 28, 2024 02:02
// Although the constructor puts them into a map, duplicates can "poison"
// the initialization, so remove them up front.
slices.Sort(sec)
sec = slices.Compact(sec)

Choose a reason for hiding this comment

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

TIL about slices.Compact neat!

Copy link
Member Author

Choose a reason for hiding this comment

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

It's relatively new!

@creachadair creachadair merged commit 14d2640 into main Oct 25, 2024
1 check passed
@creachadair creachadair deleted the mjf/edgecase branch October 25, 2024 16:38
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