28 Commits
Author SHA1 Message Date
kevinveenbirkenbachandClaude Opus 5.5 301f3c519e fix(sys-ctl-hlth-runtime): treat a too-deep SBOM as unreadable and read the CycloneDX once
CodeRabbit round 2 on #3090: UNREADABLE_JSON now also catches RecursionError, so a deeply nested SBOM counts as unreadable instead of crashing the scan, and trivy_os_args reads the CycloneDX SBOM once instead of checking it and then reading it again. The unreadable-SBOM test covers an empty and a too-deep document.

🎯 Fix: 94 %
💥 Break: 2 %
💸 Tokens: –
⏱️ Velocity: –
🛡️ Security: 100 %
🏆 Score: 92
🚦 Gate: ✅ 90/5, tokens and velocity <= 100, security 100 %

Created-with: https://s.veen.world/skills
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 10:43:29 +00:00
kevinveenbirkenbachandClaude Opus 5.5 ec660108b7 fix(sys-ctl-hlth-runtime): leave OS packages to Trivy when the cached CycloneDX does not parse
With Syft disabled no SBOM is rebuilt and every target counts as SBOM-ready, so an empty or cut-off cached CycloneDX still reached trivy_os_args and crashed the scan in _read_json. An unreadable CycloneDX now counts as missing there, and Trivy keeps scanning the OS packages. Addresses the CodeRabbit review on PR #3090.

🎯 Fix: 93 % | 💥 Break: 2 % | 💸 Tokens: – | ⏱️ Velocity: – | 🛡️ Security: 100 % | 🏆 Score: 91 | 🚦 Gate: ✅ 90/5, tokens and velocity <= 100, security 100 %

Created-with: https://s.veen.world/skills
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 02:54:01 +00:00
kevinveenbirkenbachandClaude Opus 5.5 3af21b24c1 fix(sys-ctl-hlth-runtime): rebuild a cached SBOM that does not parse
A deploy's lock phase stops hlth-runtime with SIGTERM, which can cut syft off mid-write and leave an empty or partial SBOM in the cache. The next run took any existing file as cached and crashed in _read_json with JSONDecodeError (main run 46038122549, OpenProject#1 swarm arm64). A cached SBOM now counts only when it parses; otherwise syft builds it again.

🎯 Fix: 92 % | 💥 Break: 3 % | 💸 Tokens: – | ⏱️ Velocity: – | 🛡️ Security: 100 % | 🏆 Score: 89 | 🚦 Gate: ✅ 90/5, tokens and velocity <= 100, security 100 %

Created-with: https://s.veen.world/skills
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 01:49:43 +00:00
kevinveenbirkenbachandClaude Opus 5.5 2673ae296b Merge origin/main 2fce0147a3 into fix/sys-ctl-hlth-runtime/per-node-outputs
Takes in #2790 (staged report name per host) next to the per-node outputs; script.py and test_script.py merge cleanly and the role's tests pass on the merged tree (189 + 4 + 10).

🎯 Fix: 92 %
💥 Break: 4 %
💸 Tokens: 100 %
⏱️ Velocity: 100 %
🛡️ Security: 100 %
🏆 Score: 88
🚦 Gate: ✅ 90/5, tokens and velocity <= 100, security 100 %

Created-with: https://s.veen.world/skills
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 15:14:39 +00:00
kevinveenbirkenbachandClaude Opus 5.5 a5e036c5b4 fix(sys-ctl-hlth-runtime): keep each swarm node's runtime report on the node
DIR_HEALTH_RUNTIME_REPORT sat under the NFS-shared DIR_VAR_LIB, so every swarm node wrote the same report and metrics files and the last node won. The report directory is now node-local (DIR_VAR_LIB-hlth-runtime), the script takes the node name from --host (inventory_hostname) instead of socket.gethostname(), the metrics file carries the host name, and the role removes the old shared output files. Tests cover the per-host names and the node-local path. Closes #2788.

🎯 Fix: 92 %
💥 Break: 4 %
💸 Tokens: 100 %
⏱️ Velocity: 100 %
🛡️ Security: 100 %
🏆 Score: 88
🚦 Gate: ✅ 90/5, tokens and velocity <= 100, security 100 %

