Skip to content

Commit 96c9e86

Browse files
authored
.Net: [BREAKING] Consolidate file access (#14679)
### 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 <!-- Before submitting this PR, please make sure: --> - [ ] The code builds clean without any errors or warnings - [ ] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [ ] All unit tests pass, and I have added new tests where possible - [ ] I didn't break anyone 😄
1 parent fa3962b commit 96c9e86

24 files changed

Lines changed: 2527 additions & 325 deletions
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: dotnet-secure-file-tests
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
paths:
7+
- '.github/workflows/dotnet-secure-file-tests.yml'
8+
- 'dotnet/src/InternalUtilities/**'
9+
- 'dotnet/src/Plugins/**'
10+
- 'dotnet/Directory.*.props'
11+
- 'dotnet/global.json'
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
test:
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
os: [ubuntu-latest, windows-latest, macos-latest]
22+
runs-on: ${{ matrix.os }}
23+
steps:
24+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
25+
with:
26+
persist-credentials: false
27+
- uses: actions/setup-dotnet@26b0ec14cb23fa6904739307f278c14f94c95bf1 # v5.4.0
28+
with:
29+
global-json-file: dotnet/global.json
30+
- name: Test secure file operations
31+
run: >-
32+
dotnet test dotnet/src/Plugins/Plugins.UnitTests/Plugins.UnitTests.csproj
33+
--filter "FullyQualifiedName~SecureFileSystemTests|FullyQualifiedName~FileIOPluginTests|FullyQualifiedName~SessionsPythonPluginTests|FullyQualifiedName~WebFileDownloadPluginTests|FullyQualifiedName~CloudDrivePluginTests|FullyQualifiedName~DocumentPluginTests|FullyQualifiedName~LocalFileSystemConnectorTests|FullyQualifiedName~OneDriveConnectorTests|FullyQualifiedName~PathUtilitiesTests"

‎dotnet/samples/Demos/CodeInterpreterPlugin/Program.cs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ async Task<string> TokenProvider(CancellationToken cancellationToken)
6565
// Uncomment the following lines to enable file upload operations (disabled by default for security)
6666
// settings.EnableDangerousFileUploads = true;
6767
// settings.AllowedUploadDirectories = new[] { @"C:\allowed\upload\directory" };
68+
// Local download saves also require an allowed directory; returning bytes does not.
6869
// settings.AllowedDownloadDirectories = new[] { @"C:\allowed\download\directory" };
6970

7071
Console.WriteLine("=== Code Interpreter With Azure Container Apps Plugin Demo ===\n");

0 commit comments

Comments
 (0)