Skip to content

feat: scan-artifact gate + clamd fast path, and retire both delegate caveats with real captured data (5.13.0) - #393

Merged
sandstream merged 3 commits into
mainfrom
claude/web-kit-status-sync-p6fg9a
Jul 25, 2026
Merged

sandstream merged 3 commits into
mainfrom
claude/web-kit-status-sync-p6fg9a

Conversation

@sandstream

@sandstream sandstream commented Jul 25, 2026 •

Copy link
Copy Markdown
Owner

Extends the ClamAV delegate (5.11.0) and retires the two honest "not empirically verified" caveats this line has been carrying — using real captured output from real hosts, not documentation. kit still ships no scanning engine and no signatures.

1. kit security scan-artifact <path> [--recursive] [--json]

The ingestion gate for an untrusted artifact — an upload, a downloaded dataset, a vendored blob — before you trust it.

result outcome
clean pass (exit 0)
malicious fail, signature names shown
scanerror / not-installed fail — a gap is not a pass

That last row is the whole point: "we could not check" must never read as "it is fine." Verified on this host (no ClamAV present): exits 1 with a GAP (not a pass) line.

2. clamd (daemon) fast path

Prefers clamdscan against a resident clamd, which already holds the signature DB — milliseconds vs the ~4 s clamscan spends loading 3.6M signatures per invocation.

  • Falls back to clamscan when the daemon is absent/unreachable: a stopped daemon costs speed, not coverage.
  • Reports which engine produced the verdict (clamd | clamscan) instead of leaving the operator guessing.
  • --fdpass lets the daemon scan files its own uid cannot read — without it clamd's permission error would surface as a false gap.

3. ClamAV exit-code contract — now empirical on all three paths

5.11.0 had exit 0/exit 2 confirmed but exit 1 taken from the spec, because macOS quarantined the EICAR file before clamscan could read it. Scanning a gzipped EICAR closes it (XProtect doesn't quarantine archive contents; ClamAV unpacks):

$ clamscan --no-summary /tmp/e.gz
/tmp/e.gz: Eicar-Test-Signature FOUND
exit=1

Now a byte-exact fixture — the FOUND parser is pinned to observed output.

4. gVisor fingerprint — verified against a live sandbox, plus a second signal

5.9.0 shipped the sandbox fingerprints as documentation-derived (resolving to unknown rather than risk a false claim). runsc do on gVisor release-20260721.0 / Ubuntu 24.04 settles the gVisor half:

  • /proc/version = Linux version 4.19.0-gvisor #1 SMP Sun Jan 10 15:06:54 PST 2016 — the existing marker does fire. Pinned as a fixture, with real-host negative controls: a plain container kernel, an Ubuntu VM, and vServer (the host DMI product_name gVisor passes into the sandbox).
  • The sandbox reports Seccomp: 0 and no NoNewPrivs line at all. This makes the branch order load-bearing: had seccomp/container been evaluated first, a genuine gVisor sandbox would resolve to none / not-contained — a false negative on the strongest sandbox available. A test now locks the ordering. This is the finding that justified doing the verification.
  • New cgroupHasGvisorJobController — gVisor synthesizes a job cgroup controller that doesn't exist on Linux (observed as 5:job:/), wired as a second independent signal so a build whose version string lacks the marker is still detected instead of degrading to "not contained". Anchored to the N:job: shape so a real path segment named job can't trip it.
  • The dmesg marker (Starting gVisor...) was observed but deliberately not made primary — it needs the syslog syscall / /dev/kmsg, which a hardened sandbox may deny. Documented in the source.

Firecracker stays documentation-derived and honestly unverified — no Firecracker host was available (the test host is KVM/QEMU). It still resolves to no-marker rather than a false positive.

Verification

  • Full suite green (3182 tests), format:check clean, zero-LLM boundary intact.
  • contracts/kit.opencli.json regenerated for the version bump only — no public-surface change.

🤖 Generated with Claude Code

…e malware delegate (5.13.0)

Two extensions to the ClamAV delegate shipped in 5.11.0.

kit security scan-artifact <path> [--recursive] [--json] — the ingestion gate for an
untrusted artifact (an upload, a downloaded dataset, a vendored blob) before you trust
it. clean passes; malicious fails with the signature names; and a GAP — scan error, or
no scanner installed — ALSO fails. That is the point of an ingestion gate: 'we could
not check' must never read as 'it is fine'.

clamd fast path: the delegate now prefers clamdscan against a resident clamd, which
already holds the signature DB (milliseconds vs the ~4s clamscan spends loading 3.6M
signatures per invocation), and falls back to clamscan when the daemon is absent or
unreachable — a stopped daemon costs speed, not coverage. The result reports which
engine produced the verdict (clamd | clamscan) instead of leaving the operator to
guess, and --fdpass lets the daemon scan files its own uid could not otherwise read
(which would otherwise surface as a false gap).

kit still ships no engine and no signatures. Full suite green (3176), format clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

✅ Docker image built successfully

  • CLI image: docker.io/sandstream/kit:test

…exit 1 now empirical)

