fix(credentials): ask for the password before a bulk removal

The cleanup page grouped its packages by provider but never handed those
providers to the credential gate, which saw an empty list, concluded
nothing was privileged and let the request through: pacman was then
driven with an empty password. It only worked by accident, while sudo's
timestamp was still valid.

Every privileged path now goes through the same door, which the new test
walks one by one — including the two ways of acting on a single copy of a
multi-installed package — and asserts the request is refused, kept
pending for the prompt, and refused again on replay. Nothing is ever
replayed, so no test can run pacman as root.
This commit is contained in:
BlackAngelTV committed 2026-09-27 21:33:41 +02:00
1 parent eb39905bf5
commit 8f4cc14995
3 files changed
+66 -2

No files matched your search

+5
View File
@@ -684,6 +684,11 @@ AppCore::StartResult AppCore::startRequest(Request request) {
return refused(QStringLiteral("Aucun paquet sélectionné n'est supprimable."));
}
m_cleanupRemovalDescription = request.description;
// The gate has to see who the groups belong to: a bulk removal of pacman
// packages is a privileged operation like any other, and without them
// here it would run `sudo` with an empty password instead of asking —
// which only works by accident, when sudo's timestamp is still valid.
for (const auto& group : m_pendingRemovals) providers.push_back(group.first);
bulk = true;
} else if (action == QLatin1String("install-plugin-tool")) {
if (!m_pacman || !m_pacman->isAvailable()) {