-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Use getpwuid(3) in corehost for the $HOME-less user #59036
Use getpwuid(3) in corehost for the $HOME-less user #59036
Conversation
Tagging subscribers to this area: @vitek-karas, @agocke, @VSadov |
I have to defer to @janvorli on this. It looks good, but:
In short under no condition should we extract to potentially DoS sensitive location by default. If the |
@vitek-karas the getpwuid gets a record for the specified user (in the change, it is the current user) from the OS user database, the /etc/passwd file. That database, besides user names also contains the user home directory. The HOME env variable, if present, comes from the same source. It is set by login, ssh or a graphics login manager. |
Based on my understanding of this, the
|
Thanks a lot for confirmation! I think the only missing piece is to add a test. Something like - remember |
Sure, I am working on a test case. However, Line 233 in a56b732
is not defined anymore. Tests are apparently skipped due to this condition:runtime/src/installer/tests/Directory.Build.props Lines 14 to 15 in 57bfe47
BundleExtractToSpecificPath is marked with the trait FlakyAppHostTests that only runs on runtime-staging pipeline, and staging doesn't seem to have any installer leg.
I will, however, run them locally on macOS (11.5.2) and Linux (Ubuntu 20.04) before pushing the test, assuming that'd be enough. :) |
Hmm - @agocke has been looking into the "flakiness" here #53587. Last I heard it's basically a race condition in the OS and we're looking into potential workarounds. I wasn't aware of the fact that we actually disabled these tests in the CI. They should be at the very least enabled everywhere but on Linux. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot!
I think we should wait a couple of days. The CI is under water due to the high load right before RC2 cut-off (and there are also some issues causing more trouble). Since this is for 7 only, it's OK if we wait on this a bit and rebase-rerun and merge then. |
I ran all bundle tests locally and they passed (works on my machine ™️)
TYT, there is no rush but TBH, blocking this PR on the whole "bundle test flakiness", which has been going on since before .NET 5 release, is an overkill. There is no PR on horizon which is fixing/removing the |
Sorry for not being clear. I didn't mean that we should hold this on the test flakiness. My comment about holding this PR for a bit was solely to not stress CI even more than it already is today (and also hopefully we'll see less infra issues after the RC 2 cutoff). |
Thanks a lot @am11! |
In other parts of dotnet/runtime repo [1] [2] [3], we attempt to retrieve user home directory from
getpwuid_r
when the environment variableHOME
is not set. Use the same fallback in corehost.