How Cycode keeps required security checks from becoming the blocker
Making security checks required on a protected branch is one of the strongest controls a security team can turn on. It only holds if the check does its job without becoming an obstacle of its own. Here’s why that’s harder than it sounds, and how Cycode builds its pull request checks for it.
In short
- Making security checks required on a protected branch stops leaked secrets, vulnerable dependencies, and insecure code at the pull request, before they reach the main branch.
- That control only holds if the check works as intended. A required check that never reports blocks the merge, the developer can’t move it forward, and teams that hit this often enough start making checks optional or overriding them.
- Cycode runs two layers of protection: a watchdog inside the scanner that recovers stalled scans, and a pull request guard outside the pipeline that tracks every check Cycode owes a pull request. At the deadline, the guard releases the Cycode checks that never arrived, even for pull requests that were never scanned, with a note that explains why.
- Real findings still block, and a late result replaces the release.
- It has limits. It won’t add to the load while GitHub is rate-limiting us, and it can’t fully control what happens during a GitHub incident.
The strongest control on a pull request
Making security checks required on a protected branch is one of the strongest controls a security team can turn on. Leaked secrets, vulnerable dependencies, and insecure code caught by static application security testing (SAST) stop at the pull request instead of landing on the main branch.
It works because GitHub enforces it. Once branch protection lists a check, GitHub marks it Expected on every new pull request and won’t allow a merge until that check passes. When the check finds a real problem, that’s exactly what you want.
When the check becomes the blocker
The same enforcement has a cost when a check goes quiet. It’s late in the afternoon. The fix is done, the review is approved, and every check on the pull request is green except one, still marked Expected. There’s no error to read and nothing to click. The developer refreshes the page, waits a bit longer, and starts asking around.
GitHub has no deadline for a required check. If the result never arrives, the pull request can’t merge, and the developer has no way to move it forward. Only someone with admin rights can unblock it, by overriding branch protection or removing the requirement.
That’s where the control starts to erode. Every override is a merge that skipped the check entirely. Teams that hit stuck checks often enough start asking for exceptions, then for the check to become optional. A control meant to stop risk turns into something people work around.
Why a required check is harder to run than it sounds
Between a push and a green check, a pull request scan passes through several systems: GitHub’s webhooks, the security tool’s own queues and services, and GitHub’s API on the way back. Each one can fail in its own way. None of these failures is common. But a busy organization opens a lot of pull requests, and at that volume, rare still means sometimes. From the developer’s side, every one of them looks the same: a check that stays Expected.
Sometimes the webhook is late. During its own incidents, GitHub retries and delays deliveries, and the scan can’t start until the webhook arrives. Sometimes a burst of pushes to one large repository fills a queue, and other work waits in line behind it. A database or service along the scanning path can go down. GitHub’s API rate limits can hold up the one write that would turn a check green. And once in a while, a scan finishes cleanly and its result never makes it to GitHub.
A tool that blocks merges has to plan for all of these, not just the good days. So Cycode’s pull request checks run with two independent layers of protection, each covering failures the other can’t see.
Layer one: a watchdog inside the scanner
The natural place to catch a stuck scan is the scanner itself, so that’s where our first layer has lived since day one of pull request scanning at Cycode. Every scan starts its own watchdog. It checks with GitHub every few minutes to see whether the scan’s status has arrived. If it hasn’t, the watchdog runs the scan again. If that second run doesn’t deliver either, it gives up and posts a passing check with a note that the scan didn’t run, so the pull request isn’t blocked forever.
Layer one: the watchdog lives inside the scanning service.
- Nobody watches before the scan starts. The watchdog is born with the scan, so a pull request held up by a late webhook or a full queue never gets one.
- It shares the scanner’s fate. When the scanning service is down, slow, or far behind, so is the watchdog.
- It has to ask GitHub. Every poll costs an API call, so when GitHub rate-limits us, the watchdog loses sight of the scan just when GitHub is under the most pressure.
For transient failures, like a scan that starts and then stalls, the watchdog does its job well, and it still runs today, alongside the guard. Any final status tells it the scan is done, including a release from the guard. What it can’t see is everything around it. It only exists once a scan has started, it goes down with the scanner, and it has to ask GitHub to find out anything. Those gaps call for a second layer.
Why not just ask GitHub?
There’s an obvious way to build that second layer: for every push, ask GitHub for the commit’s status after a few minutes, ask again a little later, and fix whatever is still missing. It takes an afternoon to write, and each question is a single API call. That’s exactly the problem.
GitHub gives every app installation an hourly budget of API calls, and Cycode needs that same budget for its real work, including writing every scan result back to the pull request. A couple of extra calls per push sounds cheap, but multiplied by every push in a busy organization it adds up fast, and nearly all of those calls would only confirm that everything is fine. Worse, a safety net matters most when GitHub is already slowing us down. A poller then competes for the same budget with the very status writes it’s trying to rescue, and makes the wait longer.
The watchdog already pays this price for the scans it watches. We didn’t want to build a second, bigger poller on top of it. We wanted a second layer that never has to ask GitHub whether a check landed.
Asking a different question
The watchdog asks, “Has this scan’s result reached GitHub?” It’s a fair question, but it only makes sense once a scan exists, and every answer costs a call to GitHub.
So we turned it around. Every Cycode check on a pull request is something we owe a developer, which makes the better question, “What did we promise this pull request, and what did we actually deliver?” Our pipeline already produces events that answer both halves, so nobody has to poll anything. A check we promised and never delivered is a check someone is still waiting on.
Layer two: a guard outside the pipeline
We built that question into a service of its own, the pull request guard. It sits next to the pipeline rather than inside it, with its own database and its own clock. It doesn’t scan anything, and it doesn’t poll GitHub to find out what happened. It listens.
Layer two: the guard listens to the pipeline from the outside. The blue lines are new, and the numbers show the guard’s part in order: it listens for three kinds of events and sends only one thing back, a release.
- Pushed. When GitHub’s webhook reaches us, our GitHub integration tells the guard, and the guard starts its clock from the moment the webhook arrived.
- Promised. The event reaches the scanning service through the queue, and the scanner tells the guard which checks it will report.
- Delivered. When a scan’s result reaches GitHub and GitHub accepts it, the integration tells the guard, and the guard marks that check as delivered.
- Release. At the deadline, the guard releases the checks that were promised but never delivered. A release goes out through the integration like any other status, and its delivery is confirmed the same way (step 3).
Every one of those choices closes a gap the watchdog left open. The clock starts when GitHub’s webhook reaches us, not when a scan begins, so a delay anywhere in our pipeline counts against the deadline instead of hiding from it. The guard runs on its own, with its own database, so an outage in the scanning pipeline doesn’t take it down too. Our GitHub integration tells it about every status GitHub accepts, so it never spends a GitHub API call to learn that a check landed. When the deadline comes, it decides from its own records.
And when the guard does step in, its release is an ordinary status write. It goes out through the same integration as a real result, and its delivery is confirmed the same way.
One pull request, start to finish
Here’s how that plays out for a pull request with three Cycode checks, where the Secrets scan gets held up inside our pipeline. Today the guard’s deadline is 15 minutes after the webhook reaches us. We chose 15 minutes because on a healthy day, nearly every scan that isn’t rate-limited gets its result to GitHub within that time. Every push starts its own clock, and a release only touches the commit its push was for.
At minute 15, the developer sees the stuck check change from Expected to passing, with a description that explains why: “Cycode couldn’t confirm a scan result in time, so it is not blocking this pull request. This check may update if a result arrives later.”
It has to be a pass. GitHub’s commit statuses only come as pass, fail, error, or pending, and branch protection only lets a pull request through on a pass. The description is what tells a release apart from a real result.
We chose that wording carefully. At that moment, all we know is that no result was confirmed. The scan might still be running, or its result might have been lost, so the check doesn’t claim more than that. If SAST had failed instead, that result would still be blocking the merge, exactly as it should.
The hardest case: a scan that never started
Comparing promised and delivered checks only works once the scanner has made a promise. If a pull request never reached a scanner at all, there’s nothing to compare against, yet branch protection is still waiting on Cycode. The watchdog can never see this case, because there’s no scan to watch.
For these pull requests, the guard works out what we would have owed. Its first stop is the scanning service, because that’s where each tenant’s scan settings live. It knows every check the tenant chose to run on the repository: the ones branch protection requires, and the non-blocking ones too. Branch protection on GitHub only knows the required ones.
The guard takes the steps below in order and stops as soon as it has an answer, so GitHub is only asked when the scanning service is down or too slow to answer. It’s the one case where the guard asks instead of listening, and it asks only once, at the deadline.
That fallback matters most when the scanner is the thing that’s down. Branch protection is GitHub’s own record of what a pull request is waiting for, so the guard can still act even when the scanner can’t answer.
A safety net, not a bypass
In security terms, a release is a fail-open decision: when no result is confirmed in time, the check passes instead of blocking. A service that can turn checks green has to earn some trust before it’s allowed to act. So we ran the guard in shadow mode first. It only recorded what it would have released, and we checked each of those decisions before switching it on. It lives by four rules:
- A finding still blocks. If a result reached GitHub, pass or fail, the guard leaves it exactly as it is.
- The real result wins. If the scan finishes after a release, its result replaces the release, and a late finding blocks the merge like any other (unless the pull request has been merged in the meantime).
- It respects GitHub’s “no”. When GitHub rate-limits us, the guard waits for the real result instead of adding to the load. When GitHub refuses a status because the Cycode app isn’t allowed to write to that repository, the guard stays out of it, since only the tenant can change that permission.
- Every release is investigated. Each one alerts our team, because the goal is to have nothing left to release.
What each layer covers
| Situation | Watchdog alone | Watchdog and guard |
|---|---|---|
| GitHub delivers the webhook late | Not covered | Not covered: the clock starts when it reaches us |
| Our queues back up | Not covered | Covered: the clock is already running |
| Our pipeline hours behind | Not covered | Not covered: too late to judge, left alone |
| Scan never started | Not covered | Covered: asks the scanner, then GitHub |
| Scanning service down or slow | Not covered | Covered: the guard runs on its own |
| Scan stalled midway | Covered: rescan | Covered: rescan, or a release at the deadline |
| Result lost on the way to GitHub | Partly: if the poll succeeds | Covered: released at the deadline |
| GitHub rate limits | Not covered: the real result lands once the limit resets | Not covered: the real result lands once the limit resets |
Breaking it on purpose
Shadow mode let us check the guard’s decisions on real traffic. We also wanted to watch it work through a genuinely bad day, so we made one in our test environment, in two different ways.
First, we switched off the step that hands pull requests to the scanner, so no scan ever started. At the deadline, the guard asked the scanning service which checks it would have run and released them. Then we switched off the scanning service itself. With no answer coming from it, the guard read the branch’s required checks from GitHub instead and released those. Either way, pull requests that would otherwise have sat on Expected could still be merged.
What the guard can’t do
The guard isn’t perfect, and it’s worth being clear about where it stops. It has a few dependencies of its own: its service, its database, the events it listens to, and our GitHub integration, which sends the release. What it changes is how many things have to go right. Without it, an unblocked merge depended on several services and databases along the scanning path all working at once. With it, getting a stuck check out of the way takes only that handful.
Even then, there are cases it can’t fix or deliberately leaves alone:
- Rate limits. When GitHub rate-limits us, the guard doesn’t release anything. A release is one more write competing for the same budget as the real results, so the guard waits, and the check can stay Expected until GitHub lets writes through again.
- GitHub incidents. When GitHub itself behaves in unexpected ways, for example during a GitHub incident, we can’t fully control what happens. One case we know about: if the scanner can’t say which checks a never-scanned pull request needs, and GitHub can’t answer either, the guard has nothing safe to release and leaves the pull request alone.
- A release that doesn’t land. A release is an ordinary status write, so it can fail like any other. The guard doesn’t retry it, and the check stays Expected.
- Webhooks GitHub delivers late. The clock starts when a webhook reaches us, so time GitHub spends delivering it isn’t counted, and the guard can’t act on a push it hasn’t heard about yet.
- A pipeline hours behind. If the guard first hears about a push hours after the webhook reached us, it leaves that push alone, because by then it can’t tell what really happened.
What this means for development teams
Blocking a merge is a strong position for a security tool to take, and it only holds if the tool doesn’t become the thing that slows delivery down. A developer should be held up by a real finding, not by a backed-up queue or a service having a bad day.
With both layers in place, making Cycode’s checks required no longer means betting a merge on every service, queue, and database along the scanning path. Real findings still stop a merge. A stalled pipeline doesn’t.
As a first step, the guard works only with GitHub: it runs for pull requests in GitHub and GitHub Enterprise repositories connected to Cycode.
See Cycode in actionBook a demo