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, GitLabsuccess): the organization has no enabled policy. The introduced findings are still listed.
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.- Link the code host to your organization (below).
- 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.
- On the repository’s page in TRUSTIVAN, turn on PR checks in the
Pull requests card, or call
PATCH /api/v1/assets/{id}/code-settingswith{"pr_checks_enabled": true}.
Link the GitHub App
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:- Choose Install the GitHub App if it is not installed yet. TRUSTIVAN reads the address of the App’s install page from GitHub.
- The card lists the installations GitHub says you can access. Choose Link beside the account. There is no id to type.
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:
Create a GitLab webhook
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.