The Simplest Way to Make Github and Google Compute Engine Work Like They Should
Teams use github and google compute engine to build and run code on cloud servers. Your code repo triggers an automated job that updates virtual machines in your cloud project. This workflow turns code changes into live updates without manual file transfers. Developers push commits, and the runner handles the server deployment step by step. Setting up the link between these two platforms takes careful planning around keys and roles. How github and google compute engine share permissions and d
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
Teams use github and google compute engine to build and run code on cloud servers. Your code repo triggers an automated job that updates virtual machines in your cloud project.
This workflow turns code changes into live updates without manual file transfers. Developers push commits, and the runner handles the server deployment step by step. Setting up the link between these two platforms takes careful planning around keys and roles.
How github and google compute engine share permissions and data
A build runner needs permission to talk to your cloud project. In the past, teams created a cloud service account and downloaded a static key file. They pasted this key into the repo settings as a stored secret. The runner used that secret to log in and change server states.
Modern setups skip static keys and use federated identity instead. The code platform issues a signed token when a workflow job starts. Your cloud project checks this token against a trust rule you set up ahead of time. If the repo name and branch match the rule, the cloud grants a temporary token.
Once logged in, the runner sends API calls to manage virtual machines. It can build new machine images, update instance templates, or start rolling updates. Data flows from the repo to the cloud API over encrypted links. The runner also reads server status back from the cloud to confirm the update worked.
Common failure modes and how to scope roles
The biggest risk in this setup is an overly broad service account role. Teams often grant full project editor rights to make the build script work fast. If an attacker alters a workflow file, they gain control over every virtual machine. They can also read sensitive disks or spin up huge servers in your project.
Shared service accounts create another major blind spot for security teams. When ten repos use one cloud identity, the cloud logs look identical. You cannot tell which specific build job restarted a production server or changed a firewall rule. Unlogged script commands inside the machine make this problem even worse.
GitHub Actions Security + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
To fix this, give each repo its own dedicated service account. Grant only the exact roles needed to update specific machine groups. Lock down your identity trust rules so only main branches can trigger production changes. Pull requests from outside forks should only run tests, never touch cloud servers.
Securing network paths for build runners
Network paths between the runner and the virtual machines also need tight rules. Many teams open the public SSH port to the whole internet so runners can log in. Hosted runners use broad IP ranges that change often, making firewall rules hard to maintain. Opening ports to all IP addresses leaves your servers exposed to brute force attacks.
A safer approach avoids direct SSH commands during the build process altogether. Instead, the workflow builds a fresh disk image and tells the cloud to swap machines. If a runner must reach a private network, teams can run self-hosted runners inside the cloud. Those internal runners sit in a separate subnet with strict firewall rules.
You should also separate your staging and production servers into distinct cloud projects. A bug in a test workflow should never have a network path to live data. Clear project boundaries keep mistakes small and make audit logs easy to read.
Check database and API queries on the wire
Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.
Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.
Frequently asked questions
Why should we replace static service account keys with federated tokens?
Static keys never expire unless a human remembers to rotate them. If a key leaks from a build log, anyone can use it from anywhere. Federated tokens expire after a few minutes and only work for one job.
How do we stop pull requests from changing production virtual machines?
Set a condition on your cloud trust rule that checks the git branch name. Allow only the main or release branch to request tokens for the production service account. Map pull request jobs to a separate role with read-only permissions.
Should build runners log in to servers over public SSH?
No, opening public ports for build runners exposes your virtual machines to network scans. Use cloud APIs to replace machine images instead of running remote shell scripts. If you need shell tasks, keep the traffic inside a private cloud network.
Related guides
In this post