aboutsummaryrefslogtreecommitdiff
path: root/test/segments/vcs-hg.spec
diff options
context:
space:
mode:
Diffstat (limited to 'test/segments/vcs-hg.spec')
-rwxr-xr-xtest/segments/vcs-hg.spec15
1 files changed, 14 insertions, 1 deletions
diff --git a/test/segments/vcs-hg.spec b/test/segments/vcs-hg.spec
index 2903f544..c4289cef 100755
--- a/test/segments/vcs-hg.spec
+++ b/test/segments/vcs-hg.spec
@@ -204,4 +204,17 @@ function testBookmarkIconWorks() {
assertEquals "%K{002} %F{000} default Binitial %k%F{002}%f " "$(build_left_prompt)"
}
-source shunit2/shunit2 \ No newline at end of file
+function testBranchNameScriptingVulnerability() {
+ local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
+ POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vcs)
+ echo "#!/bin/sh\n\necho 'hacked'\n" > evil_script.sh
+ chmod +x evil_script.sh
+
+ hg branch '$(./evil_script.sh)' >/dev/null
+ hg add . >/dev/null
+ hg commit -m "Initial commit" >/dev/null
+
+ assertEquals '%K{002} %F{000} $(./evil_script.sh) %k%F{002}%f ' "$(build_left_prompt)"
+}
+
+source shunit2/shunit2