The Simplest Way to Make Cloud Run and Fortigate Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Teams use cloud run and fortigate together to route serverless app traffic through network firewalls. This setup lets stateless containers reach private backend networks while security teams inspect every packet. In production, apps run on demand and scale from zero to hundreds of instances. Network firewalls expect stable source addresses and predictable traffic patterns. Bridging these two models requires clear routing paths and strict identity checks. How traffic and permissions flow betwe

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 cloud run and fortigate together to route serverless app traffic through network firewalls. This setup lets stateless containers reach private backend networks while security teams inspect every packet.

In production, apps run on demand and scale from zero to hundreds of instances. Network firewalls expect stable source addresses and predictable traffic patterns. Bridging these two models requires clear routing paths and strict identity checks.

How traffic and permissions flow between cloud run and fortigate

Serverless containers do not hold fixed network addresses by default. When a container starts, the cloud platform assigns an address from a shared pool. A firewall cannot filter traffic if the source address changes on every request.

To fix this, engineers attach their serverless apps to a virtual private cloud connector. The connector routes all outbound container traffic into a specific subnet with a known range. The firewall sits at the edge of that subnet and inspects every outbound request.

Identity checks work alongside these network rules. Each serverless service runs with its own cloud service account and role. The app uses this role to fetch keys or sign requests to backend systems. The firewall checks the network path while the target service checks the app identity. Both checks must pass before data moves between the container and the private network.

For inbound traffic, the firewall can inspect public requests before they reach the serverless app. Traffic enters the firewall, passes threat checks, and forwards to an internal load balancer. The load balancer then sends the clean request to the serverless container.

Common failure modes and how to scope network paths

The biggest mistake teams make is sharing one connector subnet across many apps. When twenty apps share one subnet, the firewall sees all traffic as one source. Network admins must then open broad firewall ports for the whole subnet. One compromised container can then reach every backend database on the private network.

End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Teams also fail when they use shared service accounts across different serverless workloads. A shared role gives every app the same keys and permissions. If an engineer runs a debug query, the logs only show the shared account name. Security teams cannot tell which app or user sent the request.

Another common issue is static keys stored inside container variables. Engineers often put database passwords or API tokens straight into the app settings. Anyone who can read the service settings can steal those long-lived keys. If a key leaks, rotating it across many services takes hours of manual work.

To avoid these traps, give each app group its own dedicated subnet and role. Map each subnet to a specific firewall rule that only opens required ports. Keep firewall rules tight by matching both the source subnet and the destination host.

Auditing and managing day-to-day operations

Firewall logs show source addresses, destination ports, and byte counts for network flows. They do not show what command or database query ran inside an encrypted connection. When an incident happens, network logs alone leave big gaps in the audit trail.

Teams need a clear record of who accessed what system and when. Set up logging at both the network edge and the database layer. Link each app request to a specific service role or human user identity. Review firewall rules every month to remove unused subnets and stale routes. Drop any broad allow rules that engineers added during past outages.

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 can my Fortigate firewall not see a fixed IP from Cloud Run?

Serverless apps use shared address pools by default. You must route outbound traffic through a virtual private cloud connector to get a predictable subnet range.

Should all serverless services share the same VPC connector subnet?

No, sharing one subnet forces you to write overly broad firewall rules. Group services by trust level and assign separate subnets so firewall rules stay narrow.

How do I stop developers from putting static database keys in container settings?

Remove static passwords from service variables and use short-lived identity tokens instead. Pair each service with a scoped role that only grants required permissions.

The query runs. The emails stay hidden.