Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate an error or warning when building under the downloads folder #45342

Open
dsplaisted opened this issue Dec 5, 2024 · 4 comments
Open
Labels
Milestone

Comments

@dsplaisted
Copy link
Member

Building a project under the downloads folder is not very safe. This is because of things like Directory.Build.props, which mean that you need to trust all of the parent folders of your source code up to the root. Most browsers will download files to the downloads folder with no additional confirmation when you click a link, so a malicious link could put a Directory.Build.props file in your downloads folder, and then execute code in your build when you subsequently built a project that had been downloaded (or extracted) under the downloads folder.

We should probably fail outright, or at least warn, when trying to build a project under the Downloads folder.

This probably makes sense to be an MSBuild feature. Possibly it should be a BuildCheck, but maybe it should just be built into MSBuild by default before it even tries to start the build.

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-NetSDK untriaged Request triage from a team member labels Dec 5, 2024
@Forgind Forgind added needs team triage Requires a full team discussion and removed untriaged Request triage from a team member labels Dec 10, 2024
@Forgind
Copy link
Member

Forgind commented Dec 10, 2024

<security label>

@marcpopMSFT marcpopMSFT removed the needs team triage Requires a full team discussion label Dec 10, 2024
@marcpopMSFT marcpopMSFT added this to the 10.0.1xx milestone Dec 10, 2024
@marcpopMSFT
Copy link
Member

@dotnet/msbuild @dsplaisted we should have a discussion on this one of the best path forward. Should we block? Should we buildcheck/warn? Does this have to be done in msbuild land?

@marcpopMSFT marcpopMSFT added the needs team triage Requires a full team discussion label Dec 10, 2024
@YuliiaKovalova
Copy link
Member

@JanKrivanek has already developed a custom build check to track invalid location:
https://github.com/dotutils/BuildChecks/blob/main/src/UntrustedLocationCheck.cs

It's available in this nuget, you can give it a try right away
https://www.nuget.org/packages/DotUtils.BuildChecks/0.0.6-beta

@marcpopMSFT
Copy link
Member

Ooh, very cool. It's already there. Are there plans to add this to the built-in buildchecks?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants