Skip to content

Web: remove multi re-authn in a row when creating github bot #55273

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

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

Conversation

kimlisa
Copy link
Contributor

@kimlisa kimlisa commented May 29, 2025

part of #55232

With admin action enabled, creating a bot required user to re-authn 3 times in a row before succeeding. It was because there was 3 different api calls being made under the hood, each of them requiring re-authn.

There are no major changes other than requiring user to re-authn once, and then reusing that mfa response for other api calls. Changed promise chaining to try/catch block.

Tested changes that it only requires one re-authn.

@kimlisa
Copy link
Contributor Author

kimlisa commented May 29, 2025

i don't think this requires a changelog... it didn't really cause a bug, just an inconvenience?

@kimlisa kimlisa added the no-changelog Indicates that a PR does not require a changelog entry label May 29, 2025
@@ -80,57 +82,74 @@ export function GitHubFlowProvider({
}
}

function createBot(): Promise<boolean> {
return run(() =>
Copy link
Member

Choose a reason for hiding this comment

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

What's the reason behind removing the call to run? Couldn't the callback passed to run be transformed to an anonymous async function? I think it'd have the same semantics as a promise chain but we wouldn't have to call setAttempt by hand.

The new implementation also doesn't seem to update the status to success. I'm not sure how important that is here, but it's something that I noticed.

return api.post(cfg.getBotsUrl(), config);
export function createBot(
config: CreateBotRequest,
mfaResponse: MfaChallengeResponse
Copy link
Member

Choose a reason for hiding this comment

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

Here the mfaResponse arg is required whereas in createBotToken it's optional. Is there a reason for that? Seeing how currently both functions are used in the same way, I'd expect them both to use a similar approach to that arg.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/branch/v17 backport/branch/v18 no-changelog Indicates that a PR does not require a changelog entry size/sm ui
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants