Page MenuHomePhabricator

Generalize SSH passthru for repository hosting
ClosedPublic

Authored by epriestley on Nov 10 2013, 9:25 PM.
Tags
None
Referenced Files
F14070919: D7551.id17040.diff
Wed, Nov 20, 2:36 PM
F14070229: D7551.diff
Wed, Nov 20, 12:17 PM
F14067475: D7551.diff
Tue, Nov 19, 3:12 PM
F13986988: D7551.id17062.diff
Oct 21 2024, 6:48 AM
F13983578: D7551.diff
Oct 20 2024, 7:25 AM
Unknown Object (File)
Oct 3 2024, 11:09 PM
Unknown Object (File)
Oct 3 2024, 11:04 PM
Unknown Object (File)
Oct 3 2024, 11:03 PM

Details

Reviewers
btrahan
Maniphest Tasks
Restricted Maniphest Task
Commits
Restricted Diffusion Commit
rPf2938bacd9c4: Generalize SSH passthru for repository hosting
Summary

Ref T2230. In Git, we can determine if a command is read-only or read/write from the command itself, but this isn't the case in Mercurial or SVN.

For Mercurial and SVN, we need to proxy the protocol that's coming over the wire, look at each request from the client, and then check if it's a read or a write. To support this, provide a more flexible version of passthruIO.

The way this will work is:

  • The SSH IO channel is wrapped in a ProtocolChannel which can parse the the incoming stream into message objects.
  • The willWriteCallback will look at those messages and determine if they're reads or writes.
    • If they're writes, it will check for write permission.
    • If we're good to go, the message object is converted back into a byte stream and handed to the underlying command.
Test Plan

Executed git clone, git clone --depth 3, git push (against no-write repo, got error), git push (against valid repo).

Diff Detail

Branch
streamcheck
Lint
Lint Passed
SeverityLocationCodeMessage
Advicesrc/infrastructure/ssh/PhabricatorSSHPassthruCommand.php:123XHP16TODO Comment
Unit
Tests Passed

Event Timeline

src/infrastructure/ssh/PhabricatorSSHPassthruCommand.php
3–37

nice

57

can we type hint this to PhutilChannel? also maybe setErrorChannel?

src/infrastructure/ssh/PhabricatorSSHPassthruCommand.php
57

Ah, yep.

epriestley updated this revision to Unknown Object (????).Nov 11 2013, 8:12 PM
  • Add typehints.