Skip to content

Connection sharing #19542

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

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open

Connection sharing #19542

wants to merge 19 commits into from

Conversation

aasimkhan30
Copy link
Contributor

@aasimkhan30 aasimkhan30 commented Jun 6, 2025

Pull Request Template – vscode-mssql

Description

PR Description

Fixes #19456
This PR adds support for managing third-party extension access to MSSQL connections through a permission-based model.

πŸ” Permission Request Flow

  1. When a new extension requests access to MSSQL connections, users will see a prompt like the one below:
    Permission Prompt

  2. Upon approval, the extension gains the ability to:

    • Access the active editor's connection profile
    • Connect to an existing connection
    • Execute queries on behalf of the user
    • Get server info
    • List databases in the server

βš™οΈ Managing Permissions

Users can manage permissions through the "Edit Permissions" command:

  1. Run the Edit Permissions command
    Command Palette

  2. Select the extension for which you want to manage access
    Extension Picker

  3. Modify the permissions granted to that extension
    Edit Permissions UI


🧹 Clearing All Permissions

Users can also reset all granted permissions via the "Clear All Permissions" command:

  1. Run the command
    Clear All

  2. A confirmation dialog will appear to prevent accidental revocation
    Confirmation Prompt


Code Changes Checklist

  • New or updated unit tests added
  • All existing tests pass (npm run test)
  • Code follows contributing guidelines
  • Telemetry/logging updated if relevant
  • No regressions or UX breakage

Reviewers: Please read our reviewer guidelines

aasimkhan30 and others added 12 commits June 4, 2025 12:13
…management

- Added commands for connection sharing: getConnectionIdForActiveEditor, connect, disconnect, isConnected, executeSimpleQuery, getServerInfo, and editConnectionSharingPermissions.
- Updated connection sharing approval logic to handle denied status.
- Introduced method to retrieve connection info from a given file URI in ConnectionManager.
- Modified type definitions for connect and getServerInfo methods to return promises and appropriate types.
- Created a new VS Code extension for connection sharing.
- Added package.json to define extension metadata and commands.
- Implemented the main extension logic in src/extension.ts, including a command to execute a simple query.
- Added TypeScript configuration in tsconfig.json for strict type-checking.
- Included a test suite in src/test/extension.test.ts with a sample test case.
- Updated connectionSharingService.ts to handle new permission options including "Clear" for resetting approvals.
- Enhanced user prompts for connection sharing permissions with current status indicators.
Copy link

github-actions bot commented Jun 13, 2025

PR Changes

Category Main Branch PR Branch Difference
Code Coverage 59.56% 58.78% βšͺ 0.00%
VSIX Size 15430 KB 15451 KB βšͺ 21 KB ( 0% )
Webview Bundle Size 3768 KB 3768 KB βšͺ 0 KB ( 0% )

@MikhailProfile
Copy link

Good day @aasimkhan30 !

In continue of #19456

Could we add a function to API - something like scriptObject, pass object name (table name, stored procedure, function etc.) and ScriptOperation (select, create, insert, update, delete, execute, alter) and get result script in string back?

Thanks!


2. Open this sample extension in VS Code
3. In the Run and Debug view, select the "Run Extension" configuration
4. It should launch a new VS Code window with the extension activated
Copy link
Contributor

Choose a reason for hiding this comment

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

Aren't these the normal instructions for running the MSSQL extension? Does anything need to be changed here for connection-sharing-sample?

@@ -0,0 +1,48 @@
# Welcome to your VS Code Extension
Copy link
Contributor

Choose a reason for hiding this comment

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

Update or remove this file

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.

[Feature Request]: Get connection credentials by file uri
4 participants