Description
The current implementation of PhysicalFileProvider checks exclusion filters only for the requested file or directory and ignores that this file or directory may be located inside the excluded directory (e.g., .hidden/data/config.json).
Reproduction Steps
[Test]
public void Sample()
{
var root = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
var path = Path.Join(root, ".hidden/data/config.json");
Directory.CreateDirectory(Path.GetDirectoryName(path)!);
File.WriteAllText(path, "Hello World!");
var provider = new PhysicalFileProvider(root, ExclusionFilters.Sensitive);
var file = provider.GetFileInfo(".hidden/data/config.json");
Assert.That(file.Exists, Is.False);
}
Expected behavior
The file .hidden/data/config.json should not be accessible when ExclusionFilters.Sensitive is applied.
Actual behavior
The file .hidden/data/config.json is accessible even with ExclusionFilters.Sensitive applied.
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
No response
Description
The current implementation of
PhysicalFileProviderchecks exclusion filters only for the requested file or directory and ignores that this file or directory may be located inside the excluded directory (e.g.,.hidden/data/config.json).Reproduction Steps
Expected behavior
The file
.hidden/data/config.jsonshould not be accessible whenExclusionFilters.Sensitiveis applied.Actual behavior
The file
.hidden/data/config.jsonis accessible even withExclusionFilters.Sensitiveapplied.Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
No response