The Simplest Way to Make CircleCI and Tcp Proxies Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Using circleci and tcp proxies together lets build jobs reach private network ports in production. This setup helps your team run database migrations and app tests across private cloud networks. Build runners often run in shared cloud pools with changing IP addresses. Private databases and internal services block traffic from unknown public addresses by default. Putting a network relay between the build runner and your private network solves this issue. The build job sends traffic to the relay,

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.

Using circleci and tcp proxies together lets build jobs reach private network ports in production. This setup helps your team run database migrations and app tests across private cloud networks.

Build runners often run in shared cloud pools with changing IP addresses. Private databases and internal services block traffic from unknown public addresses by default. Putting a network relay between the build runner and your private network solves this issue. The build job sends traffic to the relay, which forwards packets to the private service.

How data and logins flow with circleci and tcp proxies

A build pipeline starts when a developer pushes code to a repo. The runner starts a container or virtual machine to run the job steps. When a job needs a private database, it opens a local network port. The relay client in the build container grabs traffic on that local port. It wraps the packets in a TLS tunnel and sends them out.

Before the relay forwards any traffic, it checks the identity of the build job. Modern pipelines use OpenID Connect tokens to prove which project and branch are running. The runner requests a signed token and hands it to the relay client. The relay checks this token against your cloud identity rules before opening the network path. Once verified, the backend service handles the login using a scoped database role.

Common failure modes and how to scope network paths

Many teams make the mistake of sharing one static key across all build pipelines. If a test job leaks that key in build logs, anyone can use it. Broad network rules also cause trouble when a single relay reaches every private subnet. A build runner for a front-end app should never reach a billing database port.

End-to-End Encryption + CircleCI Security: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

To fix this, tie each pipeline identity to one network route and one role. Give the staging build branch a role that only reaches staging ports. Set short timeouts on every network tunnel so idle build connections close right away. Log every connection start and stop time along with the build job number. When a migration fails, your team can match the network log to the exact build.

Keeping sensitive test data safe during pipeline runs

Build jobs often run integration tests or schema checks against shared staging data. If that data holds real user info, a failed build log might print it out. Teams can add rules that rewrite matched fields like emails, phone numbers, and card numbers. If a test query pulls national IDs, the rule replaces those digits in the results. This keeps test logs clean while letting the build job check the database structure.

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 do CircleCI runners fail to reach private databases directly?

Cloud build runners use shared public IP pools that change on every run. Private databases sit inside locked networks that block unknown public traffic by default.

How should a build job prove its identity to a network relay?

Use the built-in OpenID Connect token from the build runner instead of static keys. This token proves the exact project, branch, and job ID before opening a port.

How can teams stop build jobs from keeping ports open forever?

Set a hard time limit on the network tunnel that matches the build timeout. Close the client process in a final step that runs even when tests fail.

The query runs. The emails stay hidden.