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 suspected race condition in prompt handling #105

Merged
merged 1 commit into from
Mar 15, 2024

Conversation

williammartin
Copy link
Contributor

Description

Fixes #104

The current approach to handling prompts involves calling for a prompt and then registering a signal handler for a response that indicates the prompt had completed. In most cases, if the user were to take action, this would be quite slow. However, in the case of automatic responses to the prompt, the signal response may appear before the signal handler is configured, resulting in blocking forever.

This commit moves the call for a prompt after the signal handling has been configured, closing the race window.

Reviewer Notes

I'll admit that I'm not very familiar with all the nuances of dbus or this library so it's entirely possible I've missed something. We've had three reports over on cli/cli#8802 that this has resolved the issue they were facing but I can't say for sure that there's not some unintended side effects.

The current approach to handling prompts involves calling for a prompt
and then registering a signal handler for a response that indicates the
prompt had completed. In most cases, if the user were to take action,
this would be quite slow. However, in the case of automatic responses to
the prompt, the signal response may appear before the signal handler is
configured, resulting in blocking forever.

This commit moves the call for a prompt after the signal handling has
been configured, closing the race window.

Signed-off-by: William Martin <williammartin@github.com>
@szuecs
Copy link
Member

szuecs commented Mar 15, 2024

@williammartin thanks for the PR, the description and the detailed issue, really great work!
Reviewing the timestamps of the message, I would say you are right to call it a race condition.

@szuecs
Copy link
Member

szuecs commented Mar 15, 2024

👍

1 similar comment
@mikkeloscar
Copy link
Member

👍

@mikkeloscar mikkeloscar merged commit 987647a into zalando:master Mar 15, 2024
6 of 7 checks passed
@williammartin
Copy link
Contributor Author

Thanks so much for the quick review and merge! Will you create a new release with this or should I pin to the sha in the meantime?

thanks for the PR, the description and the detailed issue, really great work!

OSS maintainers have to stick together 😉

@mikkeloscar
Copy link
Member

I have created a new release! https://github.com/zalando/go-keyring/releases/tag/v0.2.4

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.

Suspected race condition in secret service prompt handler
3 participants