@@ -19,7 +19,7 @@ func TestRedactURL(t *testing.T) {
19
19
Path : "this:that" ,
20
20
User : url .UserPassword ("user" , "password" ),
21
21
},
22
- want : "http://user:xxxxx @host.tld/this:that" ,
22
+ want : "http://user:redacted @host.tld/this:that" ,
23
23
},
24
24
{
25
25
name : "blank Password" ,
@@ -39,7 +39,7 @@ func TestRedactURL(t *testing.T) {
39
39
Path : "this:that" ,
40
40
User : url .UserPassword ("" , "password" ),
41
41
},
42
- want : "http://:xxxxx @host.tld/this:that" ,
42
+ want : "http://:redacted @host.tld/this:that" ,
43
43
},
44
44
{
45
45
name : "blank Username, blank Password" ,
@@ -60,6 +60,28 @@ func TestRedactURL(t *testing.T) {
60
60
url : nil ,
61
61
want : "" ,
62
62
},
63
+ {
64
+ name : "non-blank SSH key in URL query parameter" ,
65
+ url : & url.URL {
66
+ Scheme : "ssh" ,
67
+ User : url .User ("git" ),
68
+ Host : "github.com" ,
69
+ Path : "hashicorp/go-getter-test-private.git" ,
70
+ RawQuery : "sshkey=LS0tLS1CRUdJTiBPUE" ,
71
+ },
72
+ want : "ssh://git@github.com/hashicorp/go-getter-test-private.git?sshkey=redacted" ,
73
+ },
74
+ {
75
+ name : "blank SSH key in URL query parameter" ,
76
+ url : & url.URL {
77
+ Scheme : "ssh" ,
78
+ User : url .User ("git" ),
79
+ Host : "github.com" ,
80
+ Path : "hashicorp/go-getter-test-private.git" ,
81
+ RawQuery : "sshkey=" ,
82
+ },
83
+ want : "ssh://git@github.com/hashicorp/go-getter-test-private.git?sshkey=" ,
84
+ },
63
85
}
64
86
65
87
for _ , tt := range cases {
0 commit comments