1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-15 11:22:40 +01:00
phorge-phorge/src/applications/diffusion/protocol
epriestley 794e185bf9 Pass SSH wrappers to VCS commands unconditonally, not just if there's an SSH remote
Summary:
Ref T12961. In Mercurial, it's possible to have "subrepos" which may use a different protocol than the main repository.

By putting an SSH repository inside an HTTP repository, an attacker can theoretically get us to execute `hg` without overriding `ui.ssh`, then execute code via the SSH hostname attack.

As an immediate mitigation to this attack, specify `ui.ssh` unconditionally. Normally, this will have no effect (it will just be ignored). In the specific case of an SSH repo inside an HTTP repo, it will defuse the `ssh` protocol.

For good measure and consistency, do the same for Subversion and Git. However, we don't normally maintain working copies for either Subversion or Git so it's unlikely that similar attacks exist there.

Test Plan:
  - Put an SSH subrepo with an attack URI inside an HTTP outer repo in Mercurial.
  - Ran `hg up` with and without `ui.ssh` specified.
  - Got dangerous badness without `ui.ssh` and safe `ssh` subprocesses with `ui.ssh`.

I'm not yet able to confirm that `hg pull -u -- <uri>` can actually trigger this, but this can't hurt and our SSH wrapper is safer than the native behavior for all Subversion, Git and Mercurial versions released prior to today.

Reviewers: chad

Reviewed By: chad

Subscribers: cspeckmim

Maniphest Tasks: T12961

Differential Revision: https://secure.phabricator.com/D18389
2017-08-10 17:49:55 -07:00
..
__tests__ Pass SSH wrappers to VCS commands unconditonally, not just if there's an SSH remote 2017-08-10 17:49:55 -07:00
DiffusionCommandEngine.php Pass GIT_ENVIRONMENTAL_MAGIC through to hook subprocesses to support Git 2.11.0 2016-12-05 12:45:30 -08:00
DiffusionGitCommandEngine.php Pass SSH wrappers to VCS commands unconditonally, not just if there's an SSH remote 2017-08-10 17:49:55 -07:00
DiffusionMercurialCommandEngine.php Pass SSH wrappers to VCS commands unconditonally, not just if there's an SSH remote 2017-08-10 17:49:55 -07:00
DiffusionMercurialWireProtocol.php Use a less-esoteric spelling of "capabilities" in several places 2017-07-12 15:27:57 -07:00
DiffusionRepositoryClusterEngine.php Don't require a device be registered in Almanac to do cluster init/resync steps 2017-07-25 05:12:10 -07:00
DiffusionRepositoryClusterEngineLogInterface.php Make cluster repositories more chatty 2016-04-25 11:20:57 -07:00
DiffusionSubversionCommandEngine.php Pass SSH wrappers to VCS commands unconditonally, not just if there's an SSH remote 2017-08-10 17:49:55 -07:00
DiffusionSubversionWireProtocol.php phtize all the things 2015-05-22 21:16:39 +10:00