Created-with: https://s.veen.world/skills
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 14:51:49 +00:00
kevinveenbirkenbachandClaude Opus 5.5 b5cda0bad0 test(sys-ctl-hlth-runtime): catch Exception, not BaseException, in the shared-report writer threads
Addresses the CodeQL and code-quality review on PR 2790: the thread worker only needs ordinary failures (the FileNotFoundError of the old staged name, a BrokenBarrierError on timeout), so it no longer swallows KeyboardInterrupt or SystemExit. The negative control still fails with the PID staged name.

🎯 Fix: 98 %
💥 Break: 1 %
💸 Tokens: 100 %
⏱️ Velocity: 100 %
🛡️ Security: 100 %
🏆 Score: 97
🚦 Gate: ✅ 90/5, tokens and velocity <= 100, security 100 %

Created-with: https://s.veen.world/skills
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 14:22:50 +00:00
kevinveenbirkenbachandClaude Opus 5.5 cf5c11c089 fix(sys-ctl-hlth-runtime): stage report and metrics writes under a unique name
In swarm every node mounts DIR_VAR_LIB from one NFS export, so the report and textfile directories are shared. write_atomic named its staged file only by PID, and the lab's worker containers boot identically: in main run 45100023729 (Taiga#2) wrk-01 and wrk-02 both ran hlth-runtime as PID 13844, wrk-01 renamed the shared staged file away, and wrk-02's rename failed with FileNotFoundError, failing the deploy. The staged file now gets a uuid4 name and is created exclusively; it keeps the mode of a plain new file, so node-exporter still reads the textfile. A new test holds two writers of one PID at a barrier and fails on the old code with the CI error.

🎯 Fix: 95 %
💥 Break: 3 %
💸 Tokens: 100 %
⏱️ Velocity: 100 %
🛡️ Security: 100 %
🏆 Score: 92
🚦 Gate: ✅ 90/5, tokens and velocity <= 100, security 100 %

Created-with: https://s.veen.world/skills
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 12:43:58 +00:00
Alejandro RomanandClaude Opus 5.5 0c0f2d4c73 fix(sys-ctl-hlth-runtime): keep the probe failure when the container inspection itself fails
container_running() returned False for every non-zero 'container inspect',
so an engine error such as a refused daemon socket made a failed PHP probe
look like a container that had stopped, and the run reported it as skipped.
Only a container the engine reports stopped or no longer knows is skipped
now; any other inspection error keeps the probe failure.

The check docstring and the info line now say what the code does: the
running state is read after the probe error, so a container that stops after
its probe failed is skipped too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 15:43:57 +04:00
kevinveenbirkenbach 7580c97dcd Merge branch 'main' into feature/ansible-task-overhead 2026-11-20 23:03:56 +01:00
kevinveenbirkenbachandClaude Opus 5.5 cdafcc98ee fix(sys-ctl-hlth-runtime): bound every Trivy run by the job timeout, not Trivy's 5 minute default
script.py bounds each engine run by JOB_TIMEOUT_SECONDS (4 h) but passed no --timeout to Trivy, so Trivy's built-in 5 minute deadline applied. On a busy swarm node the image scan of local_discourse/discourse (4.52 GB) hit it: 'analyze error: pipeline error: context deadline exceeded' after 300.4 s, the report counted errors 1 with fail 0, and sys-service-terminator failed to start hlth-runtime (Discourse#2, PR 2309 run 44683973433). TRIVY_COMMON now passes --timeout JOB_TIMEOUT_SECONDS, which covers image, rootfs, sbom and both database downloads, the same bound Syft, Grype and OSV already have.

🎯 Fix: 90 %
💥 Break: 4 %
💸 Tokens: –
⏱️ Velocity: –
🛡️ Security: 100 %
🏆 Score: 86
🚦 Gate: ✅ 90/5, tokens and velocity <= 100, security 100 %

