Skip to content

fix: authenticate Visual Studio bridge - #3202

Open
Tal Zaccai (TalZaccai) wants to merge 6 commits into
mainfrom
dev/talzacc/secure-visual-studio-bridge-auth
Open

Tal Zaccai (TalZaccai) wants to merge 6 commits into
mainfrom
dev/talzacc/secure-visual-studio-bridge-auth

Conversation

@TalZaccai

@TalZaccai Tal Zaccai (TalZaccai) commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Issue

The Visual Studio extension trusted an unauthenticated localhost discovery response and action WebSocket. A local impostor could substitute the bridge endpoint and dispatch arbitrary IDE actions, including named commands with attacker-controlled arguments.

Mitigating steps

  • Authenticate Visual Studio discovery responses before trusting returned ports.
  • Provision fail-closed, ACL-protected per-user bootstrap credentials.
  • Add mutual action-channel authentication with directional session keys, replay protection, and expiry enforcement.
  • Dispatch executor actions only after authentication and bind responses to the exact client/session.
  • Preserve authenticated explicit-port overrides, reconnects, multiple-client routing/fallback, and browser-Origin rejection.
  • Avoid logging bootstrap secrets, proofs, session keys, or authenticated envelopes.
  • Add ephemeral-loopback C# and TypeScript regressions using stub/recording executors.
  • Validate affected TypeScript/C# builds, the VSIX build, focused tests, frozen lockfile, formatting, and repository ratchet gates.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Connection lifecycle failures and a clock-dependent regression fixture remain unresolved.

4 open issues
1 file not reviewed
  • ts/pnpm-lock.yaml: Generated file
What changed in this PR

Authenticates the bridge between TypeAgent and Visual Studio before trusting discovery results or dispatching IDE actions.

Changes:

  • Adds protected per-user credentials and authenticated discovery.
  • Adds session-based action authentication, replay protection, and response ownership checks.
  • Adds regression tests, build wiring, and authentication documentation.
File Description
ts/​pnpm-lock.yaml Records new test dependencies.
ts/​packages/​utils/​webSocketUtils/​src/​visualStudioBridgeAuth.ts Implements credentials and authentication primitives.
ts/​packages/​utils/​webSocketUtils/​package.json Exports authentication utilities.
ts/​packages/​shell/​src/​main/​discoveryServer.ts Protects shell discovery responses.
ts/​packages/​agentServer/​server/​src/​connectionHandler.ts Protects server discovery responses.
ts/​packages/​agentServer/​protocol/​src/​protocol.ts Adds discovery authentication contracts and hooks.
ts/​packages/​agentServer/​protocol/​src/​index.ts Exports discovery authentication types.
ts/​packages/​agents/​visualStudio/​tsconfig.json Includes the test project.
ts/​packages/​agents/​visualStudio/​test/​visualStudioBridgeAuth.spec.ts Tests authentication and client routing.
ts/​packages/​agents/​visualStudio/​test/​tsconfig.json Configures test compilation.
ts/​packages/​agents/​visualStudio/​src/​visualStudioActionHandler.ts Authenticates clients and binds responses to sessions.
ts/​packages/​agents/​visualStudio/​src/​originAllowlist.ts Rejects explicit null origins.
ts/​packages/​agents/​visualStudio/​README.md Documents authentication and overrides.
ts/​packages/​agents/​visualStudio/​package.json Adds test scripts and dependencies.
dotnet/​visualStudioTypeAgent/​VisualStudioTypeAgent.csproj Includes authentication sources and security reference.
dotnet/​visualStudioTypeAgent/​Bridge/​DTEActionExecutor.cs Implements the executor interface.
dotnet/​visualStudioTypeAgent/​Bridge/​BridgeDiscovery.cs Verifies discovery proofs before accepting ports.
dotnet/​visualStudioTypeAgent/​Bridge/​BridgeAuthentication.cs Implements credential validation and cryptographic framing.
dotnet/​visualStudioTypeAgent/​Bridge/​AuthenticatedBridgeConnection.cs Gates execution behind authenticated sessions.
dotnet/​visualStudioTypeAgent/​Bridge/​AgentBridgeClient.cs Uses authenticated discovery and connections.
dotnet/​visualStudioTypeAgent.Tests/​VisualStudioTypeAgent.Tests.csproj Adds the C# regression harness.
dotnet/​visualStudioTypeAgent.Tests/​VisualStudioTypeAgent.BridgeCompile.csproj Adds framework compatibility compilation.
dotnet/​visualStudioTypeAgent.Tests/​Program.cs Tests proofs, replay rejection, and executor gating.
dotnet/​visualStudioTypeAgent.Tests/​BridgeCompileStubs.cs Supplies isolated Visual Studio stubs.

Review effort: Balanced

Comment thread dotnet/visualStudioTypeAgent.Tests/Program.cs Outdated
Comment thread dotnet/visualStudioTypeAgent/Bridge/AuthenticatedBridgeConnection.cs Outdated
Comment thread ts/packages/agents/visualStudio/src/visualStudioActionHandler.ts
Comment thread ts/packages/agents/visualStudio/src/visualStudioActionHandler.ts Outdated
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants