Skip to content

Commit 511933c

Browse files
committed
nsc/gcp: trim leading slashes from gcp identity provider input
This fixes support for identity providers in the formats: - `https://iam.googleapis.com/projects/<PROJECT_NUMBER>/locations/global/workloadIdentityPools/<POOL_ID>/providers/<PROVIDER_ID>` - `/projects/<PROJECT_NUMBER>/locations/global/workloadIdentityPools/<POOL_ID>/providers/<PROVIDER_ID>`
1 parent 67ec4b5 commit 511933c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

internal/cli/cmd/gcp/federation.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ func newImpersonateCmd() *cobra.Command {
4949
ip = strings.TrimPrefix(ip, gcpIamUrl)
5050
}
5151

52+
// Trim leading slashes
53+
for strings.HasPrefix(ip, "/") {
54+
ip = strings.TrimPrefix(ip, "/")
55+
}
56+
5257
resp, err := fnapi.IssueIdToken(ctx, fmt.Sprintf("%s/%s", gcpIamUrl, ip), idTokenVersion)
5358
if err != nil {
5459
return err

0 commit comments

Comments
 (0)