Created-with: https://s.veen.world/skills
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 13:14:29 +00:00
Alejandro RomanandClaude Opus 5.5 95380106f3 fix(sys-ctl-hlth-runtime): count an engine that does not answer as a running container
container_running runs inside the probe's error branch, so a timeout there crashed the scan. It now reports the container as running, which keeps the probe error a failure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 03:30:56 +04:00
Alejandro RomanandClaude Opus 5.5 b80da444a1 fix(sys-ctl-hlth-runtime): skip a container that stopped before its PHP probe
A swarm task that recycles itself, such as the Shopware worker, can stop between the container listing and the php exec. The probe error then failed the whole scan. A failed probe now asks whether the container still runs: a stopped one is reported as info, a running one still fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 03:04:07 +04:00
kevinveenbirkenbachandClaude Opus 5.5 6f1daf9c3d perf(sys-ctl-hlth-runtime): reuse the trivy report of an unchanged image
Each trivy report of a container image is cached next to its SBOM. The cache key is the trivy image id, the trivy arguments, the scanned image id and the size and mtime of both trivy database files. A report is reused only when every part of the key matches, and it is stored only after a successful trivy run. The host scan is never cached, findings are judged against the current suppressions on every run, and each reuse logs one info line. In main run 44185755981 the second pass of Nextcloud#0 spent about 490 s on image scans run one by one; the cache cuts that to an estimated 50 s.

🎯 Fix: 72 %
💥 Break: 5 %
💸 Tokens: –
⏱️ Velocity: –
🛡️ Security: 100 %
🏆 Score: 68
🚦 Gate: ⛔ fix 72 % < 90

