Skip to main content
This needs bqto Pro.
bqto Pro reaches Cloud Run services with internal ingress.

Connect

--instance takes the region and the service name, as REGION/NAME. A connection to Cloud Run goes through a SOCKS5 proxy on the bastion. bqto prints the proxy instead of a port. It also prints the command that uses the proxy.

Private Google Access

Cloud Run needs Private Google Access on the subnet of the bastion. bqto checks for it. To turn it on, run:

Open the service in a browser

A browser cannot use the SOCKS5 proxy, and it cannot add your identity token. So a service that requires authentication answers 403. --web starts a local HTTP reverse proxy that adds your gcloud identity token to each request. The proxy asks for a secret that bqto makes for each session. The web: line starts with the address to open. This address holds the secret:
The first visit stores the secret in an HttpOnly, SameSite=Strict cookie. Then it loads the same page without the secret in the address. A request that has neither the cookie nor the X-Bqto-Token header gets 403. This rule also applies to websockets. Treat the secret as a password for the length of the session. Two limits remain:
  • Browsers do not separate cookies by port. Your browser also sends the cookie to any other server on 127.0.0.1 that it visits, and another user on the machine can run such a server. On a shared machine, open the proxy in a browser profile that you use for nothing else.
  • The first entry in the browser history keeps ?bqto_token=SECRET. The secret stops working when the session ends.

In scripts

With --output json, the ready event has web, the address of the proxy, and web_token, the secret. With -- CMD, the command gets these variables: Other users of the machine can read a command line. To send the secret outside the command line, use bash or zsh:
The <(...) form needs bash or zsh. sh and fish do not have it.

What it needs

To grant roles/run.invoker on one service:
When bqto Pro runs as a service account, it makes the identity token as that service account, for the URL of the service. The account then needs roles/run.invoker on the service. Permissions has every role.