Remote-SSH: browser sign-in on every query; prefer VS Code authentication before native auth
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 68/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- csharp, typescript, vscode
调研方向
先从 src/Server/Connections/ConnectionManager.cs 和 src/Server/Server.cs 开始,然后运行 issue 中描述的针对性 ConnectionManagerTests 命令。在评估提议的远程主机路径之前,先检查现有的 fallback 和显式身份验证行为。完成的标准是针对性测试通过,显式凭据和本地路由保持不变,并且连续的远程查询会复用身份验证,而不会反复弹出浏览器提示。
由索引模型根据 Issue 内容生成。
描述
Summary
On a Linux Remote-SSH host, Microsoft Kusto Explorer 1.0.1 opened the browser for interactive authentication on every query, including two consecutive executions of a trivial query. Both queries succeeded after sign-in.
A local server-side change to prefer the existing VS Code authentication provider for remote, HTTPS, federated connections stopped the repeated browser prompts. This is a locally verified workaround/proposed fix, not a claim that the underlying native authentication cache failure has been fully diagnosed.
Environment and baseline
- Microsoft Kusto Explorer:
ms-kusto.kusto-explorer-vscode, version1.0.1. - Server assembly version:
1.0.1+fae8b0964f259fa72352bd736597a7cc64120645, matching tagv1.0.1. - Extension host: Linux, Debian 13, connected through Remote-SSH.
- Language-server runtime: .NET
10.0.12, x64. - Standard Azure Data Explorer connection using interactive user authentication.
Baseline qualification: The installed TypeScript client already contained an earlier local token-cache customization. That customization was unchanged during the server-only before/after comparison. A completely clean VSIX baseline has not been tested, so please treat this as a report of the observed environment rather than a universal reproduction for all stock installations.
Reproduction in the affected environment
-
Open VS Code connected to the Linux remote host.
-
Connect a KQL document to an accessible Kusto cluster and database.
-
Run:
print AuthenticationCheck = 1 -
Complete the browser sign-in.
-
Immediately run the same query again.
Actual: A browser sign-in is required for both runs, although both queries eventually succeed. Reloading and signing in again did not resolve the original behavior.
Expected: Once signed in, subsequent queries reuse the authenticated session, subject to token expiry, MFA, and organizational sign-in policies.
Authentication-path analysis
In ConnectionManager.cs at v1.0.1:
- The primary connection builder uses native Kusto.Data authentication.
ShouldUseFallbackonly checks whether the cluster has been marked as requiring fallback.ExecuteAsyncpromotes the cluster after aKustoClientAuthenticationException, then retries through the host-supplied authentication provider.
Consequently, native authentication that succeeds after prompting every time does not trigger the fallback. Client-side VS Code token caching cannot help that native route.
The host bridge is already registered by Server.cs for the vscode launch argument. The proposal is to select that existing bridge proactively on remote hosts, not to introduce another credential store.
Related implementation history: Add fallback connection authentication via vscode when primary fails.
Exact locally tested server changes
1. Make host-authentication preference optional in ConnectionManager
Add this field:
private readonly bool _preferHostAuthentication;
Replace the constructor with:
public ConnectionManager(
IAuthenticationProvider? authProvider = null,
bool preferHostAuthentication = false)
{
_authProvider = authProvider;
_preferHostAuthentication = preferHostAuthentication && authProvider != null;
}
Replace ShouldUseFallback with:
internal bool ShouldUseFallback(KustoConnectionStringBuilder builder)
=> _fallbackRequiredByCluster.ContainsKey(builder.Hostname)
|| (_preferHostAuthentication
&& builder.FederatedSecurity
&& !HasExplicitAuthentication(builder)
&& Uri.TryCreate(builder.DataSource, UriKind.Absolute, out var uri)
&& uri.Scheme == Uri.UriSchemeHttps);
Update the nested KustoConnection.UseFallback property to pass the builder:
private bool UseFallback => _manager.ShouldUseFallback(_primaryBuilder);
Leave CreateFallbackBuilder, the existing explicit-authentication checks, and the native-authentication failure/retry path intact.
2. Enable the preference for the remote VS Code server
In the stream-based Server constructor, replace the existing ConnectionManager initialization with:
var tokenProvider = _args.Contains("vscode")
? (IAuthenticationProvider)this
: null;
var preferHostAuthentication = !string.IsNullOrEmpty(
Environment.GetEnvironmentVariable("VSCODE_AGENT_FOLDER"));
_connectionManager = new ConnectionManager(
tokenProvider, preferHostAuthentication);
VSCODE_AGENT_FOLDER was present in the affected remote server process. For an upstream implementation, maintainers may prefer an explicit signal from the client's vscode.env.remoteName rather than relying on this environment variable. The code above describes the exact locally validated approach, not a guarantee that this environment marker covers every remote-host type.
3. Build and reload
The local workaround was built from tag v1.0.1 with these server changes:
dotnet build src/Server/Server.csproj -c Release
After backing up the installed assembly and confirming all dependency versions matched, only the extension's server/Server.dll was replaced with the rebuilt assembly. A full Developer: Reload Window was needed: restarting only the language-server child process did not resend the saved connections in this session.
This describes a local development workaround, not a recommendation for general users to replace packaged binaries. An official extension release is the appropriate distribution mechanism.
Validation
-
Added regression cases to
ConnectionManagerTestsfor:- Selecting the host token-provider callback before any native failure.
- Two consecutive token requests using that callback.
- Preserving the preference in derived cluster/database connections.
- Preserving application credentials, user tokens, and explicit user IDs.
- Leaving HTTP and non-federated connections on their original route.
- Keeping native authentication when no host provider is registered.
-
34 focused connection/authentication tests passed, including existing tests and the added regression cases, using the project's native MSTest runner:
dotnet run --project src/ServerTests/ServerTests.csproj -c Release -- \ --filter FullyQualifiedName~Tests.Features.ConnectionManagerTests -
All 40 dependency names/versions matched the installed server.
-
Schema loading succeeded after reloading.
-
The affected user confirmed two consecutive query executions succeeded without opening a browser after the server-only change.
The full token-expiry/refresh lifecycle, sign-out/account switching, Windows desktop SSO, and other remote-host types have not been validated by this local test. These should be covered before adopting an upstream change.
Request
Could the maintainers investigate this successful-but-repeatedly-interactive native-authentication case and consider preferring the existing VS Code authentication provider on remote hosts, while preserving explicit credentials and local desktop SSO?
- 主要语言
- TypeScript
- 星标
- 6
- 派生
- 7
- 平均合并
- 1 天 6 小时
- 30 天内合并 PR
- 4
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
microsoft/Kusto-Explorer-VsCode 的其他 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 76/100
-
enhancement
难度 4/5 3-5 天 新手友好度 68/100
-
Results grid: show Count/Sum/Avg/Min/Max for selected numeric cells in a status bar可能已有人在做 @AsafMah 于 60 天前认领。 未关闭enhancement
难度 4/5 3-5 天 新手友好度 48/100
microsoft/Kusto-Explorer-VsCode#143 · 1 条评论 ·
-
Add a setting to scope the query CodeLens to the active query可能已有人在做 @AsafMah 于 59 天前认领。 未关闭enhancement
难度 4/5 3-5 天 新手友好度 68/100
-
Log Analytics / Application Insights connections truncate the full proxy URI to the bare hostname可能已有人在做 @AsafMah 于 59 天前认领。 未关闭bug
难度 3/5 1-2 天 新手友好度 55/100
microsoft/Kusto-Explorer-VsCode#139 · 1 条评论 · 1 个 reaction ·
查看 microsoft/Kusto-Explorer-VsCode 的全部 Issue
相似的 Issue
-
难度 1/5 1-3 小时 新手友好度 66/100
维护者通常 1 天内回复
-
area:plugins area:security area:skills bug has repro
难度 2/5 1-3 小时 新手友好度 76/100
anthropics/claude-code#105911 ·
维护者通常 1 天内回复
-
documentation good first issue help wanted
难度 2/5 1-3 小时 新手友好度 74/100
dev-five-git/devup-ui#879 ·
维护者通常 11 天内回复
-
openspec-apply-change skill: when blocked, may select a ready artifact unrelated to missingArtifacts未关闭
难度 2/5 1-3 小时 新手友好度 72/100
Fission-AI/OpenSpec#2165 ·
维护者通常 1 天内回复
-
🐞 bug 🧐 unconfirmed
难度 2/5 1-3 小时 新手友好度 66/100
Tencent/tdesign-vue-next#7032 · 1 条评论 ·
维护者通常 1 天内回复