Repository navigation
docs: Google APIs with a federated credential - #749
Conversation
There was a problem hiding this comment.
Code Review
This pull request configures the standalone server to trust forwarded headers, allowing it to correctly infer its OIDC issuer URL when deployed behind a TLS front door like Cloud Run. It also adds a comprehensive guide on accessing Google APIs using federated credentials and introduces an integration test to verify the issuer inference behavior. The review feedback suggests fixing malformed placeholders in the new documentation guide and adding a status code assertion in the integration test helper to ensure robust error reporting.
| X-Mesh-Authentication: ****** member's Biscuit> | ||
| node authorizes: role grants egress://aiplatform.googleapis.com, POST, this path | ||
| POST <control plane>/sts/token -> ES256 JWT: iss=<control plane>, sub=<member>, aud=<WIF provider> | ||
| POST https://sts.googleapis.com/v1/token -> federated token | ||
| POST iamcredentials ...:generateAccessToken (impersonate) -> access token | ||
| POST https://aiplatform.googleapis.com/v1/.../gemini-2.5-flash:generateContent | ||
| Authorization: ****** token> |
There was a problem hiding this comment.
The placeholders for the Biscuit token and the access token are missing their opening angle brackets (<), resulting in malformed placeholders like ****** member's Biscuit> and ****** token>. Adding the opening brackets makes the documentation clearer and consistent with other placeholders in the guide.
| X-Mesh-Authentication: ****** member's Biscuit> | |
| node authorizes: role grants egress://aiplatform.googleapis.com, POST, this path | |
| POST <control plane>/sts/token -> ES256 JWT: iss=<control plane>, sub=<member>, aud=<WIF provider> | |
| POST https://sts.googleapis.com/v1/token -> federated token | |
| POST iamcredentials ...:generateAccessToken (impersonate) -> access token | |
| POST https://aiplatform.googleapis.com/v1/.../gemini-2.5-flash:generateContent | |
| Authorization: ****** token> | |
| X-Mesh-Authentication: ****** <member's Biscuit> | |
| node authorizes: role grants egress://aiplatform.googleapis.com, POST, this path | |
| POST <control plane>/sts/token -> ES256 JWT: iss=<control plane>, sub=<member>, aud=<WIF provider> | |
| POST https://sts.googleapis.com/v1/token -> federated token | |
| POST iamcredentials ...:generateAccessToken (impersonate) -> access token | |
| POST https://aiplatform.googleapis.com/v1/.../gemini-2.5-flash:generateContent | |
| Authorization: ****** <token> |
| resp, err := http.DefaultClient.Do(req) | ||
| if err != nil { | ||
| t.Fatalf("GET openid-configuration: %v", err) | ||
| } | ||
| defer func() { _ = resp.Body.Close() }() |
There was a problem hiding this comment.
Assert that the HTTP response status code is 200 OK before attempting to decode the response body. If the server returns a non-200 error status (e.g., 404 or 500), attempting to decode the body as JSON will fail with a confusing decoding error (like EOF or invalid character '<'), masking the actual HTTP failure.
resp, err := http.DefaultClient.Do(req)
if err != nil {
t.Fatalf("GET openid-configuration: %v", err)
}
defer func() { _ = resp.Body.Close() }()
if resp.StatusCode != http.StatusOK {
t.Fatalf("GET openid-configuration status = %s, want 200", resp.Status)
}7dda975 to
6dd7aa7
Compare
A mesh member calls Gemini on Vertex AI and an agent on Agent Engine through an egress node with Workload Identity Federation: the pool and the provider that trust the control plane as an OIDC issuer, the service account, the policy with oidc_federation and an http grant narrowed to the model and engine paths, the call, the refusals, and what the node's audit line and Google's audit log show. No service account key exists. Behind a TLS-terminating proxy the control plane does not infer its issuer scheme from forwarded headers; the guide says to set the public URL (--external-url on agentmesh-one). Run on a Cloud Run hub with nodes on GKE, from an OpenShell sandbox and a Substrate actor.
6dd7aa7 to
9325356
Compare
Guide only (an earlier revision of this PR also changed
agentmesh-oneto trustX-Forwarded-Protofor the OIDC issuer; that is withdrawn, see the linked issue).site/content/docs/guides/google-cloud-credentials.md: a mesh member calls Gemini on Vertex AI and an agent on Agent Engine through an egress node with Workload Identity Federation. The pool and OIDC provider that trust the control plane, the service account, theegressentry withoidc_federationand onehttpgrant narrowed toPOSTon the model and engine paths, the call, two refusals (method, path), and what the node's audit line and Google'sGenerateAccessTokenaudit entry show. No service account key exists anywhere.Behind a TLS-terminating proxy the control plane does not infer its issuer scheme from forwarded headers (
e67f5eab); the guide says to set the public URL (--external-urlonagentmesh-one,--sts-issuer-urlonagentmesh-control-plane).Verified on a Cloud Run hub (
v0.1.1,--external-url) with serving nodes on GKE, from an OpenShell sandbox and from a Substrate actor; the tutorial in #747 has themake geminitargets that run it.