Repository navigation
.Net: [BREAKING] Consolidate file access - #14679
Merged
westey (westey-m) merged 7 commits intoOct 30, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Active issues cause Linux uploads to fail beneath searchable but non-listable ancestors and expose filesystem resolution errors for paths outside the upload allow-list instead of returning the normal denial.
2 open issues
What changed in this PR
This PR consolidates local file access across the .NET plugins into a shared helper that validates allowed directories and opens files using platform-specific handles.
Changes:
- Routes file reads, writes, downloads, and uploads through shared secure file access.
- Updates connector contracts to use caller-owned streams and atomic open-or-create operations; local session downloads now require allowed directories.
- Adds regression tests and a Windows, Linux, and macOS test workflow.
| File | Description |
|---|---|
dotnet/src/Plugins/Plugins.Web/WebFileDownloadPlugin.cs |
Uses shared path normalization and secure destination opening. |
dotnet/src/Plugins/Plugins.UnitTests/Web/WebFileDownloadPluginTests.cs |
Tests replacement links, overwrite races, and rejected responses. |
dotnet/src/Plugins/Plugins.UnitTests/Support/SymbolicLinkFactAttribute.cs |
Adds platform-aware attributes for filesystem tests. |
dotnet/src/Plugins/Plugins.UnitTests/Plugins.UnitTests.csproj |
Removes directly compiled utility sources. |
dotnet/src/Plugins/Plugins.UnitTests/MsGraph/OneDriveConnectorTests.cs |
Tests upload stream ownership, position, and size limits. |
dotnet/src/Plugins/Plugins.UnitTests/MsGraph/CloudDrivePluginTests.cs |
Updates stream mocks and adds outside-link rejection coverage. |
dotnet/src/Plugins/Plugins.UnitTests/Document/LocalFileSystemConnectorTests.cs |
Tests secure document access, preservation, and cancellation. |
dotnet/src/Plugins/Plugins.UnitTests/Document/DocumentPluginTests.cs |
Adapts mocks to the revised filesystem contract. |
dotnet/src/Plugins/Plugins.UnitTests/Core/SessionsPythonPluginTests.cs |
Tests download restrictions and link replacement. |
dotnet/src/Plugins/Plugins.UnitTests/Core/SecureFileSystemTests.cs |
Covers allowed paths, file modes, links, and special files. |
dotnet/src/Plugins/Plugins.MsGraph/ICloudDriveConnector.cs |
Changes uploads from local paths to caller-owned streams. |
dotnet/src/Plugins/Plugins.MsGraph/Connectors/OneDriveConnector.cs |
Uploads provided streams without taking ownership. |
dotnet/src/Plugins/Plugins.MsGraph/CloudDrivePlugin.cs |
Securely opens local upload content. |
dotnet/src/Plugins/Plugins.Document/FileSystem/LocalFileSystemConnector.cs |
Delegates restricted reads and updates to the shared helper. |
dotnet/src/Plugins/Plugins.Document/FileSystem/IFileSystemConnector.cs |
Defines restricted reads and atomic open-or-create updates. |
dotnet/src/Plugins/Plugins.Document/DocumentPlugin.cs |
Passes allowed directories and uses creation status when appending. |
dotnet/src/Plugins/Plugins.Core/Plugins.Core.csproj |
Exposes internals to plugin unit tests. |
dotnet/src/Plugins/Plugins.Core/FileIOPlugin.cs |
Uses secure reads and atomic overwrite protection. |
dotnet/src/Plugins/Plugins.Core/CodeInterpreter/SessionsPythonSettings.cs |
Documents deny-by-default local download saves. |
dotnet/src/Plugins/Plugins.Core/CodeInterpreter/SessionsPythonPlugin.cs |
Uses secure upload and download streams. |
dotnet/src/InternalUtilities/src/System/SecureFileSystem.cs |
Adds shared validation and platform-specific secure file opening. |
dotnet/samples/Demos/CodeInterpreterPlugin/Program.cs |
Clarifies download configuration in a comment. |
.github/workflows/dotnet-secure-file-tests.yml |
Runs focused filesystem tests across three operating systems. |
Review effort: Balanced
SergeyMenshykh
previously approved these changes
Oct 30, 2026
SergeyMenshykh
previously approved these changes
Oct 30, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Oct 30, 2026
Roger Barreto (rogerbarreto)
previously approved these changes
Oct 30, 2026
Roger Barreto (rogerbarreto)
approved these changes
Oct 30, 2026
This branch was successfully deployed
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.

Motivation and Context
Different plugins were using their own code for various file checks and file access.
Description
This PR consolidates file access to some common shared components.
Contribution Checklist