Skip to content

feature(gateway): gcp enrollment - #400

Open
bernie-g wants to merge 9 commits into
mainfrom
bernie/platfor-763-support-gcp-authentication-for-gateway
Open

bernie-g wants to merge 9 commits into
mainfrom
bernie/platfor-763-support-gcp-authentication-for-gateway

Conversation

@bernie-g

Copy link
Copy Markdown
Contributor

Description 📣

Adds --enroll-method=gcp to gateway start and gateway systemd install, so a gateway on Compute Engine or GKE enrolls with no credential written to disk. Backend side is Infisical/infisical#8143.

The gce type reads an identity token from the instance metadata server and the iam type signs a JWT through the IAM Credentials API; both use the gateway ID as the token audience and re-authenticate on every start.

Type ✨

  • Bug fix
  • New feature
  • Improvement
  • Breaking change
  • Documentation

Tests 🛠️

Verified on a real Compute Engine VM and a GKE cluster with Workload Identity, in the foreground and as a systemd service, both reaching gateway registration.

# Compute Engine / GKE pod
infisical gateway start my-gateway --enroll-method=gcp --gateway-id=<gateway-id> --domain=<domain>

# systemd
sudo infisical gateway systemd install my-gateway --enroll-method=gcp --gateway-id=<gateway-id> --domain=<domain>
sudo systemctl start my-gateway

# IAM signJwt instead of the metadata server
infisical gateway start my-gateway --enroll-method=gcp --gcp-auth-type=iam --gateway-id=<gateway-id> --domain=<domain>

Adds --enroll-method=gcp to gateway start and gateway systemd install.
The gce type reads an identity token from the instance metadata server,
covering Compute Engine VMs and GKE workload identity; the iam type signs
a JWT through the IAM Credentials API, using ADC or a key file.

Both carry the gateway ID as the token audience and re-authenticate on
every start, so no credential is written to disk.
@infisical-review-police

Copy link
Copy Markdown

💬 Discussion in Slack: #pr-review-cli-400-feat-gateway-gcp-enrollment

Posted by Review Police — reviews, comments, new commits, and CI failures will stream into this channel.

@linear

linear Bot commented Sep 15, 2026

Copy link
Copy Markdown

PLATFOR-763

@greptile-apps

greptile-apps Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

The PR should not merge until systemd IAM enrollment handles credential paths consistently with the generated service's filesystem sandbox and working directory.

Findings

  1. P1 Systemd Cannot Read Key

Summary

Adds GCP-backed gateway enrollment for foreground and systemd-managed gateways.

  • Supports Compute Engine/GKE metadata identity tokens and IAM Credentials SignJwt.
  • Adds the GCP gateway login API model and request.
  • Persists GCP enrollment settings for reauthentication on each systemd start.
  • The systemd IAM path needs correction because commonly supplied credential paths can be unreadable or resolve differently inside the generated service.

Reviews (1) · Last reviewed commit: "feat(gateway): GCP enrollment"

Comment thread packages/gateway-v2/systemd.go
Comment thread packages/gateway-v2/gcp_auth.go Outdated
@veria-ai

veria-ai Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

PR overview

All previously flagged issues have been addressed. No open security concerns remain on this pull request.

Security review

No open security issues remain on this pull request.

Fixed/addressed: 1 · PR risk: 0/10

@bernie-g bernie-g changed the title feat(gateway): GCP enrollment feature(gateway): gcp enrollment Sep 15, 2026
Addresses PR review findings.

The signed IAM JWT carried only sub and aud, so a captured login request
stayed a valid proof forever. It now carries iat and a 5 minute exp,
which the backend requires.

A service account key path under a home directory installed fine and
then failed on every service start, because the unit runs with
InaccessibleDirectories=/home and no working directory. The install now
rejects a relative path, a path under /home, and a missing file.
Clears GO-2026-6348, GO-2026-6441 and GO-2026-6443, which govulncheck
flags as non-allowlisted. These predate this branch and also fail on
main; the advisories were published after main last ran green.
The e2e tests are their own module and share the root dependency graph,
so `go test` there fails with 'updates to go.mod needed' until it is
tidied alongside.
Comment thread packages/gateway-v2/gcp_auth.go Outdated
Comment thread packages/cmd/gateway.go Outdated
Comment thread packages/cmd/gateway.go Outdated
Comment thread packages/cmd/gateway.go Outdated
Comment thread packages/api/model.go
The key path was read for every gcp login, so a stray
INFISICAL_GCP_IAM_SERVICE_ACCOUNT_KEY_FILE_PATH left over from machine
identity auth made a plain gce login fail for no visible reason. It is
read only for the iam type now, and passing the flag with gce fails at
install time rather than producing a service that never starts.

The systemd path check also cleans the path first and covers /tmp, which
the unit makes private.
On a Compute Engine instance the usual cause is the default scopes
omitting iamcredentials, which the error never mentioned. It pointed at
the API and the IAM role instead, neither of which is the problem.
The three login methods post to the same endpoint and get the same body
back, so aws, gcp and kubernetes each had an identical response struct
and a call function differing only in type names. They share
GatewayLoginResponse and CallGatewayLogin now.

The request types stay per-method: aws sends a signed STS request where
the other two send a JWT, and each struct documents what its own method
puts on the wire.
…pport-gcp-authentication-for-gateway

# Conflicts:
#	go.mod
@gitguardian

gitguardian Bot commented Sep 18, 2026

Copy link
Copy Markdown

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
37072668 Triggered Username Password 9d69ea3 packages/gateway-v2/test_connection_oracle_test.go View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants