Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14037745
D18389.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D18389.diff
View Options
diff --git a/src/applications/diffusion/protocol/DiffusionGitCommandEngine.php b/src/applications/diffusion/protocol/DiffusionGitCommandEngine.php
--- a/src/applications/diffusion/protocol/DiffusionGitCommandEngine.php
+++ b/src/applications/diffusion/protocol/DiffusionGitCommandEngine.php
@@ -26,9 +26,7 @@
$env['HOME'] = PhabricatorEnv::getEmptyCWD();
- if ($this->isAnySSHProtocol()) {
- $env['GIT_SSH'] = $this->getSSHWrapper();
- }
+ $env['GIT_SSH'] = $this->getSSHWrapper();
if ($this->isAnyHTTPProtocol()) {
$uri = $this->getURI();
diff --git a/src/applications/diffusion/protocol/DiffusionMercurialCommandEngine.php b/src/applications/diffusion/protocol/DiffusionMercurialCommandEngine.php
--- a/src/applications/diffusion/protocol/DiffusionMercurialCommandEngine.php
+++ b/src/applications/diffusion/protocol/DiffusionMercurialCommandEngine.php
@@ -11,12 +11,14 @@
protected function newFormattedCommand($pattern, array $argv) {
$args = array();
- if ($this->isAnySSHProtocol()) {
- $pattern = "hg --config ui.ssh=%s {$pattern}";
- $args[] = $this->getSSHWrapper();
- } else {
- $pattern = "hg {$pattern}";
- }
+ // NOTE: Here, and in Git and Subversion, we override the SSH command even
+ // if the repository does not use an SSH remote, since our SSH wrapper
+ // defuses an attack against older versions of Mercurial, Git and
+ // Subversion (see T12961) and it's possible to execute this attack
+ // in indirect ways, like by using an SSH subrepo inside an HTTP repo.
+
+ $pattern = "hg --config ui.ssh=%s {$pattern}";
+ $args[] = $this->getSSHWrapper();
return array($pattern, array_merge($args, $argv));
}
diff --git a/src/applications/diffusion/protocol/DiffusionSubversionCommandEngine.php b/src/applications/diffusion/protocol/DiffusionSubversionCommandEngine.php
--- a/src/applications/diffusion/protocol/DiffusionSubversionCommandEngine.php
+++ b/src/applications/diffusion/protocol/DiffusionSubversionCommandEngine.php
@@ -44,9 +44,7 @@
protected function newCustomEnvironment() {
$env = array();
- if ($this->isAnySSHProtocol()) {
- $env['SVN_SSH'] = $this->getSSHWrapper();
- }
+ $env['SVN_SSH'] = $this->getSSHWrapper();
return $env;
}
diff --git a/src/applications/diffusion/protocol/__tests__/DiffusionCommandEngineTestCase.php b/src/applications/diffusion/protocol/__tests__/DiffusionCommandEngineTestCase.php
--- a/src/applications/diffusion/protocol/__tests__/DiffusionCommandEngineTestCase.php
+++ b/src/applications/diffusion/protocol/__tests__/DiffusionCommandEngineTestCase.php
@@ -26,7 +26,7 @@
));
$this->assertCommandEngineFormat(
- 'hg xyz',
+ (string)csprintf('hg --config ui.ssh=%s xyz', $ssh_wrapper),
array(
'LANG' => 'en_US.UTF-8',
'HGPLAIN' => '1',
@@ -102,7 +102,7 @@
));
$this->assertCommandEngineFormat(
- 'hg xyz',
+ (string)csprintf('hg --config ui.ssh=%s xyz', $ssh_wrapper),
array(
'LANG' => 'en_US.UTF-8',
'HGPLAIN' => '1',
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 11, 6:43 PM (5 d, 21 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6716065
Default Alt Text
D18389.diff (3 KB)
Attached To
Mode
D18389: Pass SSH wrappers to VCS commands unconditonally, not just if there's an SSH remote
Attached
Detach File
Event Timeline
Log In to Comment