5.11.0 shipped with exit 0 (clean) and exit 2 (scan error) confirmed against a real
host, but exit 1 (malicious) taken from ClamAV's documented spec — macOS quarantined
the EICAR test file before clamscan could read it.

Scanning a GZIPPED EICAR closes that gap (XProtect does not quarantine archive
contents on write; ClamAV unpacks and detects):

  clamscan --no-summary /tmp/e.gz
  /tmp/e.gz: Eicar-Test-Signature FOUND
  exit=1

That line is now a byte-exact test fixture, so the FOUND parser is pinned to real
observed output instead of an assumption. All three exit paths are empirically
verified against ClamAV 1.5.3. Header comment + CHANGELOG updated to say so.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

✅ Docker image built successfully

  • CLI image: docker.io/sandstream/kit:test

…ox, add a second signal

5.9.0 shipped the gVisor/Firecracker fingerprints as documentation-derived, resolving
to unknown rather than risk a false claim. Running 'runsc do' (gVisor release-20260721.0,
Ubuntu 24.04 on a KVM host) settles the gVisor half:

- /proc/version reads 'Linux version 4.19.0-gvisor #1 SMP ...' — the existing marker DOES
  fire. Pinned as a byte-exact fixture, with real-host negative controls (a plain container
  kernel, an Ubuntu VM, and the host DMI product_name gVisor passes through: 'vServer').
- The sandbox reports Seccomp: 0 and NO NoNewPrivs line. That makes branch ORDER
  load-bearing: were seccomp/container evaluated first, a genuine gVisor sandbox would
  resolve to none/not-contained — a false negative on the strongest sandbox available.
  A test now locks the ordering.
- New cgroupHasGvisorJobController: gVisor synthesizes a 'job' cgroup controller that does
  not exist on Linux (observed as '5:job:/'), used as a second independent signal so a build
  whose version string lacks the marker is still detected. Anchored to the N:job: shape so a
  real path segment named job cannot trip it.
- The dmesg marker ('Starting gVisor...') was observed too but deliberately NOT made the
  primary signal — reading it needs the syslog syscall / /dev/kmsg, which a hardened sandbox
  may deny. Documented in the source.

Firecracker stays documentation-derived and honestly unverified (no Firecracker host was
available). Full suite green (3182).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@sandstream sandstream changed the title feat(security): scan-artifact ingestion gate + clamd fast path for the malware delegate (5.13.0) feat: scan-artifact gate + clamd fast path, and retire both delegate caveats with real captured data (5.13.0) Jul 25, 2026
@github-actions

Copy link
Copy Markdown

✅ Docker image built successfully

  • CLI image: docker.io/sandstream/kit:test

@sandstream
sandstream merged commit 39225f5 into main Jul 25, 2026
19 checks passed
@sandstream
sandstream deleted the claude/web-kit-status-sync-p6fg9a branch July 25, 2026 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants