-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Connect tries to login to previous session instead of logging in to the DeviceWebToken's session #40962
Comments
As @avatus put it, in much fewer words:
|
It's probably the same, but we should also consider what happens with distinct users for the same cluster. |
Launching a deep link waits until the frontend app is ready: teleport/web/packages/teleterm/src/mainProcess/windowsManager.ts Lines 180 to 184 in 606bcb1
Currently the readiness is signaled after
teleport/web/packages/teleterm/src/ui/AppInitializer/showStartupModalsAndNotifications.ts Lines 28 to 51 in 606bcb1
The solution would be to:
Instead of passing an abort controller back and forth between processes through |
I believe #45714 is now tracking this. |
Thanks for the solution @ravicious, it really helped. However, it seems to me that we can simplify it. The most important thing is separating Why? Because |
I think it makes sense. With this part of the codebase, it's hard to be 100% sure that it's not going to cause any unforeseen issues. But after going through the code it seems okay. The only potential issue that could arise in the future would be two pieces of code that need to display a regular modal after the launch of the app. If we control when that code is fired, then it's not that big of a problem, because we can coordinate this in Though there's one piece of code which should run after Once It'd be good to have test for that, as the correlation between this and VNet is rather convoluted. ;f One other thing occurred to me while writing this: what about a situation where the app is launched from a deep link to workspace B, while the current workspace A has a valid cert and some tabs to reopen? In this case, there's no login dialog for workspace A, but there's a dialog asking about reopening documents from A, which would be immediately canceled (thus discarding any old tabs) in favor of displaying a login modal for B. I suppose that's why I initially opted for "aborting" the process of setting a workspace instead of just straight up cancelling it (and thus running logic associated with cancelling a modal). Maybe The user would never be able to call |
Hmm from what I see,
But does this code actually work? If I don't have any workspace, or just cancel the modal, VNet starts anyway. So what does waiting for this.setState(draftState => {
draftState.workspaces = restoredWorkspaces;
});
if (persistedState.rootClusterUri) {
await this.setActiveWorkspace(persistedState.rootClusterUri);
}
this.setState(draft => {
draft.isInitialized = true;
});
} Maybe we could simplify it to: this.setState(draftState => {
draftState.workspaces = restoredWorkspaces;
draftState.isInitialized = true;
}); |
This issue is within the context of device trust web. A small explanation: when doing device trust web, the Web UI attempts to open a teleport:// URL. That URL has most of the information required to start a login, namely the username and the proxy address.
Let's say Connect has an expired session for "cluster1", but doesn't know about "cluster2". We are running device web authentication against "cluster2", thus opening Connect via the corresponding "teleport://" URL.
Expected behavior:
Connect is expected to ignore the expired session for "cluster1" and attempt to login directly to "cluster2", as informed by the teleport:// URL.
Current behavior:
Connect attempts to re-connect to the expired session for "cluster1" first. After that is completed or canceled, then it shows the popup to authenticate for "cluster2".
To repro, do the following:
rm -fr ~/Library/Application\ Support/Teleport\ Connect/tsh/keys/cluster1/
)open 'teleport://alpaca@cluster2:443/authenticate_web_device?id=4fbab9eb-568e-437b-ab89-ca45b843e8aa&token=YqkvcRfkZPsRHg4qiFz9UayN1zMJ97kcTwjjpiABEBQ'
)Connect opens and immediately attempts to connect to "cluster1" (zarq in the screenshot):
After canceled (ESC), it shows the popup to connect to "cluster2":
Bug details:
The text was updated successfully, but these errors were encountered: