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

Pass HOME environment variable through to the client #609

Closed
wants to merge 1 commit into from

Conversation

tstarling
Copy link

@tstarling tstarling commented Mar 8, 2023

To fix debconf-kde-helper error dialog:
https://bugs.launchpad.net/ubuntu/+source/kde-runtime/+bug/1851573

I reproduced the bug on Ubuntu 22.04. I tested the patch by applying it to the OS package (1.2.5-2ubuntu2), rebuilding and installing. I confirmed that it fixed the bug.

@hughsie
Copy link
Collaborator

hughsie commented Mar 8, 2023

I don't think the users home is a very good idea to include -- the home directory should be untouched by a system daemon.

@ximion
Copy link
Collaborator

ximion commented Mar 8, 2023

Why would a system daemon running as root ever want to write (!!) into the user's home directory, or even read from it?
That really feels like wrong behavior, and I'd rather make debconf not do that than working around it in PackageKit.

@tstarling
Copy link
Author

It's not running as root for me. pk-debconf-helper is installed as a systemd user service with unit file /lib/systemd/user/pk-debconf-helper.service. packagekitd is running as root but it activates the user service via dbus.

@tstarling
Copy link
Author

How about if I wrap it with if (getuid()) ?

@ximion
Copy link
Collaborator

ximion commented Mar 9, 2023

I think we should rather prevent the debconf-kde-helper from trying to write a configuration file at all - it does not create one explicitly AFAIR, so we'd have to prevent the implicit creation of one.
But I'll need to read through that bug report in detail again to see what you found out already.

Wit h this patch, you are definitely passing the current user's home to the binary running as root, which then sends it back to the user-mode helper, which isn't great.

@hughsie
Copy link
Collaborator

hughsie commented Mar 9, 2023

which isn't great

I think it's most unexpected from a security audit point of view too.

@tstarling
Copy link
Author

How exactly is debconf-communicate started? pk_client_create_helper_argv_envp() is creating argument and environment arrays for debconf-communicate, and I can see with ps that debconf-communicate is running as non-root. So I figured that the environment is just for debconf-communicate. You are saying that this environment also affects some other wrapper?

To fix the bug in debconf-kde-helper I think the only solution would be putenv("HOME=..."), with the home directory fetched from getpwent(). It's not possible to use KDE libraries without accessing the home directory. The configuration file is the only thing it's loudly complaining about, but strace shows it is trying to read 40 files from //.local and //.config.

@hughsie
Copy link
Collaborator

hughsie commented Mar 9, 2023

It's not possible to use KDE libraries without accessing the home directory

Something is very wrong with the design then.

@tstarling tstarling closed this Mar 9, 2023
@markcapella
Copy link

So why was this closed? "Advanced users can work around the issue" seems unsatisfying.

@tstarling
Copy link
Author

So why was this closed? "Advanced users can work around the issue" seems unsatisfying.

I (the author) closed it because the comments above made it clear that there was no prospect of the patch being merged.

The bug is a result of switching from a Gnome-based desktop to a KDE-based desktop and continuing to use the Gnome-based tools. The simplest workaround is to not do that. Uninstall gnome-software and use plasma-discover instead.

@markcapella
Copy link

Heh, now that's the honest answer. Sadly I'm conditioned to think of your update tool as more "official" than Discover as I adopt Plasma.

Is there any thought to guarding the 'update-manager' to message out early to the user in the KDE-based desktop?

@tstarling
Copy link
Author

I'm just a user, it's not my update tool. Actually, I'm not even a user anymore, since I uninstalled it. This was my first and presumably last PackageKit PR. Feel free to suggest whatever solution you like in a separate bug report.

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

Successfully merging this pull request may close these issues.

None yet

4 participants