Page MenuHomePhabricator

Generalize SSH passthru for repository hosting
ClosedPublic

Authored by epriestley on Nov 10 2013, 9:25 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Dec 21, 3:36 PM
Unknown Object (File)
Fri, Dec 6, 3:33 AM
Unknown Object (File)
Tue, Dec 3, 5:29 PM
Unknown Object (File)
Nov 28 2024, 7:43 AM
Unknown Object (File)
Nov 28 2024, 7:43 AM
Unknown Object (File)
Nov 28 2024, 7:43 AM
Unknown Object (File)
Nov 28 2024, 7:23 AM
Unknown Object (File)
Nov 27 2024, 4:32 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

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

src/infrastructure/ssh/PhabricatorSSHPassthruCommand.php
4–38

nice

58

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

src/infrastructure/ssh/PhabricatorSSHPassthruCommand.php
58

Ah, yep.

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