Make nftables' escalation test independent of who runs it: an explicit non-root uid, and the default checked against the process's own (issue 877)
mesh/merge-gate error: builds adwaita, asus-zephyrus-g14, build-agent, ca-trust, clipmenu, docker, dunst, feh, fonts, gnome-keyring, hostname, i3, i3status…
mesh/repo-check error: the check could not run: killed by hand
mesh/delivery superseded: a newer head of the same pull request

This commit is contained in:
2026-10-16 08:06:39 +00:00
parent ac46c36a3d
commit 5b1515c6f3
+9 -1
View File
@@ -77,7 +77,15 @@ test("which chains jump to a target is read from a listing", () => {
test("the filter's commands run as given by root and through sudo without a prompt by anyone else", () => {
assert.deepEqual(escalated("nft", ["list", "ruleset"], 0), ["nft", ["list", "ruleset"]]);
assert.deepEqual(escalated("nft", ["-f", "/etc/nftables.conf"], 1000), ["sudo", ["-n", "nft", "-f", "/etc/nftables.conf"]]);
assert.deepEqual(escalated("iptables-legacy", ["-S"], undefined), ["sudo", ["-n", "iptables-legacy", "-S"]]);
assert.deepEqual(escalated("iptables-legacy", ["-S"], 1000), ["sudo", ["-n", "iptables-legacy", "-S"]]);
});
test("without a uid given, the process's own decides: as given for root, through sudo for anyone else", () => {
// Whoever runs the check: the default is the uid this process has, so the expectation is derived from it.
const own = process.getuid?.();
const want: [string, string[]] = own === 0 ? ["iptables-legacy", ["-S"]] : ["sudo", ["-n", "iptables-legacy", "-S"]];
assert.deepEqual(escalated("iptables-legacy", ["-S"]), want);
assert.deepEqual(escalated("iptables-legacy", ["-S"], undefined), want);
});
test("the filter file is the one the manifest's filtering names", () => {