A pull request check answers one question: does this change make the repository less secure? TRUSTIVAN scans the pull request’s head commit and its base commit, compares the two by finding fingerprint, and reports only what the change introduces. A vulnerability, secret or code finding that is already on the base branch is not repeated on every pull request.

What the check reports

  • Passed: your organization’s enabled policy passes over the findings the change introduces.
  • Failed: the policy fails over them, a scan of the head or base commit did not complete, or a scan reported more findings than TRUSTIVAN stores for a comparison. A check that could not look is never a pass.
  • No verdict (GitHub neutral, GitLab success): the organization has no enabled policy. The introduced findings are still listed.
The policy is the same one the CLI gate uses, but evaluated over the introduced findings only. A suppression you already recorded on the repository’s finding still applies, as your policy’s suppression mode says. No verdict record is stored for a pull request check; its result is on the check itself and in the repository’s page in TRUSTIVAN. Annotations go on findings that name a file: at most 200 per check, worst first, sent 50 per request as GitHub requires. A finding without a file path (for example, a vulnerability reported from a lockfile with no line) is listed in the summary table instead.

How comparison works

Each finding has a fingerprint built from what it is (the advisory and package, the secret rule, file and credential digest, the code rule and file), never from its line number. So a finding that moved because lines were added above it is neither new nor fixed. A finding without a fingerprint is treated as new. The two scans are check-only. They do not change the repository’s findings in TRUSTIVAN: a pull request is code that is not merged, and reconciling it would mark main-branch findings as resolved because a branch happens to fix them. Two pull requests on the same base commit share one scan of it.

Set it up

PR checks are off for every repository until you switch them on.
  1. Link the code host to your organization (below).
  2. Add the repository as an asset by scanning it once. A private repository clones with the same credential every scan of it uses: a stored git credential for the host if you have one, otherwise, on github.com, a read-only token from the linked App installation on the account that owns the repository. On GitLab a stored credential is the only way.
  3. On the repository’s page in TRUSTIVAN, turn on PR checks in the Pull requests card, or call PATCH /api/v1/assets/{id}/code-settings with {"pr_checks_enabled": true}.
Install the deployment’s GitHub App on the account that owns the repository, with Checks: read and write, Contents: read (read and write for fix pull requests), Pull requests: read and write and Metadata: read, subscribed to Pull request events. Then link it from the repository’s page, in the Pull requests card:
  1. Choose Install the GitHub App if it is not installed yet. TRUSTIVAN reads the address of the App’s install page from GitHub.
  2. The card lists the installations GitHub says you can access. Choose Link beside the account. There is no id to type.
GitHub lists installations only for a token from the App’s own sign-in. A token from a separate OAuth App gets 403 and an expired one gets 401, so when TRUSTIVAN has neither, the card offers Authorize on GitHub. That stores a token for you and comes back to the same page. It does not sign you in, and does not make that GitHub account a way to sign in to TRUSTIVAN. TRUSTIVAN links an installation only if GitHub lists it among the ones your GitHub account can access (GET /user/installations, with your own token). An API key cannot link one, and an installation linked to another organization is refused. Linking needs credentials:manage. The same through the API, from a session:
Deliveries for an installation no organization has linked, for a repository that is not an asset, or with PR checks off, are acknowledged and ignored. Pull requests from forks and drafts are not checked.

Create a GitLab webhook

The response carries webhook_url and secret_token, shown once. In the GitLab project, add a webhook with that URL and secret token and tick Merge request events. TRUSTIVAN stores only a SHA-256 of the token. The results are posted with your organization’s stored git credential for that host, which needs the api scope. Merge requests from forks and drafts are not checked.

When the host is unavailable

The webhook only records the pull request; a background task talks to GitHub or GitLab and queues the scans. A failed call is retried with backoff (30 seconds, doubling, up to 30 minutes) and the check is marked errored after 8 attempts, with the reason shown on the repository’s page.

Limits

  • github.com and GitLab only. GitHub Enterprise Server and Bitbucket are not supported yet.
  • Check scans run your organization’s scanner selection for repositories (Settings → Data and evidence → Repository scanners). With no selection that is vulnerabilities, secrets and the SBOM, so misconfiguration and static analysis run on a pull request only once you select them, and static analysis also needs the deployment’s analyser image. A selected scanner the deployment cannot run is left out of the check rather than failing it.
  • Verification: the GitHub and GitLab API calls are tested against recorded API responses shaped from GitHub’s and GitLab’s published examples, through the same outbound network guard production uses, and a clone with an installation token is tested against a local git server. None of it has been run against a live GitHub or GitLab account.

API