Closed
Description
I spent a good amount of time trying to figure out why a Configuration Provider using the PhysicalFileProvider
refused to read a dot-prefixed file (E.g. .env
).
It turns out, dot-prefixed files are considered sensitive:
It was introduced as part of this PR in the previous repository: aspnet/FileSystem#280
After finding this, I had two questions:
- Why are dot-prefixed files considered sensitive?
- Why are sensitive files excluded from
PhysicalFileProvider
by default.
For further context, I'm working on an app where I need to read the configuration from a file called .env
. I kept getting FileNotFoundExceptions
and had to dig into the source code to find out why.
I've attempted to address the confusing error in this PR: #54717