Skip to content

Open-source Revit MCP server: let Claude and other AI assistants read and edit BIM models, with human approval on every change.

Fix MSAL security advisory in VS Code packaging dependencies

S Mohammad252de35a9c9b
diff --git a/extensions/vscode/README.md b/extensions/vscode/README.md
index 3af1b5c..31c3665 100644
--- a/extensions/vscode/README.md
+++ b/extensions/vscode/README.md
@@ -43,6 +43,15 @@ code --install-extension aec-model-bridge-1.3.3.vsix
Use the filename printed by the package command if the repository version has
changed. Compilation and automated tests do not establish live Revit behavior.
+
+The packaging tool's Azure Identity dependency currently requires MSAL 6, which
+is affected by [GHSA-xcx6-jx8p-x3h5](https://github.com/advisories/GHSA-xcx6-jx8p-x3h5).
+A scoped npm override uses MSAL 7.1.2 or newer within major 7 for `@vscode/vsce`
+only. MSAL 7 removes the interactive browser `responseMode` option; VSCE's Azure
+credential chain does not use that flow. The tests exercise Azure Identity's
+client-secret authentication with simulated HTTP responses. Remove the override
+when VSCE's dependencies accept a patched MSAL release themselves.
+
Before publishing, check registration in a real VS Code instance, mock startup,
the approval warning and cancellation, configuration changes and restarts,
and connection status against a running Revit add-in. Use a disposable model
diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json
index e13130f..84eb0a5 100644
--- a/extensions/vscode/package-lock.json
+++ b/extensions/vscode/package-lock.json
@@ -186,13 +186,13 @@
}
},
"node_modules/@azure/msal-node": {
- "version": "6.0.1",
- "resolved": "https://registry.npmjs.org/@azure/msal-node/-/msal-node-6.0.1.tgz",
- "integrity": "sha512-ixSO1Y/kCVRthRs+hSx/5qkwaunX1/RAePhlMN0wIpIQ4WEZ6AREGGnGd1AP0qspHVsAwzWQKGubpjh50JyJIQ==",
+ "version": "7.1.2",
+ "resolved": "https://registry.npmjs.org/@azure/msal-node/-/msal-node-7.1.2.tgz",
+ "integrity": "sha512-52hKQLGpEQzwNufIXG1SPVU+wQ3RIe7Rp2+g+VdAmZojCAZ6yCdGEffzQEQ6RnBZGBEs40nl14rWBmfJpCoHsg==",
"dev": true,
"license": "MIT",
"dependencies": {
- "@azure/msal-common": "16.14.1",
+ "@azure/msal-common": "16.15.0",
"jsonwebtoken": "^9.0.0"
},
"engines": {
@@ -200,9 +200,9 @@
}
},
"node_modules/@azure/msal-node/node_modules/@azure/msal-common": {
- "version": "16.14.1",
- "resolved": "https://registry.npmjs.org/@azure/msal-common/-/msal-common-16.14.1.tgz",
- "integrity": "sha512-Or6xhPNyi4zHW25158yxBoyxuCqNSPa5YBVqfF1J5Ks4MJWBo/USXdp05DQIPu1Zli00YZu6t0+h6KvHJealxQ==",
+ "version": "16.15.0",
+ "resolved": "https://registry.npmjs.org/@azure/msal-common/-/msal-common-16.15.0.tgz",
+ "integrity": "sha512-lwdLb1B9Q5nEhPLVIKe78XH5wFMN15fCiDkY7ylPDSWZuWcD93G3jpJajrKhO3CQld8SLKz0sHiOi24mxdvtsg==",
"dev": true,
"license": "MIT",
"engines": {
diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json
index 5e43111..15fb341 100644
--- a/extensions/vscode/package.json
+++ b/extensions/vscode/package.json
@@ -136,6 +136,13 @@
"package": "vsce package --no-dependencies",
"vscode:prepublish": "npm run compile"
},
+ "overrides": {
+ "@vscode/vsce": {
+ "@azure/identity": {
+ "@azure/msal-node": "^7.1.2"
+ }
+ }
+ },
"devDependencies": {
"@types/node": "^20.14.0",
"@types/vscode": "1.101.0",
diff --git a/extensions/vscode/test/packaging-auth.test.ts b/extensions/vscode/test/packaging-auth.test.ts
new file mode 100644
index 0000000..bbde035
--- /dev/null
+++ b/extensions/vscode/test/packaging-auth.test.ts
@@ -0,0 +1,89 @@
+import { createRequire } from "node:module";
+import { afterEach, describe, expect, it, vi } from "vitest";
+
+// Resolve through VSCE so this checks the overridden dependency it actually uses,
+// including when npm nests its Azure packages instead of hoisting them.
+const fromVsce = createRequire(require.resolve("@vscode/vsce/package.json"));
+const fromIdentity = createRequire(fromVsce.resolve("@azure/identity"));
+const { EnvironmentCredential } = fromVsce("@azure/identity");
+const { ConfidentialClientApplication } = fromIdentity("@azure/msal-node");
+const { createHttpHeaders } = fromIdentity("@azure/core-rest-pipeline");
+
+const tenant = "11111111-1111-1111-1111-111111111111";
+const clientId = "22222222-2222-2222-2222-222222222222";
+const authority = `https://login.microsoftonline.com/${tenant}`;
+
+afterEach(() => vi.unstubAllEnvs());
+
+describe("VSCE's patched MSAL dependency", () => {
+ it("supports Azure Identity client-secret authentication without network access", async () => {
+ vi.stubEnv("AZURE_TENANT_ID", tenant);
+ vi.stubEnv("AZURE_CLIENT_ID", clientId);
+ vi.stubEnv("AZURE_CLIENT_SECRET", "synthetic-test-secret");
+ vi.stubEnv("AZURE_AUTHORITY_HOST", "https://login.microsoftonline.com");
+
+ const requests: Array<{ url: string; method: string; body?: unknown }> = [];
+ const credential = new EnvironmentCredential({
+ disableInstanceDiscovery: true,
+ httpClient: {
+ async sendRequest(request: { url: string; method: string; body?: unknown }) {
+ requests.push(request);
+ const url = new URL(request.url);
+ const endpoint = `${url.origin}${url.pathname}`;
+ let body: object;
+ if (endpoint === `${authority}/v2.0/.well-known/openid-configuration`) {
+ body = {
+ authorization_endpoint: `${authority}/oauth2/v2.0/authorize`,
+ token_endpoint: `${authority}/oauth2/v2.0/token`,
+ issuer: `${authority}/v2.0`,
+ jwks_uri: `${authority}/discovery/v2.0/keys`,
+ };
+ } else if (endpoint === `${authority}/oauth2/v2.0/token`) {
+ body = {
+ token_type: "Bearer",
+ access_token: "synthetic-access-token",
+ expires_in: 3600,
+ };
+ } else {
+ throw new Error(`Unexpected authentication request: ${request.url}`);
+ }
+ return {
+ request,
+ status: 200,
+ headers: createHttpHeaders({ "content-type": "application/json" }),
+ bodyAsText: JSON.stringify(body),
+ };
+ },
+ },
+ });
+
+ const token = await credential.getToken("499b84ac-1321-427f-aa17-267ca6975798/.default")
+ .catch((cause: unknown) => {
+ throw new Error(`Authentication failed after requests to ${requests.map((r) => r.url).join(", ")}`, { cause });
+ });
+ expect(token.token).toBe("synthetic-access-token");
+ const tokenRequests = requests.filter((r) => r.method === "POST");
+ expect(tokenRequests).toHaveLength(1);
+ const payload = new URLSearchParams(String(tokenRequests[0].body));
+ expect(payload.get("grant_type")).toBe("client_credentials");
+ expect(payload.get("client_id")).toBe(clientId);
+ expect(payload.get("client_secret")).toBe("synthetic-test-secret");
+ });
+
+ it("rejects instance-aware confidential clients implicated in GHSA-xcx6-jx8p-x3h5", () => {
+ expect(() => new ConfidentialClientApplication({
+ auth: { clientId, clientSecret: "synthetic-test-secret", authority, instanceAware: true },
+ })).toThrow(/unsupported_cca_instance_aware/);
+ });
+
+ it("rejects instance-aware authorization requests before making HTTP calls", async () => {
+ const client = new ConfidentialClientApplication({
+ auth: { clientId, clientSecret: "synthetic-test-secret", authority },
+ });
+ await expect(client.getAuthCodeUrl({
+ scopes: ["https://graph.microsoft.com/.default"],
+ redirectUri: "http://localhost",
+ extraQueryParameters: { instance_aware: "true" },
+ })).rejects.toMatchObject({ errorCode: "unsupported_cca_instance_aware" });
+ });
+});