# keryn sca db

Describes Keryn 0.5.2 and keryn-rules 0.8.0.

> keryn sca db: OSV-Scanner execution, SCA report intake with completion receipts, complete-package inventory, offline advisory assessment, Deno inventory, SBOM-to-files comparison

Source: https://keryn.dev/docs/reference/cli/sca-db/

> **Caution: Next release: keryn sca db**
> On main; not in Keryn 0.5.2, the latest release.

OSV-Scanner execution, SCA report intake with completion receipts, complete-package inventory, offline advisory assessment, Deno inventory, SBOM-to-files comparison.

```text
keryn sca db update --from <directory|https URL> [--ecosystems <name,...>] [--check] [--json]
       keryn sca db status [--json]
```

## Options

```text
Usage: keryn sca db update --from <directory | https URL> [--ecosystems npm,PyPI,...] [--check] [--json]
       keryn sca db status [--json]
  The offline advisory snapshot: OSV records for whole ecosystems, on this machine. keryn scan and keryn sca image check dependencies
  against it with no flag and no network, and the report states its date.
  update   --from a folder that holds OSV's exports (<ecosystem>/all.zip, as published at https://osv-vulnerabilities.storage.googleapis.com)
           builds the snapshot from them; --from an https address downloads those files from that address first (the only network call,
           only in this command); --from a built snapshot installs it only when it carries a valid signature. A snapshot that is unsigned,
           altered or truncated is refused whole and the installed one is left as it was. --ecosystems picks the exports (default for an
           address: npm, PyPI, Maven, Go, crates.io, RubyGems, NuGet, Packagist; for a folder: every export in it). Distribution exports
           (Debian, Ubuntu, Alpine) are large; name them to include them. --check does everything except install.
  status   per ecosystem: record count, source and date; exit 3 when no snapshot is installed or it does not verify.
  The snapshot lives in the user data directory (KERYN_SCA_DB=<dir> overrides; KERYN_SCA_DB=off makes scans ignore it).
```

## Examples

```sh
# On the machine without a network: build the snapshot from the export files you carried in (npm/all.zip, PyPI/all.zip, ...).
keryn sca db update --from ./osv-exports

# On a connected machine: download the two exports from that address and build the snapshot.
keryn sca db update --from https://osv-vulnerabilities.storage.googleapis.com --ecosystems npm,PyPI

# What dependencies are checked against when there is no network.
keryn sca db status
```

## Exit codes

| Code | Meaning |
|---|---|
| 0 | update: installed (or, with --check, would install); status: a snapshot is installed and verifies |
| 2 | usage error, or update refused the snapshot whole (unsigned, altered, truncated, not there): nothing is installed and the previous snapshot stays |
| 3 | status: no snapshot is installed, or it was refused |

## Environment

| Variable | Meaning | Default |
|---|---|---|
| `GITHUB_TOKEN` | Token for keryn decide export --github. There is no flag for it. | unset |
| `GITLAB_TOKEN` | Token for keryn decide export --gitlab. There is no flag for it. | unset |
