From 850ec98538bdc9ef405f9b8ea27013bfbcd98dd0 Mon Sep 17 00:00:00 2001 From: Arnaud Dartois Date: Thu, 5 Nov 2026 22:49:31 +0100 Subject: [PATCH 1/3] fix(web): serve native agent Python supervisor --- skills/agent-install-assets/SKILL.md | 14 ++++++++++++++ src/Heimdall.Web/Heimdall.Web.csproj | 1 + src/Heimdall.Web/Program.cs | 8 +++++++- todo.md | 2 ++ 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 skills/agent-install-assets/SKILL.md diff --git a/skills/agent-install-assets/SKILL.md b/skills/agent-install-assets/SKILL.md new file mode 100644 index 0000000..ef69f72 --- /dev/null +++ b/skills/agent-install-assets/SKILL.md @@ -0,0 +1,14 @@ +--- +name: heimdall-agent-install-assets +description: Serve and validate native Heimdall Agent installer assets from Central. +--- + +# Native Agent installer assets + +Read `AGENTS.md`, the `AGENT-INSTALL-ASSETS` entry in `todo.md`, and `skills/compose-disposable-recipe/SKILL.md` before changing Central asset delivery. + +`Heimdall.Web.csproj` publishes the Linux/Windows installers and supervisors under `wwwroot/install/`; `Program.ConfigureMiddleware` serves them through ASP.NET Core static files. The default MIME table does not recognize `.py`, so explicitly map `.py` with `FileExtensionContentTypeProvider`; otherwise the supervisor returns 404 even when the file exists in the publish output. + +For acceptance, build Central from the changed source in a disposable Compose project. Require `/healthz` healthy and GET `/install/install-agent.sh` plus `/install/agent-supervisor.py`; both must return HTTP 200 and byte-for-byte match `install/` sources. Use generated credentials, isolated ports/project volumes/network, a unique local image tag, and an EXIT cleanup trap installed before build. Verify no project containers, volumes, or networks remain and remove/verify absence of the exact built tag. Keep shared base images. + +This proves only source-built Central behavior. Verify the deployed Central after its image has been published and restarted before considering a field incident resolved. diff --git a/src/Heimdall.Web/Heimdall.Web.csproj b/src/Heimdall.Web/Heimdall.Web.csproj index feb0bc7..b7b0df0 100644 --- a/src/Heimdall.Web/Heimdall.Web.csproj +++ b/src/Heimdall.Web/Heimdall.Web.csproj @@ -15,6 +15,7 @@ + Date: Fri, 6 Nov 2026 08:00:54 +0100 Subject: [PATCH 2/3] fix: update apt in runtime images --- docker/Dockerfile | 7 ++++++- docker/Dockerfile.agent | 7 ++++++- skills/central-auto-updates/SKILL.md | 5 +++++ skills/container-image-security/SKILL.md | 14 ++++++++++++++ todo.md | 2 ++ 5 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 skills/container-image-security/SKILL.md diff --git a/docker/Dockerfile b/docker/Dockerfile index 237735e..5affd81 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -10,7 +10,12 @@ RUN dotnet publish src/Heimdall.Web/Heimdall.Web.csproj -c Release --no-restore FROM mcr.microsoft.com/dotnet/aspnet:10.0-noble@sha256:de0ee358cdd672f7017a003bed21e9ac9ed48a27c922a59b18175b6e82fa7fee WORKDIR /app -RUN apt-get update -qq && apt-get install -y --no-install-recommends wget tzdata && rm -rf /var/lib/apt/lists/* +RUN apt-get update -qq \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --only-upgrade apt libapt-pkg6.0t64 \ + && apt_version="$(dpkg-query -W -f='${Version}' apt)" \ + && dpkg --compare-versions "$apt_version" ge 2.8.4ubuntu0.1 \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends wget tzdata \ + && rm -rf /var/lib/apt/lists/* ENV ASPNETCORE_URLS=http://+:8080 COPY --from=build /out/ ./ EXPOSE 8080 diff --git a/docker/Dockerfile.agent b/docker/Dockerfile.agent index ca19f13..40179db 100644 --- a/docker/Dockerfile.agent +++ b/docker/Dockerfile.agent @@ -12,7 +12,12 @@ RUN dotnet publish src/Heimdall.Agent/Heimdall.Agent.csproj -c Release --no-rest FROM mcr.microsoft.com/dotnet/aspnet:10.0-noble@sha256:de0ee358cdd672f7017a003bed21e9ac9ed48a27c922a59b18175b6e82fa7fee WORKDIR /app -RUN apt-get update -qq && apt-get install -y --no-install-recommends ffmpeg wget libgomp1 tzdata && rm -rf /var/lib/apt/lists/* +RUN apt-get update -qq \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --only-upgrade apt libapt-pkg6.0t64 \ + && apt_version="$(dpkg-query -W -f='${Version}' apt)" \ + && dpkg --compare-versions "$apt_version" ge 2.8.4ubuntu0.1 \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ffmpeg wget libgomp1 tzdata \ + && rm -rf /var/lib/apt/lists/* RUN install -d -m 0700 -o 1654 -g 1654 /var/lib/heimdall ENV ASPNETCORE_URLS=http://127.0.0.1:8080 COPY --from=build /out/ ./ diff --git a/skills/central-auto-updates/SKILL.md b/skills/central-auto-updates/SKILL.md index 76d49be..a715103 100644 --- a/skills/central-auto-updates/SKILL.md +++ b/skills/central-auto-updates/SKILL.md @@ -25,6 +25,11 @@ Use this skill when changing the Linux or Windows Central installer, its generat - Apply `pull_policy: always` to published Docker images in deployment Compose files so a manual `docker compose up` checks the registry. Leave local development-only images alone and keep the updater itself version-pinned. - The Docker socket mount grants Watchtower broad control of the host. Document this risk and the lack of staged rollout/rollback; do not describe automatic updates as a production-safe rollback system. +## Runtime image package security + +- The server and CPU Agent runtime images inherit Ubuntu 24.04 from the pinned ASP.NET image. When Trivy identifies a fixed Ubuntu package in the shared base, remediate both Dockerfiles and enforce the minimum patched version at build time. The NVIDIA Agent runtime already runs an OS package upgrade during build. +- Run Central + PostgreSQL from source in a disposable Compose project, verify health and native Agent asset URLs, then scan the built Central and CPU Agent images with the same pinned Trivy scanner and HIGH/CRITICAL policy used by CI. Require no findings and perform exact-tag cleanup. See `skills/container-image-security/SKILL.md`. + ## Re-running the installer - A complete existing install can regenerate its Compose after validating the candidate. Keep a timestamped backup of the previous Compose before atomic replacement. diff --git a/skills/container-image-security/SKILL.md b/skills/container-image-security/SKILL.md new file mode 100644 index 0000000..6e87a95 --- /dev/null +++ b/skills/container-image-security/SKILL.md @@ -0,0 +1,14 @@ +--- +name: heimdall-container-image-security +description: Diagnose and repair vulnerabilities in Heimdall Central and Agent container images. +--- + +# Container image security updates + +Read `AGENTS.md`, the image-scan result in `todo.md`, `skills/compose-disposable-recipe/SKILL.md`, and `skills/central-auto-updates/SKILL.md` before changing runtime images or their publication path. + +Heimdall server, CPU Agent, and NVIDIA Agent images use Ubuntu 24.04 runtime layers. When Trivy reports a fixed Ubuntu package, update only the affected package unless the project already establishes a broader OS-upgrade policy. For `CVE-2026-109518`, upgrade `apt` and `libapt-pkg6.0t64` after `apt-get update` and assert the `apt` version is at least `2.8.4ubuntu0.1` before installing runtime tools. Keep Trivy severity and exit thresholds unchanged. Apply the remediation to each affected runtime image; the NVIDIA image already upgrades its base OS packages. + +For acceptance, build Central and CPU Agent from the changed checkout under unique Compose image tags with synthetic credentials, loopback ports, project-scoped volumes/network, and an EXIT cleanup trap. Verify Central health and the native Agent installer and supervisor URLs. Scan each built image with the same pinned Trivy version, vulnerability DB repositories, and HIGH/CRITICAL exit policy used by `scripts/ci/security.sh`. A passing acceptance requires zero HIGH/CRITICAL findings, successful teardown, no project containers/volumes/networks, and removal plus absence checks for every exact local tag. Retain upstream base and scanner images. + +The CI image scan is a merge gate. Do not publish or merge around a failed scan; inspect the report and correct the affected package, then rerun the complete workflow. Keep `todo.md` evidence split between disposable local acceptance and the actual CI publication run. diff --git a/todo.md b/todo.md index a28c031..0ce09e9 100644 --- a/todo.md +++ b/todo.md @@ -4,6 +4,8 @@ Ce fichier remplace les rapports de `docs/audits/` et constitue le suivi courant ## P0 — CI et publication +- [ ] **CI-IMAGE-APT-CVE** La CI PR #140 (#run 761) a échoué les scans des images Central et Agent. Reproduction Trivy 0.69.3 sur les deux images du commit `850ec985` : HIGH `CVE-2026-109518` sur `apt` et `libapt-pkg6.0t64` 2.8.3, version corrigée `2.8.4ubuntu0.1`. Les Dockerfiles serveur et Agent CPU mettent ces deux paquets à jour et vérifient la version minimale; l’image NVIDIA faisait déjà `apt-get upgrade`. Acceptation locale terminée sous Compose `hmd-pr140-apt-1794000300` : santé Central OK, les deux URLs d’installation HTTP 200 et conformes à la source, scans Trivy 0.69.3 Central et Agent à zéro HIGH/CRITICAL. Conteneurs, volumes, réseau et tags temporaires vérifiés absents après suppression. Le premier `compose down` a laissé le cache Trivy et son réseau par défaut; suppression manuelle limitée aux ressources étiquetées de ce projet, puis vérification complète réussie. En attente des checks CI PR après mise à jour. Skill : `skills/container-image-security/SKILL.md`. + - [x] Rétablir le checkout des jobs : retirer la redirection de l’hôte de forge configuré vers `host-gateway` de la configuration des runners. Le run #442 a franchi le checkout et les tests. - [x] Séparer les suites .NET en étapes nommées et planifier les suites affectées pour les PR ; conserver la validation complète sur `main` et les tags. PR #67, test isolé : seuls IntegrationTests ont tourné (147 réussis). PR #68, changement Application + Web : toutes les suites affectées ont passé ; Domain a été ignorée. Le run push #227 confirme `Test plan: all` sur `main`. Les chemins qui lancent le workflow sont désormais filtrés pour les PR et les pushes de branche `main`; les tags `v*` conservent les validations complètes. - [x] Construire et scanner les images serveur et Agent dans deux jobs CI distincts après `verify`. Le run PR #196 a passé `verify` et les deux jobs en parallèle, serveur sur `runner-murin` et Agent sur `runner-hugin`. Le run main #227 a aussi validé la publication des tags Docker Hub après les deux succès (preuve ci-dessous). -- 2.54.1 From baf88623acc2ca8241de1137926d7b9526f86268 Mon Sep 17 00:00:00 2001 From: Arnaud Dartois Date: Fri, 6 Nov 2026 08:37:11 +0100 Subject: [PATCH 3/3] docs: record agent image CI acceptance --- todo.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/todo.md b/todo.md index 0ce09e9..bb4035b 100644 --- a/todo.md +++ b/todo.md @@ -4,7 +4,7 @@ Ce fichier remplace les rapports de `docs/audits/` et constitue le suivi courant ## P0 — CI et publication -- [ ] **CI-IMAGE-APT-CVE** La CI PR #140 (#run 761) a échoué les scans des images Central et Agent. Reproduction Trivy 0.69.3 sur les deux images du commit `850ec985` : HIGH `CVE-2026-109518` sur `apt` et `libapt-pkg6.0t64` 2.8.3, version corrigée `2.8.4ubuntu0.1`. Les Dockerfiles serveur et Agent CPU mettent ces deux paquets à jour et vérifient la version minimale; l’image NVIDIA faisait déjà `apt-get upgrade`. Acceptation locale terminée sous Compose `hmd-pr140-apt-1794000300` : santé Central OK, les deux URLs d’installation HTTP 200 et conformes à la source, scans Trivy 0.69.3 Central et Agent à zéro HIGH/CRITICAL. Conteneurs, volumes, réseau et tags temporaires vérifiés absents après suppression. Le premier `compose down` a laissé le cache Trivy et son réseau par défaut; suppression manuelle limitée aux ressources étiquetées de ce projet, puis vérification complète réussie. En attente des checks CI PR après mise à jour. Skill : `skills/container-image-security/SKILL.md`. +- [x] **CI-IMAGE-APT-CVE** La CI PR #140 (#run 761) a échoué les scans des images Central et Agent. Reproduction Trivy 0.69.3 sur les deux images du commit `850ec985` : HIGH `CVE-2026-109518` sur `apt` et `libapt-pkg6.0t64` 2.8.3, version corrigée `2.8.4ubuntu0.1`. Les Dockerfiles serveur et Agent CPU mettent ces deux paquets à jour et vérifient la version minimale; l’image NVIDIA faisait déjà `apt-get upgrade`. Acceptation locale terminée sous Compose `hmd-pr140-apt-1794000300` : santé Central OK, les deux URLs d’installation HTTP 200 et conformes à la source, scans Trivy 0.69.3 Central et Agent à zéro HIGH/CRITICAL. Conteneurs, volumes, réseau et tags temporaires vérifiés absents après suppression. Le premier `compose down` a laissé le cache Trivy et son réseau par défaut; suppression manuelle limitée aux ressources étiquetées de ce projet, puis vérification complète réussie. Run CI PR #140 #769 (6 novembre 2026) : CI policy, build/tests, scans Central et Agent réussis; publication ignorée car PR. Le correctif reste à fusionner et publier pour réparer le téléchargement public. Skill : `skills/container-image-security/SKILL.md`. - [x] Rétablir le checkout des jobs : retirer la redirection de l’hôte de forge configuré vers `host-gateway` de la configuration des runners. Le run #442 a franchi le checkout et les tests. - [x] Séparer les suites .NET en étapes nommées et planifier les suites affectées pour les PR ; conserver la validation complète sur `main` et les tags. PR #67, test isolé : seuls IntegrationTests ont tourné (147 réussis). PR #68, changement Application + Web : toutes les suites affectées ont passé ; Domain a été ignorée. Le run push #227 confirme `Test plan: all` sur `main`. Les chemins qui lancent le workflow sont désormais filtrés pour les PR et les pushes de branche `main`; les tags `v*` conservent les validations complètes. -- 2.54.1