@@ -83,7 +83,51 @@ func TestRedactURL(t *testing.T) {
83
83
Path : "hashicorp/go-getter-test-private.git" ,
84
84
RawQuery : "sshkey=" ,
85
85
},
86
- want :
"ssh://[email protected] /hashicorp/go-getter-test-private.git?sshkey=" ,
86
+ want :
"ssh://[email protected] /hashicorp/go-getter-test-private.git?sshkey=redacted" ,
87
+ },
88
+ {
89
+ name : "multiple SSH keys with no and non-empty values" ,
90
+ url : & url.URL {
91
+ Scheme : "ssh" ,
92
+ User : url .User ("git" ),
93
+ Host : "github.com" ,
94
+ Path : "hashicorp/go-getter-test-private.git" ,
95
+ RawQuery : "sshkey&sshkey=secretkey" ,
96
+ },
97
+ want :
"ssh://[email protected] /hashicorp/go-getter-test-private.git?sshkey=redacted&sshkey=redacted" ,
98
+ },
99
+ {
100
+ name : "multiple SSH keys with all empty values" ,
101
+ url : & url.URL {
102
+ Scheme : "ssh" ,
103
+ User : url .User ("git" ),
104
+ Host : "github.com" ,
105
+ Path : "hashicorp/go-getter-test-private.git" ,
106
+ RawQuery : "sshkey&sshkey" ,
107
+ },
108
+ want :
"ssh://[email protected] /hashicorp/go-getter-test-private.git?sshkey=redacted&sshkey=redacted" ,
109
+ },
110
+ {
111
+ name : "multiple SSH keys with mixed empty and blank values" ,
112
+ url : & url.URL {
113
+ Scheme : "ssh" ,
114
+ User : url .User ("git" ),
115
+ Host : "github.com" ,
116
+ Path : "hashicorp/go-getter-test-private.git" ,
117
+ RawQuery : "sshkey=&sshkey=secretkey" ,
118
+ },
119
+ want :
"ssh://[email protected] /hashicorp/go-getter-test-private.git?sshkey=redacted&sshkey=redacted" ,
120
+ },
121
+ {
122
+ name : "multiple SSH keys in URL query parameter" ,
123
+ url : & url.URL {
124
+ Scheme : "ssh" ,
125
+ User : url .User ("git" ),
126
+ Host : "github.com" ,
127
+ Path : "hashicorp/go-getter-test-private.git" ,
128
+ RawQuery : "sshkey=secretkey1&sshkey=secretkey2" ,
129
+ },
130
+ want :
"ssh://[email protected] /hashicorp/go-getter-test-private.git?sshkey=redacted&sshkey=redacted" ,
87
131
},
88
132
}
89
133
0 commit comments