External Scanner Sidecar & Two-Stage Vulnerability DB Rotation
Arka stores scan jobs, security policies, SBOMs, and vulnerability findings in PostgreSQL. When a scan runs, an Arka job worker streams the SHA-256-addressed blob over private HTTP to arka-scanner (ghcr.io/ccsert/arka-scanner:<version>). The scanner verifies the digest, generates CycloneDX 1.5 and SPDX 2.3 SBOMs with Syft, and evaluates vulnerabilities with Grype against a local offline database. arka-scanner never needs PostgreSQL or object-storage credentials and runs with zero internet egress (egress: []).
Enable it per repository by setting scannerDriver=grype and scannerExecution=sidecar (write shorthand: scannerDriver=sidecar) together with scanOnPublish=true. Add quarantineEnabled=true and blockUnscanned=true for fail-closed download quarantine, or enable the SBOM License Compliance Gate.
1. Automated Two-Stage DB Rotation on Kubernetes (Recommended)
Because Grype enforces a default 120-hour (5d) maximum database age (GRYPE_DB_MAX_ALLOWED_BUILT_AGE=120h), stale databases cause /readyz to return 503. On Kubernetes, enable Helm's scanner.dbUpdater CronJob so the database rotates automatically while arka-scanner stays strictly read-only and offline:
- Stage & Validate: The CronJob (
concurrencyPolicy: Forbid, default0 */12 * * *) downloads a fresh Grype DB (from your internal mirrorupdateURL, a checksum-qualifiedarchiveURL, or upstream listing) into/var/lib/grype/releases/<YYYYMMDDTHHMMSSZ>-XXXXXXand runsgrype db statusvalidating schema, hash integrity, build age (maxDbAgeHours: 96), and a non-emptyvulnerability.db. - Atomic Switch: Only when all checks pass does
rotate.shatomically swap/var/lib/grype/currentvia POSIXmv -Tf. - Retention & Rollback: Retains at least
keepReleases: 2generations (active + previous).arka-scannermounts the PVCreadOnly: true, reads/var/lib/grype/current, and denies all egress via NetworkPolicy (egress: []).
Helm Configuration
networkPolicy:
enabled: true
scanner:
enabled: true
replicaCount: 1
image:
repository: ghcr.io/ccsert/arka-scanner
tag: "" # Empty inherits Chart.AppVersion (e.g. 1.0.0); digest overrides tag
digest: ""
pullPolicy: IfNotPresent
existingSecret: arka-scanner # Must contain key `token` (>= 16 chars)
dbExistingClaim: arka-scanner-grype-db # Use RWX when Updater & Scanner may land on different nodes
dbMaxAllowedBuiltAge: "120h"
workspaceSize: 2Gi
dbUpdater:
enabled: true
schedule: "0 */12 * * *"
stagingDir: releases
currentLink: current
keepReleases: 2
maxDbAgeHours: 96
rolloutRestart: false
dbSource:
updateURL: "https://grype-mirror.internal.example.com/listing.json" # Set at most ONE of updateURL / archiveURL
archiveURL: ""
proxySecretName: "" # Optional Secret: HTTPS_PROXY / HTTP_PROXY / NO_PROXY
caConfigMapName: "" # Optional ConfigMap with private mirror CA (`ca.crt`)
networkPolicy:
egress:
# Allow only DNS + your internal mirror/proxy (+ Kubernetes API if rolloutRestart=true)
- to:
- ipBlock:
cidr: 10.20.0.0/16
ports:
- protocol: TCP
port: 443Seed an empty PVC immediately after installing without waiting for the next cron tick:
kubectl -n arka create job --from=cronjob/arka-scanner-db-updater scanner-db-initial
kubectl -n arka logs -f job/scanner-db-initialInstant manual rollback: Suspend the CronJob, wait for any running Job to finish, and atomically repoint /var/lib/grype/current to the previous directory under /var/lib/grype/releases/.
2. Vulnerability DB Observability & 96h Alerting
arka-scanner exposes /metrics on port 8091 and always returns HTTP 200 even when /readyz returns HTTP 503 (expired, missing, or invalid database).
| Metric | Meaning |
|---|---|
arka_scanner_db_ready | 1 when the vulnerability DB passed validation, 0 otherwise |
arka_scanner_db_built_at_timestamp_seconds | DB build time in Unix seconds (0 when missing or error) |
arka_scanner_db_age_seconds | Current DB age in seconds (-1 when missing or error) |
arka_scanner_db_max_age_seconds | Configured GRYPE_DB_MAX_ALLOWED_BUILT_AGE in seconds (default 432000 = 120h) |
arka_scanner_db_status{state="..."} | One-hot gauge (1 for active state): ready, expired, missing, error |
arka_scanner_active, arka_scanner_queue_depth, arka_scanner_queue_rejected_total, arka_scanner_disk_* | Per-instance concurrency, queue backpressure, and tmpfs workspace headroom |
Recommended Prometheus Alert Rules (Warn at 96h, Page Before 120h Expiry)
Scrape Scanner Pods directly (retaining NotReady Pods; see Production Deployment):
groups:
- name: arka-scanner-db
rules:
- alert: ArkaScannerDBAgingWarning
expr: arka_scanner_db_age_seconds > 345600
for: 15m
labels:
severity: warning
annotations:
summary: "Arka Scanner vulnerability DB is older than 96h (expires at 120h)"
description: "Pod {{ $labels.pod }} DB age is {{ $value | humanizeDuration }}. Check scanner-db-updater CronJob."
- alert: ArkaScannerDBUnavailable
expr: arka_scanner_db_ready == 0
for: 5m
labels:
severity: critical
annotations:
summary: "Arka Scanner vulnerability DB is not ready (expired, missing, or error)"3. Manual Air-Gapped Transfer (No CronJob / Docker Compose)
Use the exact same published scanner image (ghcr.io/ccsert/arka-scanner:1.0.0) on a connected staging host so the Grype schema version matches:
export SCANNER_IMAGE="ghcr.io/ccsert/arka-scanner:1.0.0"
export DB_STAGE="$(mktemp -d)"
mkdir "$DB_STAGE/grype"
docker run --rm --entrypoint /usr/local/bin/grype --user "$(id -u):$(id -g)" \
--mount "type=bind,src=$DB_STAGE/grype,dst=/var/lib/grype" \
"$SCANNER_IMAGE" db update
docker run --rm --entrypoint /usr/local/bin/grype --user "$(id -u):$(id -g)" \
--mount "type=bind,src=$DB_STAGE/grype,dst=/var/lib/grype,readonly" \
"$SCANNER_IMAGE" db status -o jsonKeep the entire grype directory (including import.json). Package it as a tarball or data-only OCI image, verify its SHA-256 across the air gap, make it readable by UID/GID 10001, and mount it read-only:
# Docker Compose overlay with local quickstart
export ARKA_SCANNER_IMAGE="ghcr.io/ccsert/arka-scanner:1.0.0"
export ARKA_SCANNER_DB_PATH="$PWD/arka-grype-db"
export ARKA_SCANNER_TOKEN="$(openssl rand -hex 24)"
docker compose -f docker-compose.quickstart.yml \
-f deploy/scanner/docker-compose.scanner.yml up -d --no-build --pull neverAlternatively, to import an official Grype archive directly at startup, set ARKA_SCANNER_GRYPE_DB_ARCHIVE (local file path) + ARKA_SCANNER_GRYPE_DB_ARCHIVE_SHA256 (expected lowercase SHA-256) with a writable ARKA_SCANNER_GRYPE_DB_DIR.
4. Capacity, Probes & Backpressure Tuning
- Probes:
/healthzreturns process diagnostics (HTTP 200);/readyzreturns HTTP503if Syft/Grype, disk headroom, or the validated DB is unavailable. Check end-to-end connectivity from Arka viaarkactl security scanner status --json. - Backpressure HTTP codes:
429(queue full) and503(workspace full or DB unready) includeRetry-After, which Arka honors; oversized inputs return413.
| Variable | Default | Purpose |
|---|---|---|
ARKA_SCANNER_TOKEN | (required) | Shared bearer token (>= 16 non-whitespace chars) |
ARKA_SCANNER_LISTEN_ADDR | :8091 | HTTP bind address |
ARKA_SCANNER_MAX_CONCURRENT | 2 | Active scan jobs per scanner instance |
ARKA_SCANNER_MAX_QUEUE | 8 | Queued scan requests waiting for a worker |
ARKA_SCANNER_MAX_ARTIFACT_BYTES | 128 MiB | Max single artifact input size |
ARKA_SCANNER_MAX_WORKSPACE_BYTES | 512 MiB | Reserved workspace per scan (input + extraction + temp files) |
ARKA_SCANNER_DISK_QUOTA_BYTES | 2 GiB | Total workspace quota across concurrent jobs |
ARKA_SCANNER_MIN_FREE_BYTES | 32 MiB | Minimum free workspace headroom |
ARKA_SCANNER_TIMEOUT | 4m | Max queue wait + scan duration |
ARKA_SCANNER_DB_POLL_INTERVAL | 1m | How often scanner revalidates /var/lib/grype |
GRYPE_DB_MAX_ALLOWED_BUILT_AGE | 120h | Max allowed DB build age before /readyz flips to 503 |
Memory sizing: Kubernetes templates mount
/tmp(ARKA_SCANNER_WORK_DIR) as a boundedemptyDir(medium: Memory, default2Gi). tmpfs usage counts against Pod memory limits, so sizescanner.resources.limits.memory(default4Gi) aboveworkspaceSize+ runtime overhead.
5. Querying SBOMs & Group Evidence Reuse
# Inspect CycloneDX or SPDX SBOM for an asset
arkactl security sboms get "$ASSET_ID" --format cyclonedx --json
# Retrieve through a Group repository with groupScanReuse=true
arkactl security sboms get "$ASSET_ID" --repository-id "$GROUP_ID" --format spdx --jsonWith groupScanReuse=true, Groups reuse verified sidecar scan results and SBOMs across members for identical SHA-256 digests and input profiles while independently enforcing each Group's own vulnerability thresholds, waivers, and license compliance policies.