Created-with: https://s.veen.world/skills
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 17:37:34 +00:00
kevinveenbirkenbach 0d61a69556 Merge remote-tracking branch 'origin/main' into fix/sys-ctl-hlth-runtime/host-scan-nfs-timeout 2026-11-17 09:54:56 +00:00
kevinveenbirkenbachandClaude Opus 5.5 5b2b44f94a fix(sys-ctl-hlth-runtime): skip network mounts in the host scan
Root cause: on PR 2009 (run 43802337071, swarm job odoo#1) the
sys-ctl-hlth-runtime unit failed because the Trivy rootfs scan of a
swarm node hit its 5 minute timeout. The wrk-02 journal shows the walk
stuck in /var/lib/infinito, which on a swarm node with storage.backend
nfs is the NFS mount of the cluster-shared volumes. The host metrics of
the same window rule out load. Every node walked the whole shared state
over NFS, plus the node-local backup store bound over it.

Fix:
- The check reads /proc/self/mountinfo when it scans the host and skips
  every mount other than / whose type is a network or automount
  filesystem (nfs, nfs4, cifs, sshfs, ceph, glusterfs, autofs and the
  other types in NETWORK_FSTYPES). It prints one info line per skipped
  mount. Mount points are octal-unescaped and read with surrogateescape.
  The printed line escapes undecodable bytes, so a strict UTF-8 stdout
  cannot crash the check, and every non-printable character, so a mount
  point holding a newline cannot forge journal lines or JSON events.
- The static DIR_VAR_LIB exclude is not needed: swarm nodes and the
  controller mount it as nfs or nfs4, which the detection catches, and a
  compose host scans it again as before. The new group path
  DIR_BACKUPS_NODE replaces the client role's private backup dir var and
  is excluded statically, since it is a local tree.
- Trivy gets one --skip-dirs per path, each value CSV-quoted: Trivy
  parses every value as CSV, so an unquoted comma splits a path even
  when it stands alone (checked on trivy 0.76.1).
- Every skip path is glob-escaped for Trivy, Syft and Grype, which all
  match with doublestar v4. One unbalanced [ in a skip path made Trivy
  0.76.1 drop every skip path sorted after it, which would bring back
  the walk of the Docker data root and the NFS state. An unescaped *
  also skipped sibling directories.
- README: the host scan does not see software on a network-mounted
  /opt, /home, /usr/local or /var (with /var also the package
  database), and volume content is scanned in neither compose nor swarm
  mode. That covers runtime installs and the image content Docker copies
  into an empty named volume on first mount, such as hermes_data at
  /opt/data, which stays at its first version after image upgrades.

Evidence:
- 10 files changed, 565 insertions, 12 deletions.
- test_network_mounts 10 passed, test_script 163 passed,
  test_host_excludes 3 passed, each file run alone; ruff and the
  repository comment lint are clean on every staged file.
- Negative controls, all red: no report lines, no wiring of the mounts
  into the scan, Syft or Grype excludes dropped, no glob escaping, no
  CSV quoting, no surrogateescape, raw print of an undecodable path, no
  host-target guard, no nfs type, no DIR_BACKUPS_NODE exclude, and
  test_script without its fixed mount list (15 failures).
- A mount point /srv/a\012forged prints as one line ending in
  /srv/a\nforged; without the escape the line splits and "forged"
  stands alone (negative control red).
- Trivy 0.76.1 on test trees: unescaped skips walked x[y and z and
  skipped sa by mistake; escaped skips leave only sa.
- Three review rounds; the last independent re-check confirmed the
  escaping on trivy 0.76.1 and doublestar v4 in Syft v1.55.0 and Grype
  v0.121.0.
- MEDUSA scan of the 10 files against e0f751eb4e, rerun after the
  escape fix: security 100, 0 critical, 0 new findings.
- Quality gate: pending, CI. The local quality-high run was cancelled by
  operator order before it started; the 90/5 below covers fix and break
  only.

🎯 Fix: 92 %
💥 Break: 4 %
💸 Tokens: –
⏱️ Velocity: –
🛡️ Security: 100 %
🏆 Score: 88
🚦 Gate: ✅ 90/5, tokens and velocity <= 100, security 100 %

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 09:54:43 +00:00
kevinveenbirkenbachandClaude Opus 5.5 9bc93b14d7 fix(sys-ctl-hlth-runtime): serialize image exports across swarm nodes
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>
2026-11-17 09:27:04 +00:00
kevinveenbirkenbachandClaude Opus 5.5 a7ec9bca20 fix(sys-ctl-hlth-runtime): leave CentOS Stream 10 and RHEL 10 OS packages to Grype
The daily mirror scan died on an engine error for quay.io/centos/centos:stream10: trivy sbom fails with 'unable to scan OS packages' because Trivy matches no Red Hat advisory for release 10 yet (aquasecurity/trivy-db#435). trivy.unmatched_os lists such OS releases with an until day; while Grype runs, Trivy scans only the library packages of a target whose SBOM names a listed release, and Grype keeps scanning its OS packages. The entries expire on 2026-11-30 like every suppression, and the CVE lint enforces that cap. Probe: trivy 0.76.1 sbom over the Syft v1.55.0 SBOM of centos:stream10 exits 1 with the FATAL without the flag and 0 with --pkg-types library. Accepted MEDUSA-AI-BACKDOOR-006 on script.py:246 as a reviewed false positive: an unchanged dataclass field typing the date-capped CVE suppressions.

🎯 Fix: 93 %
💥 Break: 4 %
💸 Tokens: –
⏱️ Velocity: –
🛡️ Security: 100 %
🏆 Score: 89
🚦 Gate: ✅ 90/5, tokens and velocity <= 100, security 100 %

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 12:59:36 +00:00
kevinveenbirkenbachandClaude Opus 5.5 08264657c0 fix(sys-ctl-hlth-runtime): run socket-mounting scanners under runc
svc-virt-kata makes runsc the default runtime on nodes without kata,
and gVisor refuses the bind-mounted docker.sock, so syft exits 1 on
every container target and the hlth-runtime unit fails the swarm
deploy (main run 43288523728 Moodle#1, WordPress#3; PR 1719
Matrix#1). Pass --runtime runc to the scanner runs that mount the
socket, and test the argv for both socket and socket-free runs.

Accepted MEDUSA findings (reviewed false positives, pre-existing on
main): MEDUSA-INF-SCAN-2056, -2447 and -2744 on script.py lines 1537
and 1785, the rmtree cleanups of the root-only 0700 scan cache.

🎯 Fix: 90 %
💥 Break: 3 %
💸 Cost: 100 %
⏱️ Time: 100 %
🛡️ Security: 100 %
🏆 Score: 87
🚦 Gate: ✅ 90/5, cost and time <= 100, security 100 %

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 09:18:39 +00:00
kevinveenbirkenbach 6bc28aec78 Merge pull request #1704 from infinito-nexus/fix/sys-ctl-hlth-runtime/scan-scratch-bound
fix(sys-ctl-hlth-runtime): give every engine run its own scratch and export one image at a time
2026-11-12 14:02:43 +01:00
kevinveenbirkenbachandClaude Opus 5.5 948b3b60b2 test(sys-ctl-hlth-runtime): mark the tempdir walks of the scratch tests
quality-high (quality-high-1237) failed test-lint on the scratch hotfix: tests/lint/filesystem/python/test_no_raw_project_walk.py flagged the two rglob calls the new scratch tests make (test_script.py, ExportingEngines peak count and TestScratch._left_on_disk). Both walk the test's own TemporaryDirectory, not the project tree, the case the lint opts out with a per-call nocheck: project-walk marker; the same file already marks its two textfile walks that way. The maintainer approved both markers.

Tests: test_no_raw_project_walk green, 147 tests of test_script.py green.

🎯 Fix: 95 %
💥 Break: 1 %
💸 Cost: –
⏱️ Time: –
🛡️ Security: ~100 %
🏆 Score: 94
🚦 Gate: ✅ 90/5, cost and time <= 100, security 100 %

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 13:00:04 +00:00
kevinveenbirkenbachandClaude Opus 5.5 282512079e fix(sys-ctl-hlth-runtime): map CRITICAL to warn in the development inventory, cap suppressions at 2026-11-30
Main run 43131801262 had 65 deploy jobs red because hlth-runtime failed its unit on CRITICAL CVE findings (sys-service-terminator: Unable to start service hlth-runtime.17.0.0.infinito.nexus.service), plus 4 jobs aborted inside the same task. The maintainer decided on 2026-11-12 that CRITICAL findings no longer fail a CI deploy and are tracked as issues instead, that production keeps failing on them, and that suppressions may only run until the end of November.

- inventories/development/default.yml overrides applications.sys-ctl-hlth-runtime.services.runtime.severity.CRITICAL to warn. The role default in meta/services.yml stays CRITICAL: fail, so production is unchanged. The value reaches the script through the dev vars file, the deep merge over meta/services.yml, the config lookup and the --scan argument.
- Engine errors, a missing database and PHP hardening violations still fail the unit in every inventory.
- The suppression lint caps every until at 2026-11-30 (LATEST_UNTIL); its expiry check fails once that day passes. About 110 suppressions in 59 roles moved from 2026-12-03 to 2026-11-30.
- Requirement 070, the role README and the suppression guide state: fail by default and in production, warn in the development inventory.

Tests: 217 green. They pin the shipped default (exit 1 with a fail line) and the merged development value (CRITICAL exits 0, an engine error still exits 1). Negative controls: without the inventory override 2 tests fail; on the original severity config 2 fail; the cap test errors before the cap existed.

The 18 images without a mirror-scan issue and the 17 host CVEs get their own issue path in a follow-up.

🎯 Fix: 88 %
💥 Break: 7 %
💸 Cost: 100 %
⏱️ Time: 100 %
🛡️ Security: ~100 %
🏆 Score: 82
🚦 Gate: ⛔ fix 88 % < 90, break 7 % > 5 (operator approved)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 11:47:47 +00:00
kevinveenbirkenbachandClaude Opus 5.5 7d8dc4867b fix(sys-ctl-hlth-runtime): give every engine run its own scratch and export one image at a time
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>
2026-11-12 11:39:39 +00:00
kevinveenbirkenbachandClaude Opus 5.5 65863a2b20 feat(sys-ctl-hlth-runtime): suppress vulnerability findings per image tag
A suppression entry under <service>.security.suppressions now names either
one CVE (id) or one image tag (image_tag), each with until. An image_tag
entry accepts every finding of the service's image while the owner runs that
tag; each owner of a shared digest is judged by its own tag (Config.Image at
runtime, the pinned version in the mirror scan), so a container on any other
tag stays unsuppressed. Host suppressions are the id entries of the engine
services; an image_tag entry there covers the engine's own image.

The cve lint requires image_tag to equal the service's version, and the
Docker image updater drops a service's image_tag entries with their markers
when it moves the service to another version, so a tag suppression never
outlives its tag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 12:42:09 +01:00
kevinveenbirkenbachandClaude Opus 5.5 1e1d37d679 feat(sys-ctl-hlth-runtime): map severities to fail or warn and publish every run for Prometheus, Loki and Wazuh
The scan threshold becomes a severity-to-verdict mapping in
roles/sys-ctl-hlth-runtime/meta/services.yml, CRITICAL: fail and HIGH: warn,
for production and CI alike. A finding mapped to fail fails the service and
the deploy, a warn prints a warning line and passes, a suppressed one prints
an info line. Engine errors, missing databases and PHP hardening violations
still fail. The old list form is rejected with a config error. The daily
mirror scan stays strict: every unsuppressed fail or warn finding is a row,
so it fails while an image is red.

Every run publishes one list of judged findings four ways:
- report.json of the latest run (summary + records) under
  DIR_HEALTH_RUNTIME_REPORT, written atomically;
- findings.jsonl under DIR_HEALTH_RUNTIME_LOG, one record per finding,
  appended per run and rotated weekly by a logrotate drop-in;
- one JSON line per target plus a summary line on stdout for the journal;
- infinito_hlth_runtime.prom in DIR_METRICS_TEXTFILE when web-app-prometheus
  is deployed: findings per target, kind, image, severity, scanner and
  verdict (no CVE label), last run time and success, scanner errors.

Each record carries run_id, timestamp, host, environment, target, kind,
image, scanner, id, severity, package, installed_version, fixed_version,
suppressed, suppressed_until and verdict. The paths are SPOT variables in
group_vars/all/05_paths.yml, the script takes them as arguments.

Requirement 070 and the role README describe the mapping, the outputs and
the per-image vulnerability issue of the previous commit.

Part of #1324

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 17:48:09 +01:00
kevinveenbirkenbachandClaude Opus 5.5 3531b95de0 fix(sys-ctl-hlth-runtime): give the scanners a writable temp dir and keep the workspace databases outside the checkout
PR #1326 CI failed in two places:

- The vulnerability-db job stopped on `unable to create listing temp file:
  open /tmp/grype-db-listing…: permission denied`. The repository runs the
  engines as `docker run --user <uid>:<gid>`, and the Grype and Syft images
  set no User and WorkingDir /tmp, which only root may write. The dry-run
  mirror scan failed the same way: 156 Syft errors and the Grype database.
  Every engine now gets TMPDIR pointing at its writable /work mount.
- Every workspace job died in `make system-purge`: `git clean -fdX` could
  not remove build/vulnerability-db, because the job bound that directory
  as its own mount inside the mounted checkout. On GitHub the workspace job
  now keeps its databases under ${RUNNER_TEMP}, outside the checkout; act
  keeps the shared host directory.

Part of #1324

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 08:37:10 +01:00
kevinveenbirkenbachandClaude Opus 5.5 6b36c8579a fix(sys-ctl-hlth-runtime): scan with Trivy, Grype and OSV instead of PHP floors
The runtime check judged PHP by its upstream version and failed every
container on an end-of-life line. Distribution builds backport fixes without
raising that number, so main run 41154895895 failed Checkmk#0 on
`PHP 8.1.2-1ubuntu2.28 runs the end-of-life line 8.1`, a build Ubuntu lists
as fixed for CVE-2026-109618 and CVE-2026-109619.

- The role now runs Trivy, Grype and OSV-Scanner, with a Syft SBOM per
  target, against the host and the images of the running containers, in
  bounded parallel lanes. Targets, engines and the failing severities are
  lists in meta/services.yml; the default is every target and engine at
  CRITICAL and HIGH with a fix available.
- Grype always scans the binary-classified packages of the SBOM, so a PHP
  built from source in an official php image (8.4.26) still fails on the
  CVEs fixed in 8.4.27, which Trivy and OSV do not see.
- OSV reads an SBOM copy whose distro purls carry the source package name.
- A CVE is suppressed only in the role owning the image, under
  services.<service>.security.suppressions with id, until and a
  `# nocheck: cve <reason>` marker; a lint rejects bare, malformed and
  expired entries.
- The deploy-time run fails on its first finding: sys-service gains
  system_service_run_once and sys-service-terminator skips the retries
  only for those units. The timer runs daily at 00:00 UTC.
- The PHP version floors are removed; the php_hardening check stays.
- make test-security replaces make security-runtimes: Syft builds an SBOM
  of every pinned image straight from the GHCR mirror, cached by digest,
  and the three engines scan it with the role's threshold and suppressions.

Part of #1324

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 02:44:58 +01:00
kevinveenbirkenbachandClaude Opus 5.5 d116dde659 fix(sys-ctl-hlth-runtime): bound the engine calls and catch hidden PHP runtimes
Three CodeRabbit findings on PR #1265:

- script.py listed the running containers with `container ps` and
  `container inspect` without a timeout, so a hung engine kept the daily
  unit active forever and blocked the next timer run. Both calls now use
  EXEC_TIMEOUT_SECONDS; main turns a timeout or engine error into a
  one-line failure and exit 1 instead of a traceback.

- runtime.py's PHP_PACKAGE_PATTERN requires a digit after "php", so an
  image installing an unversioned interpreter package (`php-cli`) and
  setting no PHP_VERSION was reported as PHP-free. The interpreter
  packages php, php-cli, php-fpm, php-cgi, php-phpdbg and
  libapache2-mod-php are now recorded as PhpRuntime.packages and reported
  with an unknown patch level; extension and library packages
  (php-mysql, php-pear, php-common, phpmyadmin) and paths do not count.

- php_finding returned early for a patched PHP_VERSION, so an end-of-life
  package line installed next to it (e.g. php7) was never reported. The
  version only returns a finding now; otherwise the lines are judged too.

Every finding has unit tests that fail on the previous code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 15:32:57 +01:00
kevinveenbirkenbachandClaude Opus 5.5 3c743736a8 feat(sys-ctl-hlth-runtime): alert on EOL or unpatched PHP and missing PHP hardening
Answering "which deployed containers run a vulnerable PHP?" after
CVE-2026-109618/109619 took a manual inventory of registry metadata, and
nothing noticed a hardening ini that an image never loads.

- New role sys-ctl-hlth-runtime, routed through sys-svc-compose next to
  sys-ctl-hlth-container. A daily timer runs `php` in every running
  container and fails, alerting through sys-ctl-alm-compose, when PHP is
  below the floor of its line or on a line older than every floor (7.4,
  8.1). Every service that mounts php_hardening in meta/volumes.yml fails
  while expose_php or session.upload_progress.enabled is on; other PHP
  containers of such a stack are listed as info. Compose and swarm
  containers are matched by their project/stack and service labels. The
  check is not run at deploy time, so a finding never fails a deploy.
- The floors (8.2.35, 8.3.36, 8.4.27, 8.5.12) live once, in
  HEALTH_RUNTIME_FLOORS of the role's vars/main.yml.
- `make security-runtimes` lists the PHP of every pinned role image
  without pulling: Docker Hub tags through the Hub API, which no pull rate
  limit meters, other registries through the OCI config blob (new
  registry.config_blob, which the healthcheck probe now reuses).
  PHP_VERSION, distro PHP packages and a PHP_BASE build argument count. It
  exits 1 on an image below its floor or one the registry did not answer.
  Today it flags nfrastack/fusiondirectory:1.5 (line 7.4) and
  shopware/docker-base:8.3 (8.3.25).

The role TODO.md keeps the follow-ups: further runtimes, the split web
SAPI of web-app-lam, a scheduled CI run of the report and the CVE scan.

Refs #1127

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 00:12:25 +01:00