From 02e21d90451b499bbbe50883e0750f21eea90457 Mon Sep 17 00:00:00 2001 From: Anthony Kim Date: Tue, 11 Mar 2025 13:14:01 -0700 Subject: [PATCH] Use Object.freeze when exposing extension API --- .../api/common/extHostTerminalShellIntegration.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/api/common/extHostTerminalShellIntegration.ts b/src/vs/workbench/api/common/extHostTerminalShellIntegration.ts index cc5fccb9a8df8..1f8879fb7b575 100644 --- a/src/vs/workbench/api/common/extHostTerminalShellIntegration.ts +++ b/src/vs/workbench/api/common/extHostTerminalShellIntegration.ts @@ -184,7 +184,13 @@ class InternalTerminalShellIntegration extends Disposable { return that._cwd; }, get env(): vscode.TerminalShellIntegrationEnvironment | undefined { - return that._env; + if (!that._env) { + return undefined; + } + return Object.freeze({ + isTrusted: that._env.isTrusted, + value: Object.freeze({ ...that._env.value }) + }); }, get hasRichCommandDetection(): boolean { return that._hasRichCommandDetection;