mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-12-03 07:18:28 +01:00
dulwich: workaround github SSH server in asyncssh vendor
- allow mismatched RSA signature algo names in initial SSH_MSG_USERAUTH_PK_OK response - unit test overridden asyncssh publickey auth compatibility with github ssh server
This commit is contained in:
committed by
Ruslan Kuprieiev
parent
45c4e1998d
commit
25dca0b665
@@ -594,3 +594,29 @@ def test_pygit_checkout_subdir(tmp_dir, scm, git):
|
||||
with (tmp_dir / "dir").chdir():
|
||||
git.checkout(rev)
|
||||
assert not (tmp_dir / "dir" / "bar").exists()
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"algorithm", [b"ssh-rsa", b"rsa-sha2-256", b"rsa-sha2-512"]
|
||||
)
|
||||
def test_dulwich_github_compat(mocker, algorithm):
|
||||
from asyncssh.misc import ProtocolError
|
||||
|
||||
from dvc.scm.git.backend.dulwich.asyncssh_vendor import (
|
||||
_process_public_key_ok_gh,
|
||||
)
|
||||
|
||||
key_data = b"foo"
|
||||
auth = mocker.Mock(
|
||||
_keypair=mocker.Mock(algorithm=algorithm, public_data=key_data),
|
||||
)
|
||||
packet = mocker.Mock()
|
||||
|
||||
with pytest.raises(ProtocolError):
|
||||
strings = iter((b"ed21556", key_data))
|
||||
packet.get_string = lambda: next(strings)
|
||||
_process_public_key_ok_gh(auth, None, None, packet)
|
||||
|
||||
strings = iter((b"ssh-rsa", key_data))
|
||||
packet.get_string = lambda: next(strings)
|
||||
_process_public_key_ok_gh(auth, None, None, packet)
|
||||
|
||||
Reference in New Issue
Block a user