-
Notifications
You must be signed in to change notification settings - Fork 305
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
chore: Use geteuid() instead of getuid() to check privilege #3364
base: main
Are you sure you want to change the base?
Conversation
Hi @ruihe774. Thanks for your PR. I'm waiting for a ostreedev member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
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.
This looks correct to me, I tend to favour geteuid over getuid, most of the time that's what people actually want to do. But I'm not sure about every little use-case of OSTree.
What I will say, was there actually a bug or defect found here, etc.?
Or are we just changing for the sake of it because geteuid is the "better" one that's a more true test of rootness?
Not appeared. But it is easy to produce one. You can set the SUID bit of a program using libostree (e.g. |
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.
No one should be including libostree in a setuid binary.
(Really there should be no setuid binaries at all, but that's another thing)
/ok-to-test |
Yes. However, processes can drop privileges temporarily using |
I believe the correct way is to check
geteuid() == 0
, notgetuid() == 0
.