sshrepo: catch passwords in ssh urls stable
authorAdrian Buehlmann <adrian@cadifra.com>
Wed, 23 Feb 2011 11:42:41 +0100
branchstable
changeset 13464 da0ddd62b9d8
parent 13463 22f948c027a9
child 13465 fa88fabc1d66
sshrepo: catch passwords in ssh urls see also e4b02eb825b1
mercurial/sshrepo.py
tests/test-ssh.t
--- a/mercurial/sshrepo.py	Wed Feb 23 00:25:18 2011 +0100
+++ b/mercurial/sshrepo.py	Wed Feb 23 11:42:41 2011 +0100
@@ -29,6 +29,8 @@
             self._abort(error.RepoError(_("couldn't parse location %s") % path))
 
         self.user = m.group(2)
+        if self.user and ':' in self.user:
+            self._abort(error.RepoError(_("password in URL not supported")))
         self.host = m.group(3)
         self.port = m.group(5)
         self.path = m.group(7) or "."
--- a/tests/test-ssh.t	Wed Feb 23 00:25:18 2011 +0100
+++ b/tests/test-ssh.t	Wed Feb 23 11:42:41 2011 +0100
@@ -269,6 +269,13 @@
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     z
   
+
+passwords in ssh urls are not supported
+
+  $ hg push ssh://user:erroneouspwd@dummy/remote
+  abort: password in URL not supported!
+  [255]
+
   $ cd ..
   $ cat dummylog
   Got arguments 1:user@dummy 2:hg -R nonexistent serve --stdio