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, 30 Mar 2023 19:32:31 +0000 (20:32 +0100)
commit03cf4ed3270f1c7b6c4f8bf1b34ec4c19760758c
treeef497f59f99e5cf2e3e50dcec5c49ef86b1f030f
parent7c40b57d052bb6538f147dca0e2e7814e73d80cb
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