Repository navigation
.Net: Reject dot segments in session upload paths - #14646
Merged
Merged
Conversation
Reject standalone . and .. path segments in model-supplied remote upload names before local file or network I/O, matching the existing Python protection. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Eduard van Valkenburg (eavanvalkenburg)
requested a review
from a team
as a code owner
October 23, 2026 12:29
Eduard van Valkenburg (eavanvalkenburg)
temporarily deployed
to
github-app-auth
October 23, 2026 12:29 — with
GitHub Actions
Inactive
Eduard van Valkenburg (eavanvalkenburg)
temporarily deployed
to
github-app-auth
October 23, 2026 12:30 — with
GitHub Actions
Inactive
Eduard van Valkenburg (eavanvalkenburg)
temporarily deployed
to
integration
October 23, 2026 12:30 — with
GitHub Actions
Inactive
Eduard van Valkenburg (eavanvalkenburg)
had a problem deploying
to
github-app-auth
October 23, 2026 12:30 — with
GitHub Actions
Failure
Copilot started reviewing on behalf of
Eduard van Valkenburg (eavanvalkenburg)
October 23, 2026 12:30
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The narrowly scoped validation matches the stated requirements and has targeted regression coverage, with no unresolved findings.
No open issues 🎉
What changed in this PR
This PR adds remote upload filename validation to the .NET SessionsPythonPlugin, rejecting standalone . and .. path segments while preserving ordinary filenames and nested paths.
Changes:
- Validate remote filenames before local file access or network I/O.
- Document the restriction in API documentation and kernel parameter metadata.
- Add regression tests for rejected paths, rejection without an HTTP request, and valid nested or dot-containing names.
| File | Description |
|---|---|
dotnet/src/Plugins/Plugins.UnitTests/Core/SessionsPythonPluginTests.cs |
Tests rejected dot segments and accepted filenames. |
dotnet/src/Plugins/Plugins.Core/CodeInterpreter/SessionsPythonPlugin.cs |
Adds early remote filename validation and documents the constraint. |
Review effort: Balanced
Use the first patched 3.x release so NuGet audit no longer fails the .NET build matrix. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Eduard van Valkenburg (eavanvalkenburg)
temporarily deployed
to
github-app-auth
October 23, 2026 14:03 — with
GitHub Actions
Inactive
Eduard van Valkenburg (eavanvalkenburg)
temporarily deployed
to
integration
October 23, 2026 14:04 — with
GitHub Actions
Inactive
Treat both slash styles as remote path separators and reject rooted, drive-qualified, and UNC upload names before file or network I/O. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Eduard van Valkenburg (eavanvalkenburg)
temporarily deployed
to
github-app-auth
October 23, 2026 17:23 — with
GitHub Actions
Inactive
Eduard van Valkenburg (eavanvalkenburg)
temporarily deployed
to
integration
October 23, 2026 17:23 — with
GitHub Actions
Inactive
westey (westey-m)
approved these changes
Oct 23, 2026
This branch was previously 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
SessionsPythonPlugin.UploadFileAsyncaccepts a model-supplied remote file name. Unlike the Python implementation, the .NET path did not reject standalone.or..path segments before placing that name in the multipart upload request. It also needed platform-independent handling for Windows separators and rooted, drive-qualified, or UNC names.Rejecting those forms keeps uploads within the intended session data path while preserving ordinary file names and relative nested paths.
The .NET build matrix also began failing NuGet audit after a new advisory was published for the centrally pinned
MessagePack3.1.7 dependency. The first patched 3.x release is 3.1.9.Description
/and\as path separators and reject dot segments, rooted names, drive prefixes, and UNC paths.MessagePackpin from 3.1.7 to 3.1.9 so the required .NET build matrix passes NuGet audit.Validation:
$env:GITHUB_ACTIONS='true'; dotnet build dotnet\samples\Demos\AgentFrameworkWithAspire\ChatWithAgent.AppHost\ChatWithAgent.AppHost.csproj -c Release --warnaserror --nologo— passed with 0 warnings and 0 errors.dotnet test dotnet\src\Plugins\Plugins.UnitTests\Plugins.UnitTests.csproj --filter FullyQualifiedName~SessionsPythonPluginTests --no-restore --nologo— passed, 53/53 tests.git diff --check— passed.Contribution Checklist