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 broken TTY after manual auth code prompt. #758

Merged
merged 1 commit into from
Jul 30, 2021

Conversation

mattmoyer
Copy link
Contributor

This may be a temporary fix. It switches the manual auth code prompt to use promptForValue() instead of promptForSecret(). The promptForSecret() function no longer supports cancellation (the v0.9.2 behavior) and the method of cancelling in promptForValue() is now based on running the blocking read in a background goroutine, which is allowed to block forever or leak (which is not important for our CLI use case).

This means that the authorization code is now visible in the user's terminal, but this is really not a big deal because of PKCE and the limited lifetime of an auth code.

The main goroutine now correctly waits for the "manual prompt" goroutine to clean up, which now includes printing the extra newline that would normally have been entered by the user in the manual flow.

Release note:

This functionality with the bug has not yet been released.

NONE

@mattmoyer mattmoyer added the bug Something isn't working label Jul 29, 2021
@codecov
Copy link

codecov bot commented Jul 29, 2021

Codecov Report

Merging #758 (1e32530) into main (0ab8e14) will increase coverage by 0.02%.
The diff coverage is 51.28%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #758      +/-   ##
==========================================
+ Coverage   79.86%   79.89%   +0.02%     
==========================================
  Files         124      124              
  Lines        8357     8369      +12     
==========================================
+ Hits         6674     6686      +12     
  Misses       1464     1464              
  Partials      219      219              
Impacted Files Coverage Δ
pkg/oidcclient/login.go 89.57% <51.28%> (-0.19%) ⬇️
...onfig/oidcupstreamwatcher/oidc_upstream_watcher.go 97.98% <0.00%> (+1.00%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0ab8e14...1e32530. Read the comment docs.

pkg/oidcclient/login.go Outdated Show resolved Hide resolved
pkg/oidcclient/login.go Outdated Show resolved Hide resolved
@mattmoyer mattmoyer force-pushed the use-plain-authcode-prompt branch 2 times, most recently from 46706eb to 3899cda Compare July 30, 2021 16:34
@mattmoyer mattmoyer marked this pull request as ready for review July 30, 2021 16:35
This may be a temporary fix. It switches the manual auth code prompt to use `promptForValue()` instead of `promptForSecret()`. The `promptForSecret()` function no longer supports cancellation (the v0.9.2 behavior) and the method of cancelling in `promptForValue()` is now based on running the blocking read in a background goroutine, which is allowed to block forever or leak (which is not important for our CLI use case).

This means that the authorization code is now visible in the user's terminal, but this is really not a big deal because of PKCE and the limited lifetime of an auth code.

The main goroutine now correctly waits for the "manual prompt" goroutine to clean up, which now includes printing the extra newline that would normally have been entered by the user in the manual flow.

The text of the manual login prompt is updated to be more concise and less scary (don't use the word "fail").

Signed-off-by: Matt Moyer <moyerm@vmware.com>
@mattmoyer mattmoyer merged commit f4badb3 into vmware-tanzu:main Jul 30, 2021
@mattmoyer mattmoyer deleted the use-plain-authcode-prompt branch July 30, 2021 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cla-not-required
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants