From 138f84af0d7b62a1cc2a02f00599f034e00329cc Mon Sep 17 00:00:00 2001 From: Kimmo Lehto Date: Thu, 19 Nov 2026 09:42:00 +0200 Subject: [PATCH] test(ssh): give certificate fixtures a principal golang.org/x/crypto v0.59.0 makes Certificate.SignCert reject a certificate with no ValidPrincipals (CVE-2024-7594 hardening, matching OpenSSH 10.3), which broke the cert signer tests and blocks #520. Signed-off-by: Kimmo Lehto --- protocol/ssh/connection_test.go | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/protocol/ssh/connection_test.go b/protocol/ssh/connection_test.go index 4ad51bc5..00d09621 100644 --- a/protocol/ssh/connection_test.go +++ b/protocol/ssh/connection_test.go @@ -2290,11 +2290,12 @@ func makeCertForSigner(t *testing.T, signer ssh.Signer) *ssh.Certificate { caSigner, err := ssh.NewSignerFromKey(caPriv) require.NoError(t, err) cert := &ssh.Certificate{ - Key: signer.PublicKey(), - CertType: ssh.UserCert, - KeyId: "test", - ValidAfter: 0, - ValidBefore: ssh.CertTimeInfinity, + Key: signer.PublicKey(), + CertType: ssh.UserCert, + KeyId: "test", + ValidPrincipals: []string{"test"}, + ValidAfter: 0, + ValidBefore: ssh.CertTimeInfinity, } require.NoError(t, cert.SignCert(rand.Reader, caSigner)) return cert @@ -2455,11 +2456,12 @@ func TestCertSignerForSignerSkipsHostCert(t *testing.T) { require.NoError(t, err) hostCert := &ssh.Certificate{ - Key: signer.PublicKey(), - CertType: ssh.HostCert, - KeyId: "host", - ValidAfter: 0, - ValidBefore: ssh.CertTimeInfinity, + Key: signer.PublicKey(), + CertType: ssh.HostCert, + KeyId: "host", + ValidPrincipals: []string{"host.example.com"}, + ValidAfter: 0, + ValidBefore: ssh.CertTimeInfinity, } require.NoError(t, hostCert.SignCert(rand.Reader, caSigner))