Skip to content
Snippets Groups Projects
Commit 0bcceb58 authored by Sean Farley's avatar Sean Farley
Browse files

clone: add tests for unsafe ssh url (SEC)

parent d7a1c4c1
Branches
Tags
No related merge requests found
......@@ -1097,3 +1097,25 @@
adding remote bookmark bookA
updating working directory
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
SEC: check for unsafe ssh url
$ hg clone 'ssh://-oProxyCommand=touch${IFS}owned/path'
abort: potentially unsafe url: 'ssh://-oProxyCommand=touch${IFS}owned/path'
[255]
$ hg clone 'ssh://%2DoProxyCommand=touch${IFS}owned/path'
abort: potentially unsafe url: 'ssh://-oProxyCommand=touch${IFS}owned/path'
[255]
$ hg clone 'ssh://fakehost|shellcommand/path'
abort: potentially unsafe url: 'ssh://fakehost|shellcommand/path'
[255]
$ hg clone 'ssh://fakehost%7Cshellcommand/path'
abort: potentially unsafe url: 'ssh://fakehost|shellcommand/path'
[255]
$ hg clone 'ssh://-oProxyCommand=touch owned%20foo@example.com/nonexistent/path'
abort: potentially unsafe url: 'ssh://-oProxyCommand=touch owned foo@example.com/nonexistent/path'
[255]
We should not have created a file named owned - if it exists, the
attack succeeded.
$ if test -f owned; then echo 'you got owned'; fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment