File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -78,6 +78,9 @@ func (o AuthOptions) Validate() error {
78
78
return fmt .Errorf ("invalid '%s' auth option: 'password' requires 'username' to be set" , o .Transport )
79
79
}
80
80
case SSH :
81
+ if o .Host == "" {
82
+ return fmt .Errorf ("invalid '%s' auth option: 'host' is required" , o .Transport )
83
+ }
81
84
if len (o .Identity ) == 0 {
82
85
return fmt .Errorf ("invalid '%s' auth option: 'identity' is required" , o .Transport )
83
86
}
Original file line number Diff line number Diff line change @@ -106,17 +106,26 @@ func TestAuthOptions_Validate(t *testing.T) {
106
106
Transport : HTTPS ,
107
107
},
108
108
},
109
+ {
110
+ name : "SSH transport requires host" ,
111
+ opts : AuthOptions {
112
+ Transport : SSH ,
113
+ },
114
+ wantErr : "invalid 'ssh' auth option: 'host' is required" ,
115
+ },
109
116
{
110
117
name : "SSH transport requires identity" ,
111
118
opts : AuthOptions {
112
119
Transport : SSH ,
120
+ Host : "github.com:22" ,
113
121
},
114
122
wantErr : "invalid 'ssh' auth option: 'identity' is required" ,
115
123
},
116
124
{
117
125
name : "SSH transport requires known_hosts" ,
118
126
opts : AuthOptions {
119
127
Transport : SSH ,
128
+ Host : "github.com:22" ,
120
129
Identity : []byte (privateKeyFixture ),
121
130
},
122
131
wantErr : "invalid 'ssh' auth option: 'known_hosts' is required" ,
@@ -129,6 +138,7 @@ func TestAuthOptions_Validate(t *testing.T) {
129
138
{
130
139
name : "Valid SSH transport" ,
131
140
opts : AuthOptions {
141
+ Host : "github.com:22" ,
132
142
Transport : SSH ,
133
143
Identity : []byte (privateKeyPassphraseFixture ),
134
144
Password : "foobar" ,
You can’t perform that action at this time.
0 commit comments