pager: make pager secure when under euid is changed or explicitly requested
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 7 Oct 2020 09:15:05 +0000 (11:15 +0200)
committerAdrian Bunk <bunk@debian.org>
Thu, 29 Jun 2023 13:57:02 +0000 (14:57 +0100)
commit798625cdc058e86451f5a30536db6ffe3747aec9
treedcc7d545b378262d888e7e8cd2421db617d2515f
parent646dad6ecd27866f27c04edfa2ece578b7a00119
pager: make pager secure when under euid is changed or explicitly requested

The variable is renamed to SYSTEMD_PAGERSECURE (because it's not just about
less now), and we automatically enable secure mode in certain cases, but not
otherwise.

This approach is more nuanced, but should provide a better experience for
users:

- Previusly we would set LESSSECURE=1 and trust the pager to make use of
  it. But this has an effect only on less. We need to not start pagers which
  are insecure when in secure mode. In particular more is like that and is a
  very popular pager.

- We don't enable secure mode always, which means that those other pagers can
  reasonably used.

- We do the right thing by default, but the user has ultimate control by
  setting SYSTEMD_PAGERSECURE.

Fixes #5666.

v2:
- also check $PKEXEC_UID

v3:
- use 'sd_pid_get_owner_uid() != geteuid()' as the condition

Gbp-Pq: Name 0004-pager-make-pager-secure-when-under-euid-is-changed-o.patch
man/less-variables.xml
src/shared/pager.c