Skip to content

Commit 4d1190b

Browse files
Adding tests
1 parent 981d6da commit 4d1190b

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

google/internal/externalaccount/basecredentials_test.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,16 @@ func TestValidateURLTokenURL(t *testing.T) {
231231
{"https://", false},
232232
{"http://us-east-1.sts.googleapis.com", false},
233233
{"https://us-east-1.sts.googleapis.comevil.com", false},
234+
{"https://sts-xyz.p.googleapis.com", true},
235+
{"https://sts.pgoogleapis.com", false},
236+
{"https://p.googleapis.com", false},
237+
{"https://sts.p.com", false},
238+
{"http://sts.p.googleapis.com", false},
239+
{"https://xyz-sts.p.googleapis.com", false},
240+
{"https://sts-xyz.123.p.googleapis.com", false},
241+
{"https://sts-xyz.p1.googleapis.com", false},
242+
{"https://sts-xyz.p.foo.com", false},
243+
{"https://sts-xyz.p.foo.googleapis.com", false},
234244
}
235245
ctx := context.Background()
236246
for _, tt := range urlValidityTests {
@@ -287,6 +297,16 @@ func TestValidateURLImpersonateURL(t *testing.T) {
287297
{"https://", false},
288298
{"http://us-east-1.iamcredentials.googleapis.com", false},
289299
{"https://us-east-1.iamcredentials.googleapis.comevil.com", false},
300+
{"https://iamcredentials-xyz.p.googleapis.com", true},
301+
{"https://iamcredentials.pgoogleapis.com", false},
302+
{"https://p.googleapis.com", false},
303+
{"https://iamcredentials.p.com", false},
304+
{"http://iamcredentials.p.googleapis.com", false},
305+
{"https://xyz-iamcredentials.p.googleapis.com", false},
306+
{"https://iamcredentials-xyz.123.p.googleapis.com", false},
307+
{"https://iamcredentials-xyz.p1.googleapis.com", false},
308+
{"https://iamcredentials-xyz.p.foo.com", false},
309+
{"https://iamcredentials-xyz.p.foo.googleapis.com", false},
290310
}
291311
ctx := context.Background()
292312
for _, tt := range urlValidityTests {

0 commit comments

Comments
 (0)