-
Notifications
You must be signed in to change notification settings - Fork 350
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
Handle customer proxy re-auth response by retrying, not prompting user for different token #6652
base: main
Are you sure you want to change the base?
Conversation
Accept: application/json
header to outgoing HTTP requestsc77e517
to
e7ed90b
Compare
/////////////////////////////////// | ||
// TODO!(sqs): remove | ||
/////////////////////////////////// | ||
if (require('node:fs').existsSync('/tmp/is-custom-auth-challenge-error')) { | ||
return true | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: this is for local testing and will be removed before merging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI I added https://github.com/sourcegraph/cody/blob/main/agent/scripts/reverse-proxy.py which is very simplistic for now but could be easily extended to simulate that kind of proxy response.
e7ed90b
to
1e632ce
Compare
d771964
to
a8e0929
Compare
a8e0929
to
70a27b7
Compare
1daa94c
to
c08e156
Compare
A customer has a proxy that enforces recent 2fa on their machines to access the Sourcegraph instance. After 24h, the user needs to tap their 2fa key to make the network connection to Sourcegraph be reauthed and start working again. The responses from the proxy after the 24h period expires are being treated as "invalid token" and causing users to need to re-auth into Cody. The response looks like:
{"auth_url":"https://example.com","error":"request not authenticated","requested_url":"example.com/.api/client-config"}
with an HTTP header of the form
X-${CUSTOMER}-U2f-Challenge: true
.Accept: application/json
headers to ensure we get that JSON response and not an HTTP redirect from the proxy when the 24h period expiresTry Again
button.Fixed issues (by @pkukielka ):
Fixes https://linear.app/sourcegraph/issue/CODY-4695/handle-customer-proxy-re-auth-response-by-retrying-not-prompting-user
Screenshots
When the user needs to complete the auth challenge, they will see the following errors, depending on what they're doing.
If the extension hasn't successfully authenticated since the editor was restarted:
In chat:
After failed completion:
Test plan
TBD
Changelog
/^X-.*-U2f-Challenge$/i
and whose value istrue
, the user is asked to complete the authentication challenge on their device ("Tap YubiKey to Authenticate...") and is not prompted for a different access token. When the device's authentication challenge is successful, the extension will automatically proceeed to sign the user in using their stored access token (if any).