Require the security check before a merge.
The security scan posts a status check. Your repository decides whether that check can stop a merge. Here is how to turn a report into a gate, and the one configuration mistake that leaves a pull request waiting indefinitely.
The division of labor
Kandryn reports a result. Your repository decides what that result prevents. Keeping those two straight is most of what this page is about.
- What it is
- A status check carrying the result of one scan of one committed change.
- What enforces it
- Your repository rule. Kandryn reports the result; the rule is what blocks a merge.
- What it never does
- Merge, approve or deploy. There is no merge call anywhere in Kandryn.
- What it cannot see
- The scan reads one file at a time with no cross-file context, so issues that only appear across several files, or in a dependency manifest, are largely out of its reach.
- How findings are grouped
- Against the OWASP Top 10 (2021). It is one check beside the ones your team already runs, not a replacement for them.
5 steps
Run the scan once, on a committed change.
The security scan is something a person starts, on a run whose change has already been committed. It does not run on its own. Until one scan has posted, the check does not exist in your repository and there is nothing for a rule to require.
- Looks like
- A result on the run, and a status named kandryn/security against the commit on GitHub, or against the pull request on Azure Repos.
- Worth knowing
- On Azure Repos the status attaches to a pull request, so a run without one has nothing to post to. Posting is also non-fatal: if it fails, the run still succeeds and the check is simply absent.
Require that check on the branch you protect.
On GitHub, add kandryn/security to the required status checks of a ruleset or a branch protection rule on your default branch. On Azure DevOps, add it as a branch policy. This is the step that changes anything: until you take it, the check reports and blocks nothing.
- Looks like
- The pull request checks list shows the requirement, and merging is unavailable while the check is failing.
- Worth knowing
- Kandryn cannot configure this for you. It writes only to its own branch and has no merge path in its code, which is why the enforcement has to live in your repository.
Decide what happens when no scan has run.
Because a person starts each scan, a required check has no result at all on a pull request nobody scanned, and a required check with no result is not satisfied. That pull request waits. Choose deliberately: either running the scan becomes part of review, or the rule is scoped to the branches where a scan is expected.
- Looks like
- Every pull request your rule covers either has a scan result or has a named person responsible for producing one.
- Worth knowing
- This is the configuration mistake that turns a useful gate into a blocked queue a week later. Decide it before you require the check, not after.
Confirm it on one pull request.
Open one, let a scan post a pass, and check that merging behaves as you expect. Then look at a failing result if you can produce one. A gate nobody has watched fail is a gate whose shape nobody knows.
- Looks like
- A passing check merges, a failing one does not, and the reviewer can see which finding caused it.
- Worth knowing
- The gate fails on a critical or high finding, and also when a file could not be read, which fails closed. Medium and lower findings report without blocking.
Decide who can clear a block, on both sides.
There are two different bypasses and they belong to different people. Your repository rule decides who may merge past a failing check, through a GitHub ruleset bypass actor or an Azure DevOps policy exemption. Inside Kandryn, clearing a blocked gate takes a written reason, and the findings are frozen into the record alongside the person who cleared it.
- Looks like
- Both answers are written down, and the people holding them know that they do.
- Worth knowing
- Where a project requires a second approver, the person who triggered the run cannot clear its gate. A run from before trigger attribution cannot be cleared at all while that setting is on.
The mistake worth repeating
A required check that nobody posts blocks everything
Scans are started by a person. A required status check that no scan has posted has no result, and a required check with no result is not satisfied, so the pull request waits. This looks like the gate working on the first day and like a broken queue on the fifth. Decide who runs the scan, or scope the rule to the branches where one is expected, before you make the check required.
Where this fits
The security scan is one of three things a person can ask for on a committed change. None of them runs on its own, and a change nobody follows up on has had none of them.
Set the gate up on one repository first.
Bring the branch rules you already run and we will go through where the check fits, who should be able to clear a block, and what to do about pull requests nobody scanned.