CI run 43828138456 aborted its swarm jobs with DISK EXHAUSTION IMMINENT
right after sys-service-terminator started the hlth-runtime unit. Every
lab node is a container on the same runner disk, and each node ran its
own Syft docker: export. One export costs up to three times the image:
the daemon stages it, the engine saves image.tar, and Syft copies every
layer uncompressed. EXPORT_SLOTS was a per-process semaphore, so the
nodes exported side by side. The thesis that the check downloads per-node
databases is refuted: the databases are one host directory, bind-mounted
read-only into every node.
ExportSlot replaces the semaphore with a flock on the database
directory. Every lab node and every local worktree stack bind-mounts
that directory from INFINITO_VULNERABILITY_DB_HOST_PATH, so exports now
take turns per host disk, while a production node keeps its own
directory. Each engine container gets a unique name. On a timeout or
crash the container is force-removed before the slot and the scratch
directory are given up. A database directory that cannot be locked
fails only its own lanes, with one error line. run_lanes takes the
Layout; the CLI scan and utils/security/database.py callers follow.
The trivy host-scan timeout behind PR 2009 odoo#1 has a separate cause
and is not part of this change.
Evidence:
- test_script.py of sys-ctl-hlth-runtime: 169 passed.
- utils/security: test_database 21, test_pipeline 4, test_deploy 7,
test_engine 8, test_suppressions 20 passed.
- cli/contributing/security: test_scan 15, test_database 3 passed.
- Negative controls fail as expected: the old database.py caller (2
failures), no container removal (2), no SlotError conversion (1), one
lock above the per-node directories (5, barrier broken), a fixed
container name (1).
- An independent review found a stale database.py caller, a missing
container cleanup, an unhandled OSError, a timing-based test and
overstated README wording; all are fixed.
- make quality-high is green: /tmp/make-quality-high-c4-swarm-disk-3.log
Security acceptance: MEDUSA-INF-SCAN-2056, MEDUSA-INF-SCAN-2447 and
MEDUSA-INF-SCAN-2744 on roles/sys-ctl-hlth-runtime/files/python/script.py
line 1734 are accepted by design after an independent skeptic returned
ACCEPT. The line is the rmtree of the run's own scratch directory
(work/tmp-<engine>-<subject>, under a mkdtemp 0700 work directory in the
root-only cache), unchanged from the base and only re-indented by this
change; leftovers fall to the strict rmtree(work) and the next stale
sweep.
🎯 Fix: 90 %
💥 Break: 5 %
💸 Tokens: –
⏱️ Velocity: –
🛡️ Security: 100 %
🏆 Score: 86
🚦 Gate: ✅ 90/5, tokens and velocity <= 100, security 100 %
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
hand_over runs as root after a refresh and gives the shared database directory back to its owner. The engine containers can write below that directory, so a symlink they plant must never lead the root run outside it. Listed paths that are symlinks are skipped; the walk uses os.fwalk with follow_symlinks=False and re-owns every entry relative to its open parent directory (dir_fd), so a directory swapped for a symlink mid-walk is skipped instead of followed.
Tests: a planted symlink is re-owned itself, never its target; a listed symlink is skipped; a directory swapped for a symlink during the walk re-owns nothing outside the root. Negative control: the swap test fails on the old os.walk version.
Residuals, tracked as cluster/security-db-writable-root-residuals: the lock lives inside the writable root, fetch_databases follows a symlinked root/<engine>, hardlinks.
🎯 Fix: 94 %
💥 Break: 2 %
💸 Cost: –
⏱️ Time: –
🛡️ Security: 100 %
🏆 Score: 92
🚦 Gate: ✅ 90/5, cost and time <= 100, security 100 %
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Main run 43131801262 lost four swarm deploys inside the hlth-runtime task: translate#3, OpenProject#2 and Pretix#0 on the swarm-matrix I/O wedge guard, Nextcloud#10 on DISK EXHAUSTION IMMINENT. The scan dropped 18 to 26 GB of scratch within minutes. Every engine used the single run-wide /work as TMPDIR, removed only after the whole scan; the SBOM phase ran two syft image exports at once; the OSV archive sat in /work until the end; a killed run left its run-* directory behind for good.
- Each step names a scratch directory below /work; run_lane creates it and removes it after the last step naming it, also when a step fails, times out or raises.
- An export gate (EXPORT_SLOTS=1) keeps at most one image export on disk; registry pulls keep their parallelism.
- The OSV archive lives in the scratch its scan reads.
- Stale run-* directories are swept at start.
- The scan CLI and the database module follow the new Step API.
Tests: 180 green across script, CLI scan and both database modules; the new TestScratch and TestCommands cases fail against the original script (failures=5, errors=1). Not measured on CI yet; the container SBOM phase now runs serially.
🎯 Fix: 80 %
💥 Break: 8 %
💸 Cost: 100 %
⏱️ Time: 100 %
🛡️ Security: ~100 %
🏆 Score: 74
🚦 Gate: ⛔ fix 80 % < 90, break 8 % > 5 (operator approved)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A truncated chunked OSV download raises http.client.IncompleteRead, an
HTTPException rather than an OSError, so it skipped the .part cleanup and
the error line; the handler now catches both. The runtime check's warn
summary no longer claims the mirror scan tracks every warning, since host
findings and images outside the mirror never reach it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CodeRabbit review of PR #1326:
- fetch_databases downloads each OSV archive to all.zip.part and replaces
all.zip only after the transfer completes. An OSError removes the partial
file and comes back as an `osv <ecosystem>: <error>` line instead of a
traceback.
- run_gh bounds every gh call with a 120 s timeout. A failed or hung create,
edit or close becomes a `failed <action>: <error>` line while the other
issues and the close pass still run, and the command exits 1.
- The suppression lint checks every list item of a suppressions block, so an
entry that starts with `until:` still needs its `# nocheck: cve <reason>`
marker.
Part of #1324
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Under act the deploy job pinned an engine but skipped the cache restores, so
every local swarm-* run stopped on a missing Grype database. The swarm
matrix also ran inside the act job container, where the shared host
directory did not exist, and the workspace job would have kept a copy of
about 5 GB in every worktree.
- scripts/tests/deploy/act/workflow.sh requires
INFINITO_VULNERABILITY_DB_HOST_PATH, creates it on the host and binds it
into the job container at the same path, because that container drives
the host daemon, which resolves every stack and swarm node bind on the
host.
- call-test-deploy.yml pins engine and database path in one step that runs
only outside act; under act the deploy draws an engine and refreshes the
shared directory. call-test-workspace.yml takes the shared path under act.
- The refresh lock moves into the shared directory, so host deploys and act
runs serialize on one file, and a root refresh hands its files to the
directory owner. hand_over skips paths a mocked download never created,
which failed four TestRefresh cases when the gate ran as root.
- A missing INFINITO_VULNERABILITY_DB_HOST_PATH stops compose up with a
"run 'make dotenv'" hint instead of a KeyError.
- Rationale paragraphs in the database and compose docstrings are dropped.
Part of #1324
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each CI deploy row now draws one vulnerability engine (trivy, grype or osv)
as a fifth rotation axis, shown in the job name next to distro and
filesystem (🔬 axis, 🔺 trivy, 🍇 grype, 🐙 osv). The deploy-time scan of
sys-ctl-hlth-runtime runs that engine behind Syft and the Grype runtime pass.
- A vulnerability-db job keeps one Actions cache per database and day and
downloads only the missing ones. Every deploy job restores Grype plus its
drawn engine, fails on a cache miss and never downloads a database itself.
- Local stacks share one host directory, INFINITO_VULNERABILITY_DB_HOST_PATH,
mounted read-only at INFINITO_VULNERABILITY_DB_DIR in compose.yml and in
every swarm node. A local deploy without a pinned engine draws one and
refreshes only the databases it reads, at most once a day, under a lock.
- A pinned engine whose database is missing stops the deploy before it
starts.
Part of #1324
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>