From aba0ffb8d32b2acc35d0671755a06ea164491212 Mon Sep 17 00:00:00 2001 From: Eisuke Kawashima Date: Sun, 20 Jul 2025 03:24:13 +0900 Subject: [PATCH] feat(SC2016,SC2032,SC2033): check doas and run0 similarly to sudo partially address #3255 --- src/ShellCheck/Analytics.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ShellCheck/Analytics.hs b/src/ShellCheck/Analytics.hs index 5a10df5..6d23344 100644 --- a/src/ShellCheck/Analytics.hs +++ b/src/ShellCheck/Analytics.hs @@ -1105,6 +1105,8 @@ checkSingleQuotedVariables params t@(T_SingleQuoted id s) = ,"xprop" ,"alias" ,"sudo" -- covering "sudo sh" and such + ,"doas" -- same as sudo + ,"run0" -- same as sudo ,"docker" -- like above ,"podman" ,"oc" @@ -2330,7 +2332,7 @@ prop_checkFunctionsUsedExternally2c = prop_checkFunctionsUsedExternally3 = verifyNotTree checkFunctionsUsedExternally "f() { :; }; echo f" prop_checkFunctionsUsedExternally4 = - verifyNotTree checkFunctionsUsedExternally "foo() { :; }; sudo \"foo\"" + verifyNotTree checkFunctionsUsedExternally "foo() { :; }; run0 \"foo\"" prop_checkFunctionsUsedExternally5 = verifyTree checkFunctionsUsedExternally "foo() { :; }; ssh host foo" prop_checkFunctionsUsedExternally6 = @@ -2340,7 +2342,7 @@ prop_checkFunctionsUsedExternally7 = prop_checkFunctionsUsedExternally8 = verifyTree checkFunctionsUsedExternally "foo() { :; }; command sudo foo" prop_checkFunctionsUsedExternally9 = - verifyTree checkFunctionsUsedExternally "foo() { :; }; exec -c sudo foo" + verifyTree checkFunctionsUsedExternally "foo() { :; }; exec -c doas foo" checkFunctionsUsedExternally params t = runNodeAnalysis checkCommand params t where @@ -2364,6 +2366,8 @@ checkFunctionsUsedExternally params t = "chroot" -> firstNonFlag "screen" -> firstNonFlag "sudo" -> firstNonFlag + "doas" -> firstNonFlag + "run0" -> firstNonFlag "xargs" -> firstNonFlag "tmux" -> firstNonFlag "ssh" -> take 1 $ drop 1 $ dropFlags argAndString