Create trust boundary doc Fixes #45340#45666
Conversation
| # Types of Threats | ||
|
|
||
| ## Untrusted Source Code | ||
| You should never build or run code from an untrusted source without employing mitigating factors like those described [here](https://github.com/dotnet/sdk/blob/main/documentation/general/ExecutingCustomerCode.md). Additionally, some SDK commands will automatically find code or code-adjacent files in the current directory or any parent directory up to the file system root. Files that may affect a build or other command if found include but are not limited to a Directory.Build.props, global.json, NuGet.config, or dotnet-tools.json. You should also check your home folder as well as environment variables that may point to other locations the SDK will search to find code or configuration files. |
There was a problem hiding this comment.
MSBuild.rsp too, according to dotnet/msbuild#11472.
nagilson
left a comment
There was a problem hiding this comment.
This looks well-written to me. It would be ideal to get an approval from the security folks as there are likely things I haven't thought about which may be appropriate for this file but off the top of my head, I couldn't think of any and this is more useful to document than not regardless.
| You should never build or run code from an untrusted source without employing mitigating factors like those described [here](https://github.com/dotnet/sdk/blob/main/documentation/general/ExecutingCustomerCode.md). Additionally, some SDK commands will automatically find code or code-adjacent files in the current directory, project directory, or executable directory, or any parent directory of any of those up to the file system root. Files that may affect a build or other command if found include but are not limited to a Directory.Build.props, global.json, NuGet.config, or dotnet-tools.json. You should also check your home folder as well as environment variables that may point to other locations the SDK will search to find code or configuration files. | ||
|
|
||
| ## Untrusted Locations | ||
| Some folders often store untrusted files. (The Downloads folder is a fairly straightforward example of that.) Some commands look "next to" the project, solution, or other code file being worked with in the directory. It is generally recommended to avoid running dotnet commands from within any directory that contains any files you do not trust. |
There was a problem hiding this comment.
You can be more forceful,
It is generally recommended to avoid running dotnet commands from within any directory that contains any files you do not trust.
becomes
Do notrunning dotnet commands from within any directory that contains any files you do not trust.
MiYanni
left a comment
There was a problem hiding this comment.
This is a great starter for this kind of document. LGTM
| # Types of Threats | ||
|
|
||
| ## Untrusted Source Code | ||
| You should never build or run code from an untrusted source without employing mitigating factors like those described [here](https://github.com/dotnet/sdk/blob/main/documentation/general/ExecutingCustomerCode.md). Additionally, some SDK commands will automatically find code or code-adjacent files in the current directory, project directory, executable directory, or any parent directory of any of those up to the file system root. Files that may affect a build or other command if found include but are not limited to a Directory.Build.props, global.json, NuGet.config, or dotnet-tools.json. You should also check your home folder as well as environment variables that may point to other locations the SDK will search to find code or configuration files. |
There was a problem hiding this comment.
nit: Change the link to [here](general/ExecutingCustomerCode.md). This doc itself lives in the same repo to the doc you're linking to, so always use a relative link. It makes a difference as then this doc always links to its sibling doc with the same branch. Plus, main isn't always guaranteed to exist, as that similar situation happened during the switch from master to main. StackOverflow on linking here.
| You should never build or run code from an untrusted source without employing mitigating factors like those described [here](https://github.com/dotnet/sdk/blob/main/documentation/general/ExecutingCustomerCode.md). Additionally, some SDK commands will automatically find code or code-adjacent files in the current directory, project directory, executable directory, or any parent directory of any of those up to the file system root. Files that may affect a build or other command if found include but are not limited to a Directory.Build.props, global.json, NuGet.config, or dotnet-tools.json. You should also check your home folder as well as environment variables that may point to other locations the SDK will search to find code or configuration files. | ||
|
|
||
| ## Untrusted Locations | ||
| Some folders often store untrusted files. (The Downloads folder is a fairly straightforward example of that.) Some commands look "next to" the project, solution, or other code file being worked with in the directory. Do not run dotnet commands from within any directory that contains any files you do not trust. |
There was a problem hiding this comment.
nit: Maybe change Do not run dotnet commands to Do not run dotnet CLI commands?
Fixes #45340
I wasn't really sure what other information to include, so please opine on what's missing 🙂
I was also unsure what I should label truly 'safe', as we can't even say that if everything is trusted, then everything will be ok...because you can very easily compromise your own machine.
And of course, I need to fix the links eventually.