Skip to content

Fix suspected race condition in prompt handling#105

Merged
mikkeloscar merged 1 commit intozalando:masterfrom
williammartin:master
Mar 15, 2024
Merged

Fix suspected race condition in prompt handling#105
mikkeloscar merged 1 commit intozalando:masterfrom
williammartin:master

Conversation

@williammartin
Copy link
Copy Markdown
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>
@williammartin williammartin changed the title Fix race condition in prompt handling Fix suspected race condition in prompt handling Mar 15, 2024
@szuecs
Copy link
Copy Markdown
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
Copy Markdown
Member

szuecs commented Mar 15, 2024

👍

1 similar comment
@mikkeloscar
Copy link
Copy Markdown
Member

👍

@mikkeloscar mikkeloscar merged commit 987647a into zalando:master Mar 15, 2024
@williammartin
Copy link
Copy Markdown
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
Copy Markdown
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