Circleci Pull Request
A circleci pull request workflow runs automated tests whenever an engineer proposes a code change. You set up this workflow by linking your git repo to your build service. Teams rely on these automated checks to catch bugs before code reaches the main branch. Still, build runners often hold broad database keys and cloud roles to run tests. When a runner has too much access, any pull request can run risky commands. How a circleci pull request workflow operates The workflow starts when a develo
Pull Request Security Checks + CircleCI Security: the complete guide
Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.
A circleci pull request workflow runs automated tests whenever an engineer proposes a code change. You set up this workflow by linking your git repo to your build service. Teams rely on these automated checks to catch bugs before code reaches the main branch. Still, build runners often hold broad database keys and cloud roles to run tests. When a runner has too much access, any pull request can run risky commands.
How a circleci pull request workflow operates
The workflow starts when a developer opens or updates a pull request in git. The git host sends a webhook event to the build service right away. The build service reads the pipeline rules stored inside the code repo. It then spins up a clean container or virtual machine to run the job.
You can restrict when builds run by using project settings and branch filters. Many teams set up their projects so jobs only run when a pull request exists. This saves compute time on rough draft branches that are not ready for review. The system checks the branch status, runs the tests, and sends the pass or fail result back.
To run integration tests or preview deploys, the runner needs keys for internal systems. Teams store these keys in project settings or shared secret contexts. When the job starts, the service loads those keys into the runner memory. The test scripts then use those keys to log in to databases or cloud accounts.
What native build controls solve and what they miss
Native pipeline controls do a good job of deciding which branches can trigger a build. Teams can block external forks from reading project secrets during a public pull request. You can also place manual approval steps in a workflow before a deploy job runs. Context restrictions let you limit secret groups to specific team members or security groups.
Still, these native controls only work at the start of the job. Once a job passes the initial check, the runner gets the full secret or role. The build system does not inspect the actual database queries or commands sent in flight. A flawed script or bad change inside a pull request can still drop a staging table. It could also read sensitive records like emails, phone numbers, or card numbers from test data.
Pull Request Security Checks + CircleCI Security: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Securing database and cloud actions during automated builds
Teams often copy real data into staging databases to make pull request tests realistic. If a test runner uses a shared admin key, every build can read that raw data. A safer design limits what each command can do after the runner logs in. Instead of giving a build job full database control, teams should check every query.
Data masking also protects sensitive fields during automated test runs. When a test script queries a user table, masking rewrites matched fields in results. The runner sees fake emails or national IDs, so real customer details is masked in responses before reaching build logs. Teams also gain clear audit logs that show every single query a pull request ran.
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
How do I trigger builds only when a pull request is open?
You can turn on the option to build only pull requests in your project settings. This stops the service from running jobs on every single push to a normal branch. The pipeline will wait until a developer opens a pull request before starting tests.
Are project secrets safe during a pull request from a forked repository?
By default, the build service hides project secrets from forked pull requests. You should keep this setting turned on for all public repos. If you turn it off, an outside contributor could print your keys in the build log.
Why should teams limit database roles used by pull request runners?
Any developer who can open a pull request can edit the build script for that branch. If the runner holds a broad database role, a changed script can run destructive queries. Limiting the role and checking queries in flight protects shared test systems from harm.
Related guides
In this post