Skip to content

Commit e944716

Browse files
authored
Escape dots in GCP OIDC regular expression (#554)
* Escape dots in regular expression * Use raw string literal to allow single backslashes
1 parent 9fd7184 commit e944716

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

iterative/gcp/provider.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ func coerceOIDCCredentials(credentialsJSON []byte) (string, error) {
384384
}
385385

386386
if url, ok := credentials["service_account_impersonation_url"].(string); ok {
387-
re := regexp.MustCompile("^https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/.+?@(?P<project>.+).iam.gserviceaccount.com:generateAccessToken$")
387+
re := regexp.MustCompile(`^https://iamcredentials\.googleapis\.com/v1/projects/-/serviceAccounts/.+?@(?P<project>.+)\.iam\.gserviceaccount\.com:generateAccessToken$`)
388388
if match := re.FindStringSubmatch(url); match != nil {
389389
return match[1], nil
390390
}

0 commit comments

Comments
 (0)