From 6df0caea09abff2ccfa1969cfe5209dae2c107ee Mon Sep 17 00:00:00 2001 From: tuanaiseo Date: Fri, 10 Apr 2026 20:46:28 +0700 Subject: [PATCH] fix(security)(platform): unvalidated uri schemes passed to vs code opener The `open` method accepts an arbitrary string and directly passes `vscode.Uri.parse(target)` into `vscode.open` without validating scheme or destination. If `target` can be influenced by untrusted input (e.g., chat/tool output), this may allow opening dangerous URI schemes (including command-like or external handlers), enabling phishing flows or unintended command execution paths in the host environment. Affected files: opener.ts Signed-off-by: tuanaiseo <221258316+tuanaiseo@users.noreply.github.com> --- src/platform/open/vscode/opener.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/platform/open/vscode/opener.ts b/src/platform/open/vscode/opener.ts index 6dc4e41df6..b446032d47 100644 --- a/src/platform/open/vscode/opener.ts +++ b/src/platform/open/vscode/opener.ts @@ -11,6 +11,11 @@ export class RealUrlOpener implements IUrlOpener { declare readonly _serviceBrand: undefined; async open(target: string): Promise { - await vscode.commands.executeCommand('vscode.open', vscode.Uri.parse(target)); + const uri = vscode.Uri.parse(target, true); + if (uri.scheme !== 'https' && uri.scheme !== 'http') { + throw new Error(`Unsupported URI scheme: ${uri.scheme}`); + } + + await vscode.commands.executeCommand('vscode.open', uri); } }