also disable argparse's auto-added help in the (io)nice parameters check (#3052)

This commit is contained in:
jcfp
2025-03-14 14:44:31 +00:00
committed by GitHub
parent 3ec8227745
commit 4bc6fefa1f
2 changed files with 5 additions and 1 deletions

View File

@@ -73,7 +73,7 @@ class ErrorCatchingArgumentParser(argparse.ArgumentParser):
def clean_nice_ionice_parameters(value: str) -> ValidateResult:
"""Verify that the passed parameters are not exploits"""
if value:
parser = ErrorCatchingArgumentParser()
parser = ErrorCatchingArgumentParser(add_help=False)
# Nice parameters
parser.add_argument("-n", "--adjustment", type=int)

View File

@@ -88,6 +88,10 @@ class TestValidators:
assert_blocked("echo 'how;now;brown;cow'")
assert_blocked("-c'echo'")
assert_blocked("--classdata=;/bin/echo")
assert_blocked("-h")
assert_blocked("--help")
assert_blocked("-h -c1")
assert_blocked("-c1 --help")
@pytest.mark.parametrize(
"setting, is_correct_win, is_correct_unix",