# Import other scanners' reports

> Gate, convert and annotate scanner reports, including Semgrep, Trivy, gitleaks and ZAP, with the Keryn CLI or Keryn Web.

Source: https://keryn.dev/docs/guides/import/

## Goal

Put the findings of a scanner you already run through the same gate, outputs and annotations as a Keryn scan, so that one exit code and one SARIF file cover all of them. Nothing is re-scanned: Keryn reads the report.

## Before you start

- A scanner report in a supported format, such as Semgrep JSON, Trivy JSON, a gitleaks report, ZAP XML or SARIF.
- The Keryn CLI ([install](https://keryn.dev/docs/start/install/)), or [Keryn Web](https://keryn.dev/docs/guides/web-app/) for a one-off look.

## 1. See what it understands

**CLI**

```sh
keryn import --list | awk '$1 == "acunetix" || $1 == "anchore_engine"'
```

```text
  acunetix                                 irregular  Acunetix Scan
  anchore_engine                           json       Anchore Engine Scan
```

The parsers are the DefectDojo parser corpus, ported to Rust and compiled to WebAssembly, and they run locally. Each line is a parser id, the shape of the file, and the scanner's name. Run `keryn import --list` without the pipe to see the full list and total for your installed CLI.

**Web**

In [Keryn Web](https://keryn.dev/docs/guides/web-app/), drop the report onto the page, or use **Settings, Import**. Keryn detects whether the file is source, a scanner report, a binary or a workflow export, and shows the findings next to any scan results.

## 2. Import a report

Here is a small report in SARIF, written for this page: another tool found a token in `agent.py`.

```json
{
  "version": "2.1.0",
  "$schema": "https://www.schemastore.org/sarif-2.1.0.json",
  "runs": [{
    "tool": {"driver": {"name": "othertool", "rules": [{"id": "OT-001", "shortDescription": {"text": "Hard-coded token"}}]}},
    "results": [{
      "ruleId": "OT-001",
      "level": "error",
      "message": {"text": "A token is committed in the source."},
      "locations": [{"physicalLocation": {"artifactLocation": {"uri": "agent.py"}, "region": {"startLine": 4}}}]
    }]
  }]
}
```

```sh
keryn import other.sarif
```

```text
imported 1 findings from sarif (SARIF) · 1 observations · <n> ms
  also claimed by: api_sonarqube, checkmarx, checkov, cppcheck, crunch42, devskim, flawfinder, kubelinter, mozilla_observatory, snyk, snyk_code, sonarqube (pass --parser to use one of them)
coverage: 1 observations imported from sarif (SARIF); 1 report file read; no rules executed.
result: FAIL (exit 1) - 1 violation(s)/finding(s) at or above 'error'
```

Without `--parser`, Keryn detects the format from the bytes, and refuses when it cannot tell (it then asks for `--parser`). Here it recognised SARIF; the line `also claimed by` names other parsers that accept SARIF-shaped files, and `--parser` picks one of them or pins your choice (`--parser sarif`). The coverage line is the honest part: one report was read, **no rules executed**. An import never claims a scan happened.

## 3. Use the same gate and outputs

The import takes the scan's gate and output flags, so the other scanner's findings can feed the same pipeline:

```sh
keryn import other.sarif --parser sarif --fail-on none --sarif - --quiet | jq -c '.runs[0].results[0] | {ruleId, level}'
```

```text
{"ruleId":"othertool:OT-001","level":"error"}
```

The rule id is prefixed with the tool that produced it. `--fail-on none` turns the gate off for this run (exit 0); the default fails on `error`, exactly as for a scan. `--markdown`, `--junit`, `--annotations github` and the rest work the same way. No rules run during an import and no AI-BOM is produced, so `--aibom` is refused.

The following authored reports let you exercise the same adapters locally. Their identifiers and findings are synthetic.

```json
{
  "version": "1.0.0",
  "results": [{
    "check_id": "fixture.rule", "path": "agent.py",
    "start": {"line": 4, "col": 1}, "end": {"line": 4, "col": 12},
    "extra": {"message": "Synthetic scanner finding.", "severity": "WARNING"}
  }],
  "errors": []
}
```

```json
{
  "SchemaVersion": 2, "ArtifactName": "fixture", "ArtifactType": "filesystem",
  "Results": [{
    "Target": "requirements.txt", "Class": "lang-pkgs", "Type": "pip",
    "Vulnerabilities": [{
      "VulnerabilityID": "CVE-2099-0001", "PkgName": "openai",
      "InstalledVersion": "1.0.0", "FixedVersion": "1.0.1", "Severity": "HIGH",
      "Title": "Synthetic advisory fixture", "Description": "Not a real advisory."
    }]
  }]
}
```

```sh
keryn import semgrep.json --sarif out.sarif --fail-on error
keryn import trivy.json --parser trivy --markdown summary.md
```

The SARIF contains the imported finding, and the Markdown keeps the synthetic Trivy identifier:

```sh
jq '.runs[0].results | length' out.sarif
grep -q 'CVE-2099-0001' summary.md
```

```text
1
```

## What you just proved

An import moves a claim made by **another tool** into your gate without upgrading it: the finding keeps the other tool's name in its rule id, the coverage line says no Keryn rule ran, and the proof level is not invented. You get one place that decides pass or fail, and an honest record of where each finding came from.

## Next

- Wire the combined gate into a pipeline: [CI](https://keryn.dev/docs/guides/ci/).
- Record why a finding is accepted: [suppressions](https://keryn.dev/docs/guides/suppressions/).
- The formats Keryn writes: [formats](https://keryn.dev/docs/reference/formats/).
