polkit-org / polkit

polkit (formerly PolicyKit) is a toolkit for defining and handling authorizations. It is used for allowing unprivileged processes to speak to privileged processes.
Other
48 stars 27 forks source link

pkexec Doesn't Completely Respect Working Directories #205

Open polkit-github-migration-bot opened 12 months ago

polkit-github-migration-bot commented 12 months ago

In gitlab.freedesktop.org by N3k0-san on Aug 29, 2023, 24:04

Link to the original issue: https://gitlab.freedesktop.org/polkit/polkit/-/issues/204

Current behaviour, description of the problem

pkexec doesn't respect relative commands passed from where the running terminal session is actually ran from

(More on this in the detailed description)

Desired behaviour

pkexec should respect relative parameters given to commands that are elevated by pkexec

Reproducer

# As unprivileged user
cd ~
pkexec mkdir -p testing/polkit

Detailed description

Running pkexec as a substitute for sudo or doas (I personally use doas but I noticed this behavior about pkexec) causes an issue if you use commands using relative contexts.

In the example above, pkexec actually cause polkit to make folders in /root rather than where the command was ran from; this isn't ideal behavior for an authentication program.

Version of polkit: 122

Version of OS: Gentoo (LLVM-OpenRC Profile)

Anything else related to the issue: Associated Gentoo Bug Report