Skip to content

warn when reading linked files - #331799

Merged
Martin Aeschlimann (aeschli) merged 2 commits into
mainfrom
aeschli/provincial-landfowl-932
Aug 20, 2026
Merged

warn when reading linked files#331799
Martin Aeschlimann (aeschli) merged 2 commits into
mainfrom
aeschli/provincial-landfowl-932

Conversation

@aeschli

@aeschli Martin Aeschlimann (aeschli) commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Defense-in-depth fix

Copilot AI balanced review requested due to automatic review settings August 20, 2026 14:13
@aeschli Martin Aeschlimann (aeschli) changed the title warn when reading symlinked files warn when reading linked files Aug 20, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds confirmation warnings when read tools access workspace paths that resolve through symlinks outside the workspace.

Changes:

  • Detects external symlink targets and returns their resolved paths.
  • Updates read, image, and search tools for the new result type.
  • Adds symlink-resolution tests.
Show a summary per file
File Description
viewImageTool.tsx Handles the new confirmation result.
toolUtils.ts Adds symlink detection and real-path resolution.
toolUtils.spec.ts Tests symlink scenarios and updated results.
searchSubagentTool.spec.ts Updates mocks for the new result type.
searchSubagentTool.ts Consumes the structured confirmation result.
readFileTool.tsx Displays external symlink targets in confirmations.
editFileToolUtils.tsx Reuses the shared real-path resolver.

Review details

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Suppressed comments (1)

extensions/copilot/src/extension/tools/node/toolUtils.ts:309

  • This early return still trusts only the lexical additional-read path. For example, with /allowed configured, /allowed/link -> /secret is silently approved even though the read escapes the configured boundary. Resolve symlinks relative to the matched additional-read root before returning needsConfirmation: false.
	if (options?.readOnly && isUriUnderAdditionalReadAccessPaths(normalizedUri, configurationService)) {
		return { needsConfirmation: false, realPath: undefined };
  • Files reviewed: 7/7 changed files
  • Comments generated: 4
  • Review effort level: Balanced

Comment on lines +281 to +283
({ needsConfirmation: isExternal } = await this.instantiationService.invokeFunction(accessor =>
isFileExternalAndNeedsConfirmation(accessor, uri, this._inputContext, { readOnly: true, workingDirectory })
);
));
Comment thread extensions/copilot/src/extension/tools/node/toolUtils.ts
this.assertImageFile(uri);

const isExternal = await this.instantiationService.invokeFunction(
const { needsConfirmation } = await this.instantiationService.invokeFunction(
Comment on lines +305 to +306
const realPath = await getExternalSymlinkRealPath(normalizedUri, uri => workingDir.getFolder(uri));
return { needsConfirmation: realPath !== undefined, realPath };
@aeschli
Martin Aeschlimann (aeschli) merged commit 680caf2 into main Aug 20, 2026
27 checks passed
@aeschli
Martin Aeschlimann (aeschli) deleted the aeschli/provincial-landfowl-932 branch August 20, 2026 15:12
@vs-code-engineering vs-code-engineering Bot added this to the 1.135.0 milestone Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants