Skip to content

Commit 3ec2dea

Browse files
Merge pull request intersystems-community#991 from gjsjohnmurray/pre-fix-989
Allow `serverForUri` API to return insecure password from `intersystems.servers` (intersystems-community#989)
2 parents 15c9066 + 258cbee commit 3ec2dea

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/extension.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,14 +1102,14 @@ export async function activate(context: vscode.ExtensionContext): Promise<any> {
11021102
reporter && reporter.sendTelemetryEvent("extensionActivated");
11031103

11041104
// The API we export
1105-
const api = {
1105+
const extensionApi = {
11061106
serverForUri(uri: vscode.Uri): any {
11071107
const { apiTarget } = connectionTarget(uri);
11081108
const api = new AtelierAPI(apiTarget);
11091109

1110-
// We explicitly no longer expose the password for named servers.
1111-
// API client extensions can use Server Manager 3's authentication provider to get this,
1112-
// which will require user consent.
1110+
// This function intentionally no longer exposes the password for a named server UNLESS it is already exposed as plaintext in settings.
1111+
// API client extensions should use Server Manager 3's authentication provider to request a missing password themselves,
1112+
// which will require explicit user consent to divulge the password to the requesting extension.
11131113

11141114
const {
11151115
serverName,
@@ -1131,7 +1131,12 @@ export async function activate(context: vscode.ExtensionContext): Promise<any> {
11311131
port,
11321132
pathPrefix,
11331133
username,
1134-
password: serverName === "" ? password : undefined,
1134+
password:
1135+
serverName === ""
1136+
? password
1137+
: vscode.workspace
1138+
.getConfiguration(`intersystems.servers.${serverName.toLowerCase()}`, uri)
1139+
.get("password"),
11351140
namespace: ns,
11361141
apiVersion: active ? apiVersion : undefined,
11371142
};
@@ -1164,7 +1169,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<any> {
11641169
};
11651170

11661171
// 'export' our public API
1167-
return api;
1172+
return extensionApi;
11681173
}
11691174

11701175
export function deactivate(): void {

0 commit comments

Comments
 (0)