Skip to content

Shell integration nonce unavailable in unknown shells and Pseudoterminal-based extension terminals #190253

@pfitzseb

Description

@pfitzseb

Does this issue occur when all extensions are disabled?: Yes/No

  • VS Code Version: 1.82.0-insider
  • OS Version: Linux x64 6.4.6-1-MANJARO

Steps to Reproduce:

  1. Create a terminal with a shell that does not officially support shell integration, e.g. Julia.
  2. Check the value of the VSCODE_NONCE environment variable

When opening a Julia REPL through the extension, the expected warning is shown:

2023-08-10 17:18:24.085 [warning] Shell integration cannot be enabled for executable "/home/pfitzseb/Documents/julia-1.8.5/bin/julia" and args ["-i","--banner=no","--project=/home/pfitzseb/.julia/environments/v1.9","--sysimage=/home/pfitzseb/Documents/Git/sysimgtest/sysimg.so","--project=/home/pfitzseb/Documents/Git/sysimgtest","--threads=auto","/home/pfitzseb/.vscode-insiders/extensions/julialang.language-julia-1.48.1/scripts/terminalserver/terminalserver.jl","/tmp/vsc-jl-repl-901c22ba-51e1-41a7-a1b6-4aacdc696676","/tmp/vsc-jl-cr-54bf6211-7f7f-4cdc-825c-e19c2557ca71","USE_REVISE=false","USE_PLOTPANE=true","USE_PROGRESS=true","ENABLE_SHELL_INTEGRATION=true","DEBUG_MODE=false"]

This happens because the environment variable is only injected if VS Code detects a supported shell (which means that a script for handling shell integration is vendored):

logService.warn(`Shell integration cannot be enabled for executable "${shellLaunchConfig.executable}" and args`, shellLaunchConfig.args);
return undefined;
}

An easy solution is to allow extensions to set the nonce in vscode.window.createTerminal (it's then the extension's responsibility to only start shells that properly handle and unset the VSCODE_NONCE env var). Not sure if that holds up to the desired security standards though :)

cc @Tyriar

Metadata

Metadata

Assignees

Labels

apiapi-proposalfeature-requestRequest for new features or functionalityinsiders-releasedPatch has been released in VS Code Insiderson-release-notesIssue/pull request mentioned in release notesterminal-shell-integrationShell integration infrastructure, command decorations, etc.verifiedVerification succeeded

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions