Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a security issue where the static file tree was exposing all folders at the application root instead of only the intended App_Plugins and wwwroot folders. The fix moves the filtering logic from the controller layer into the PhysicalFileSystemTreeService, ensuring that only files and folders within the allowed directories are accessible through the Management API.
Key Changes
- Moved path filtering logic to
PhysicalFileSystemTreeServiceto restrict access toApp_Pluginsandwwwrootfolders only - Added comprehensive integration tests for the
PhysicalFileSystemTreeServiceto verify filtering behavior - Refactored test helper methods and naming conventions for better consistency across test files
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Umbraco.Cms.Api.Management/Services/FileSystem/PhysicalFileSystemTreeService.cs | Implements path filtering logic to only allow access to App_Plugins and wwwroot folders |
| src/Umbraco.Cms.Api.Management/Services/FileSystem/FileSystemTreeServiceBase.cs | Makes GetDirectories and GetFiles methods virtual to allow override in derived classes |
| src/Umbraco.Cms.Api.Management/Controllers/StaticFile/Tree/StaticFileTreeControllerBase.cs | Adds override keyword to GetDirectories and GetFiles methods for backward compatibility with obsolete constructor path |
| tests/Umbraco.Tests.Integration/ManagementApi/Services/Trees/PhysicalFileSystemTreeServiceTests.cs | Adds comprehensive tests for PhysicalFileSystemTreeService including security filtering validation |
| tests/Umbraco.Tests.Integration/ManagementApi/Services/Trees/FileSystemTreeServiceTestsBase.cs | Refactors CreateStream helper to remove unused parameter and extracts CreateFiles to separate method |
| tests/Umbraco.Tests.Integration/ManagementApi/Services/Trees/StyleSheetTreeServiceTests.cs | Simplifies test names and variable naming, updates CreateStream usage |
| tests/Umbraco.Tests.Integration/ManagementApi/Services/Trees/ScriptTreeServiceTests.cs | Simplifies test names and variable naming, updates CreateStream usage |
| tests/Umbraco.Tests.Integration/ManagementApi/Services/Trees/PartialViewTreeServiceTests.cs | Simplifies test names and variable naming, updates CreateStream usage |
...Umbraco.Tests.Integration/ManagementApi/Services/Trees/PhysicalFileSystemTreeServiceTests.cs
Show resolved
Hide resolved
...Umbraco.Tests.Integration/ManagementApi/Services/Trees/PhysicalFileSystemTreeServiceTests.cs
Outdated
Show resolved
Hide resolved
src/Umbraco.Cms.Api.Management/Services/FileSystem/PhysicalFileSystemTreeService.cs
Outdated
Show resolved
Hide resolved
Zeegaan
requested changes
Dec 1, 2025
Member
Zeegaan
left a comment
There was a problem hiding this comment.
Overall looks good and tests good, just have a single comment about the breaking change 🫡
tests/Umbraco.Tests.Integration/ManagementApi/Services/Trees/FileSystemTreeServiceTestsBase.cs
Outdated
Show resolved
Hide resolved
Member
|
Cherry picked for 17.0.1 💪 |
This was referenced Dec 8, 2025
Closed
Bump Umbraco.Cms.Persistence.EFCore from 17.0.0 to 17.0.1
karl-sjogren/umbraco-extend-everything#134
Closed
Merged
This was referenced Dec 8, 2025
This was referenced Jan 26, 2026
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.
Prerequisites
Fixes: #20962
Description
With some recent refactoring to introduce services to back the various file system trees, the filter to only provide items from
App_Pluginsandwwwrootwas lost, leading to the linked issue.This PR reintroduces that.
Testing
Testing will currently have to be done via the management API as there seems to be a front-end regression since 17.0 in
mainthat needs to be resolved.Should return:
And not any other folders found at the root of the application.
Requests such as the following for child items should also work: