Summary
The Angular Language Service VS Code extension previously trusted workspace configuration to locate and load a TypeScript SDK library without validating workspace trust or user consent.
A malicious repository can define a custom SDK path and ship a rogue tsserverlibrary.js, causing the extension to silently execute attacker-controlled code when the folder is opened in VS Code.
Affected context
This vulnerability occurs in development environments where the Angular Language Service VS Code extension is installed and a project workspace contains custom TypeScript SDK path settings under .vscode/settings.json.
It becomes risky when developers open untrusted or third-party repositories that can control these workspace settings and place executable JavaScript libraries in referenced directories.
The issue is limited to the extension's background language server process but may be exacerbated by the privileges and network access available in the developer's environment.
Exploit preconditions
- Attack surface: VS Code workspace containing Angular projects with the Angular Language Service extension enabled.
- Required access: Ability to create or modify project files in a repository, including
.vscode/settings.jsonand directories referenced bytypescript.tsdkorjs/ts.tsdk.path. - Trigger point: The developer opens the malicious repository folder in VS Code; the extension automatically initializes the background language server using the configured SDK path.
- Why exploitation is possible: The client-side extension passes workspace-controlled SDK paths directly to the language server (
--tsdk), which then resolves and requirestsserverlibrary.jsrelative to that path without checking workspace trust, validating the library source, or prompting the user.
Why this happens
At its core, this bug stems from treating workspace configuration as trusted input for locating executable code, then performing dynamic module loading without validation.
The client extension reads typescript.tsdk and js/ts.tsdk.path from .vscode/settings.json and forwards them to the language server, which uses Node.js require() to load tsserverlibrary.js from that path.
This pattern maps to CWE-94: Improper Control of Generation of Code, as attacker-controlled paths influence which code is loaded and executed; it is also related to insecure search path and update mechanisms where untrusted directories can override expected libraries.
Potential impact
- Malicious JavaScript may execute with the privileges of the VS Code language server process.
- Attackers could exfiltrate source code, credentials, or sensitive files accessible from the developer's machine.
- Background processes may perform unauthorized network requests, such as contacting command-and-control servers.
- Developer tooling integrity could be compromised, enabling supply-chain style attacks on builds or test runs.
- Persistence mechanisms may be installed via additional scripts or configuration changes in the project.
General mitigation guidance
Mitigation generally focuses on preventing untrusted workspaces from influencing what code the extension loads and executes.
Secure patterns include tying executable library resolution to extension-controlled, well-known directories rather than workspace configuration; validating workspace trust state before honoring custom SDK paths; and requiring explicit user consent when a project attempts to override default toolchain locations.
Applying strict allowlists or schema validation to configuration values that feed into command-line arguments can reduce risk, as can designing language server processes to run with constrained privileges and limited filesystem or network access by default.
How teams detect issues like this
Detection often involves reviewing extension and tooling code for instances where user or workspace configuration directly affects executable paths, command-line flags, or module imports.
Static analysis rules can flag usages where configuration-derived strings are passed into require(), dynamic import(), or process launch parameters without normalization or trust checks.
Code review processes can emphasize examining client–server initialization flows in editor extensions, especially where background services consume configuration values without consulting workspace trust mechanisms.
Organizations may also apply policies or automated checks that scan repositories for suspicious .vscode/settings.json entries pointing SDKs or toolchains at project-local script directories.

