Skip to content

Commit f78f499

Browse files
committed
test(man,info): test unexpected code execution
1 parent b061c76 commit f78f499

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

test/t/test_info.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,11 @@ def test_1(self, completion):
1010
@pytest.mark.complete("info -", require_cmd=True)
1111
def test_2(self, completion):
1212
assert completion
13+
14+
@pytest.mark.complete(
15+
"info nonexistent-nam",
16+
env=dict(INFOPATH="'$(echo malicious code >/dev/tty)'"),
17+
)
18+
def test_infopath_code_injection(self, completion):
19+
# no completion, no space appended
20+
assert not completion

test/t/test_man.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,3 +148,11 @@ def test_delimited_deduplication(self, completion):
148148
)
149149
def test_zstd_arbitrary_sectsuffix(self, completion):
150150
assert completion == "e"
151+
152+
@pytest.mark.complete(
153+
"man bash-completion-testcas",
154+
env=dict(MANPATH="'$(echo malicious code >/dev/tty)'"),
155+
)
156+
def test_manpath_code_injection(self, completion):
157+
# no completion, no space appended
158+
assert not completion

0 commit comments

Comments
 (0)