Skip to content
BETAGuardrails are in beta. The library, the configuration format and the CLI command can still change.

Guardrails / Collectors

Security scan findings

Findings from whatever scanner the build already ran, read from the report it left behind and normalized into one shape, whether the tool was a SAST, an SCA, a secret detector or an infrastructure scanner.

Facts keyscan
Versionv1
Scriptscan.py
Timeout60 seconds

Inputs

InputDescriptionDefaultEnvironment
reportsComma separated globs matched against every file in the working directory and against bare file names, naming the scanner reports to read.*.sarif,*.sarif.json,trivy*.json,grype*.json,osv*.json,semgrep*.json,snyk*.jsonGUARDRAIL_INPUT_REPORTS
maxFindingsMost findings to carry in the facts. The counts stay whole when findings are dropped.200GUARDRAIL_INPUT_MAXFINDINGS

A guardrail that declares an input of the same name passes it through, so the guardrail's configuration in buildnote.json is what decides these values.

A guardrail asks for these facts by name, and reads them back the same way:

json
{
  "collect": ["scan"]
}
python
scan = guardrail.facts("scan")

Facts

The document scan collects. A path carrying [] is an entry of the list before it, and one carrying [path] is a key of the object before it.

FactMeaning
sourcereport when a scanner report was read, none when there was none.
reasonWhy nothing was read, present only when source is none.
reportsEvery report that was read, newest path order.
reports[].pathPath of the report, relative to the directory the CLI runs in.
reports[].modifiedWhen the report was last written, ISO 8601, so a stale report is recognisable.
reports[].formatFormat it was read as: sarif, trivy, grype or osv.
reports[].producer.nameScanner that wrote it, as the report names itself, or null when it names none.
reports[].producer.versionVersion of that scanner, or null when the report carries none.
reports[].findingsHow many findings that report carried.
counts.totalFindings across every report that was read.
counts.criticalFindings the scanner rated critical.
counts.highFindings rated high.
counts.mediumFindings rated medium.
counts.lowFindings rated low.
counts.infoFindings rated informational.
counts.unknownFindings the scanner gave no severity, or one nobody recognises.
kinds.sastFindings about the repository's own code.
kinds.scaFindings about a dependency.
kinds.secretFindings about a credential in the tree.
kinds.iacFindings about infrastructure code.
kinds.containerFindings about a container image.
kinds.unknownFindings nothing classified.
findingsThe findings themselves, up to maxFindings.
findings[].idRule or vulnerability identifier the scanner gave it.
findings[].severitycritical, high, medium, low, info or unknown.
findings[].messageWhat the scanner said, truncated to 500 characters.
findings[].pathFile it was found in, relative to the working directory, or null.
findings[].lineLine it was found on, or null.
findings[].kindsast, sca, secret, iac, container or unknown.
findings[].package.nameDependency it is about, present only for a finding about one.
findings[].package.versionVersion of that dependency.
findings[].identifiersEvery CVE, GHSA or other identifier the scanner attached.
findings[].fixedInVersion that fixes it, or null when the scanner names none.
findings[].fingerprintStable identity of the finding across runs, so the same finding is recognisable in a later build.
droppedFindings left out because maxFindings was reached.

A collector that cannot finish prints what it had along with an incomplete key saying why, so the facts below the point it stopped are absent. A check that cares reads incomplete before the rest.

Example facts

The example facts collected by scan collector:

json
{
  "source": "report",
  "reports": [
    {
      "path": "security-scan.sarif",
      "modified": "2026-03-04T10:15:00Z",
      "format": "sarif",
      "producer": {
        "name": "Semgrep OSS",
        "version": "1.86.0"
      },
      "findings": 1
    },
    {
      "path": "trivy.json",
      "modified": "2026-03-04T10:15:00Z",
      "format": "trivy",
      "producer": {
        "name": "trivy",
        "version": null
      },
      "findings": 1
    }
  ],
  "counts": {
    "critical": 1,
    "high": 1,
    "medium": 0,
    "low": 0,
    "info": 0,
    "unknown": 0,
    "total": 2
  },
  "kinds": {
    "sast": 1,
    "sca": 1,
    "secret": 0,
    "iac": 0,
    "container": 0,
    "unknown": 0
  },
  "findings": [
    {
      "id": "kotlin.lang.security.insecure-hostname-verifier",
      "severity": "high",
      "message": "Hostname verification is disabled, so any certificate is accepted.",
      "path": "service/src/main/kotlin/Queue.kt",
      "line": 1,
      "kind": "sast",
      "package": null,
      "identifiers": [],
      "fixedIn": null,
      "fingerprint": "262b267f2df80c2e"
    },
    {
      "id": "CVE-2021-44228",
      "severity": "critical",
      "message": "log4j-core: remote code execution via JNDI lookup",
      "path": "service/build.gradle.kts",
      "line": null,
      "kind": "sca",
      "package": {
        "name": "org.apache.logging.log4j:log4j-core",
        "version": "2.14.1"
      },
      "identifiers": [
        "CVE-2021-44228"
      ],
      "fixedIn": "2.15.0",
      "fingerprint": "c1d7cd4ef6d2fed9"
    }
  ],
  "dropped": 0
}

Collected for

GuardrailCategoryInputs
security/finding-budgetsecuritynone
security/fixable-vulnerabilitiessecuritynone
security/no-high-findingssecuritynone
security/scan-results-presentsecuritynone
supply-chain/no-critical-vulnerabilitiessupply-chainnone

All collectors

Buildnote Limited
Registered in England and Wales, Reg: 16140412