warn when reading linked files - #331799
Merged
Martin Aeschlimann (aeschli) merged 2 commits intoAug 20, 2026
Merged
Conversation
Martin Aeschlimann (aeschli)
enabled auto-merge (squash)
August 20, 2026 14:13
Dirk Bäumer (dbaeumer)
previously approved these changes
Aug 20, 2026
Contributor
There was a problem hiding this comment.
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
/allowedconfigured,/allowed/link -> /secretis silently approved even though the read escapes the configured boundary. Resolve symlinks relative to the matched additional-read root before returningneedsConfirmation: 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 }) | ||
| ); | ||
| )); |
| 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 }; |
Dirk Bäumer (dbaeumer)
approved these changes
Aug 20, 2026
Martin Aeschlimann (aeschli)
deleted the
aeschli/provincial-landfowl-932
branch
August 20, 2026 15:12
Copilot started reviewing on behalf of
Martin Aeschlimann (aeschli)
August 20, 2026 16:24
View session
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Defense-in-depth fix