comparison tests/test-pull.t @ 1045:c35751c248c3

ssh: unban the use of pipe character in hostname The test changes demonstrate that the hostname gets URL-encoded before being passed to ssh(1).
author Kevin Bullock <kbullock@ringworld.org>
date Thu, 10 Aug 2017 14:19:04 -0400
parents 9b09dd0a6308
children 312c4bb96e68
comparison
equal deleted inserted replaced
1044:9b09dd0a6308 1045:c35751c248c3
350 summary: add delta 350 summary: add delta
351 351
352 352
353 test for ssh vulnerability 353 test for ssh vulnerability
354 354
355 $ cat >> $HGRCPATH << EOF
356 > [ui]
357 > ssh = ssh -o ConnectTimeout=1
358 > EOF
359
355 $ hg init a 360 $ hg init a
356 $ cd a 361 $ cd a
357 $ hg pull 'git+ssh://-oProxyCommand=rm${IFS}nonexistent/path' | grep -v 'destination\|pulling from' 362 $ hg pull 'git+ssh://-oProxyCommand=rm${IFS}nonexistent/path' 2>&1 >/dev/null
358 abort: potentially unsafe hostname: '-oProxyCommand=rm${IFS}nonexistent' 363 abort: potentially unsafe hostname: '-oProxyCommand=rm${IFS}nonexistent'
359 [1] 364 [255]
360 $ hg pull 'git+ssh://-oProxyCommand=rm%20nonexistent/path' | grep -v 'destination\|pulling from' 365 $ hg pull 'git+ssh://-oProxyCommand=rm%20nonexistent/path' 2>&1 >/dev/null
361 abort: potentially unsafe hostname: '-oProxyCommand=rm nonexistent' 366 abort: potentially unsafe hostname: '-oProxyCommand=rm nonexistent'
362 [1] 367 [255]
363 $ hg pull 'git+ssh://fakehost|shellcommand/path' | grep -v 'destination\|pulling from' 368 $ hg pull 'git+ssh://fakehost|shellcommand/path' 2>&1 >/dev/null | grep -v ^devel-warn:
364 abort: potentially unsafe hostname: 'fakehost|shellcommand' 369 ssh: connect to host fakehost%7cshellcommand port 22: * (glob)
365 [1] 370 abort: git remote error: The remote server unexpectedly closed the connection.
366 $ hg pull 'git+ssh://fakehost%7Cshellcommand/path' | grep -v 'destination\|pulling from' 371 $ hg pull 'git+ssh://fakehost%7Cshellcommand/path' 2>&1 >/dev/null | grep -v ^devel-warn:
367 abort: potentially unsafe hostname: 'fakehost|shellcommand' 372 ssh: connect to host fakehost%7cshellcommand port 22: * (glob)
368 [1] 373 abort: git remote error: The remote server unexpectedly closed the connection.