Skip to content

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.


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:

  1. Stage & Validate: The CronJob (concurrencyPolicy: Forbid, default 0 */12 * * *) downloads a fresh Grype DB (from your internal mirror updateURL, a checksum-qualified archiveURL, or upstream listing) into /var/lib/grype/releases/<YYYYMMDDTHHMMSSZ>-XXXXXX and runs grype db status validating schema, hash integrity, build age (maxDbAgeHours: 96), and a non-empty vulnerability.db.
  2. Atomic Switch: Only when all checks pass does rotate.sh atomically swap /var/lib/grype/current via POSIX mv -Tf.
  3. Retention & Rollback: Retains at least keepReleases: 2 generations (active + previous). arka-scanner mounts the PVC readOnly: true, reads /var/lib/grype/current, and denies all egress via NetworkPolicy (egress: []).

Helm Configuration ​

yaml
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: 443

Seed an empty PVC immediately after installing without waiting for the next cron tick:

bash
kubectl -n arka create job --from=cronjob/arka-scanner-db-updater scanner-db-initial
kubectl -n arka logs -f job/scanner-db-initial

Instant 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).

MetricMeaning
arka_scanner_db_ready1 when the vulnerability DB passed validation, 0 otherwise
arka_scanner_db_built_at_timestamp_secondsDB build time in Unix seconds (0 when missing or error)
arka_scanner_db_age_secondsCurrent DB age in seconds (-1 when missing or error)
arka_scanner_db_max_age_secondsConfigured 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

Scrape Scanner Pods directly (retaining NotReady Pods; see Production Deployment):

yaml
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:

bash
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 json

Keep 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:

bash
# 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 never

Alternatively, 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: /healthz returns process diagnostics (HTTP 200); /readyz returns HTTP 503 if Syft/Grype, disk headroom, or the validated DB is unavailable. Check end-to-end connectivity from Arka via arkactl security scanner status --json.
  • Backpressure HTTP codes: 429 (queue full) and 503 (workspace full or DB unready) include Retry-After, which Arka honors; oversized inputs return 413.
VariableDefaultPurpose
ARKA_SCANNER_TOKEN(required)Shared bearer token (>= 16 non-whitespace chars)
ARKA_SCANNER_LISTEN_ADDR:8091HTTP bind address
ARKA_SCANNER_MAX_CONCURRENT2Active scan jobs per scanner instance
ARKA_SCANNER_MAX_QUEUE8Queued scan requests waiting for a worker
ARKA_SCANNER_MAX_ARTIFACT_BYTES128 MiBMax single artifact input size
ARKA_SCANNER_MAX_WORKSPACE_BYTES512 MiBReserved workspace per scan (input + extraction + temp files)
ARKA_SCANNER_DISK_QUOTA_BYTES2 GiBTotal workspace quota across concurrent jobs
ARKA_SCANNER_MIN_FREE_BYTES32 MiBMinimum free workspace headroom
ARKA_SCANNER_TIMEOUT4mMax queue wait + scan duration
ARKA_SCANNER_DB_POLL_INTERVAL1mHow often scanner revalidates /var/lib/grype
GRYPE_DB_MAX_ALLOWED_BUILT_AGE120hMax allowed DB build age before /readyz flips to 503

Memory sizing: Kubernetes templates mount /tmp (ARKA_SCANNER_WORK_DIR) as a bounded emptyDir (medium: Memory, default 2Gi). tmpfs usage counts against Pod memory limits, so size scanner.resources.limits.memory (default 4Gi) above workspaceSize + runtime overhead.


5. Querying SBOMs & Group Evidence Reuse ​

bash
# 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 --json

With 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.

Released under the Apache 2.0 License.