Compare commits
3
Commits
4f027c5072
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5009c96120 | ||
|
|
383205b9fc | ||
|
|
0e6371483d |
No files matched your search
@@ -16,9 +16,9 @@ Refs #
|
||||
|
||||
## Évaluation de release
|
||||
|
||||
<!-- Suivre la politique de version du projet et la skill globale /home/nonobis/skills/skills/release-assessment/SKILL.md. -->
|
||||
<!-- Appliquer la skill globale release-assessment et la politique de version Heimdall. -->
|
||||
|
||||
Release: no — raison
|
||||
Release assessment: <none | patch | minor | major> — rationale
|
||||
|
||||
## Livraison Heimdall
|
||||
|
||||
|
||||
+9
-4
@@ -75,6 +75,11 @@ Heimdall/
|
||||
| `gpu-runtime.md` | Capacités GPU Agent, configuration et limites de validation matérielle |
|
||||
| `development-workflow.md` | Règles opérationnelles Heimdall, CI et recettes d'acceptance |
|
||||
|
||||
Les exigences produit supplémentaires pour l'installation et les mises à jour
|
||||
Agent sont décrites dans `agent-release-signing.md` et `docker-compose.md`.
|
||||
Le parcours et les états visibles du panneau d'installation sont décrits dans
|
||||
`ui-pages.md`. Les procédures exécutables restent dans `scripts/acceptance/`.
|
||||
|
||||
L'audit est la source de vérité pour les constats actuels, leur statut et les travaux
|
||||
restants. Les documents de spécification décrivent parfois la cible initiale; leurs
|
||||
mentions de fonctionnalités ne prouvent pas leur livraison.
|
||||
@@ -82,10 +87,10 @@ mentions de fonctionnalités ne prouvent pas leur livraison.
|
||||
**Total : ~5 600 lignes de documentation**
|
||||
|
||||
Les règles et critères d’acceptation propres au produit sont maintenus dans ces
|
||||
guides et les autres documents de ce répertoire. Les pratiques génériques des
|
||||
agents sont définies dans le catalogue partagé `/home/nonobis/skills/skills/`.
|
||||
Les recettes exécutables sont rangées sous `scripts/acceptance/` et les
|
||||
contrôles automatisés sous `scripts/ci/`.
|
||||
guides et les autres documents de ce répertoire. Les pratiques génériques sont
|
||||
fournies par le catalogue partagé installé au niveau utilisateur; ce dépôt ne
|
||||
contient aucune skill locale. Les recettes exécutables sont rangées sous
|
||||
`scripts/acceptance/` et les contrôles automatisés sous `scripts/ci/`.
|
||||
|
||||
## Audit du 20 octobre 2026
|
||||
|
||||
|
||||
@@ -42,16 +42,18 @@ Central affiche une commande Bash ou PowerShell qui télécharge et exécute l
|
||||
|
||||
```sh
|
||||
sudo bash install/install-agent.sh \
|
||||
--central-url https://central.example.org \
|
||||
--site-token 'JETON_DE_SITE' \
|
||||
--central-url-file /chemin/protege/central-url \
|
||||
--site-token-file /chemin/protege/site-token \
|
||||
--update-public-key /chemin/local/agent-release-public.pem
|
||||
```
|
||||
|
||||
Les deux fichiers d’enrôlement doivent être réguliers, non-symlinks et en mode `0600` ou plus restrictif; placez-les dans un répertoire privé. N’inscrivez jamais l’URL ou le jeton dans les arguments de processus.
|
||||
|
||||
L’installateur Linux est servi par Central avec son superviseur. Il installe la release sous `/opt/heimdall/agent/releases/`; le service systemd utilise le lien `current`. Après téléchargement vérifié, le superviseur accorde jusqu’à 180 secondes au démarrage, exige ensuite 60 secondes de réponse continue de `/api/version` pour la version attendue et rétablit la release précédente si cette validation échoue.
|
||||
|
||||
Sous Windows, copiez la commande PowerShell générée dans l’IHM pour le site, en mode processus utilisateur ou service Windows. Elle télécharge le script depuis Central et applique `ExecutionPolicy Bypass` à la session PowerShell courante uniquement; elle ne change pas la stratégie persistante de la machine. L’installation comme service exige une session PowerShell élevée. Une stratégie imposée par une stratégie de groupe peut toujours interdire l’exécution.
|
||||
|
||||
Pour un Agent Docker, le Compose et les commandes `docker run` générés par l’IHM installent le dépôt d’image avec le tag `latest`; Compose et `docker run` vérifient le registre au démarrage. Le parcours CPU est sélectionné par défaut. Le parcours CUDA est proposé quand la release fournit l’image GPU signée; il demande aussi le NVIDIA Container Toolkit sur l’hôte. Aucun fichier de clé n’est à créer manuellement. Pour les mises à jour déclenchées ensuite par Central, l’Agent vérifie la signature et le digest d’image du manifeste signé avant de remplacer le conteneur. Les Agents configurés sur CUDA continuent de sélectionner l’image GPU pendant les mises à jour.
|
||||
Pour un Agent Docker, le Compose et les commandes `docker run` générés par l’IHM épinglent l’image CPU ou GPU au digest vérifié du manifeste signé (`repository@sha256:digest`). Compose et `docker run` récupèrent cette référence immuable au démarrage (`pull_policy: always` et `--pull always`). Le parcours CPU est sélectionné par défaut. Le parcours CUDA est proposé quand la release fournit l’image GPU signée; il demande aussi le NVIDIA Container Toolkit sur l’hôte. Aucun fichier de clé n’est à créer manuellement. Pour les mises à jour déclenchées ensuite par Central, l’Agent vérifie la signature et le digest d’image du manifeste signé avant de remplacer le conteneur. Les Agents configurés sur CUDA continuent de sélectionner l’image GPU pendant les mises à jour.
|
||||
|
||||
## Rotation
|
||||
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
# Règles de développement et acceptance Heimdall
|
||||
|
||||
Ce document conserve les exigences opérationnelles propres au dépôt. Les
|
||||
pratiques générales des agents relèvent du catalogue partagé. Le backlog et le
|
||||
suivi d'avancement du projet résident dans les issues Gitea; ne pas créer de
|
||||
`todo.md` parallèle. Lier l'issue dans la PR et y maintenir les preuves
|
||||
d'acceptance.
|
||||
pratiques générales des agents relèvent du catalogue partagé. Utiliser les
|
||||
issues Gitea comme backlog du projet et suivre le cycle commun de livraison.
|
||||
|
||||
## Architecture et implémentation
|
||||
|
||||
@@ -12,10 +10,7 @@ d'acceptance.
|
||||
interfaces dans `Application`, les adaptateurs et la persistance EF Core
|
||||
dans `Infrastructure`, la composition HTTP/UI dans `Web`, et le comportement
|
||||
caméra/runtime dans `Agent`.
|
||||
- Cibler le SDK épinglé dans `global.json` et .NET 10 ou plus récent. Garder les
|
||||
références nullable activées, transmettre les tokens d'annulation aux E/S et
|
||||
valider explicitement les options. Ne pas affaiblir les restores verrouillés
|
||||
ni supprimer un nouvel avertissement sans justification.
|
||||
- Cibler le SDK épinglé dans `global.json` et .NET 10 ou plus récent.
|
||||
- Utiliser EF Core pour les lectures et écritures de production. Les commandes
|
||||
ADO.NET ou spécifiques au fournisseur sont interdites en production. Une
|
||||
requête SQL EF propre au fournisseur n'est admise que si LINQ ne peut exprimer
|
||||
@@ -33,21 +28,11 @@ d'acceptance.
|
||||
- Les jobs Gitea s'exécutent sur `[ubuntu-latest, build-agent]`. Ne pas placer
|
||||
`runner-aaja` sur ce label. Ne jamais exposer d'identifiants de publication
|
||||
dans un job de pull request.
|
||||
- Une modification de comportement ou de déploiement qui nécessite une
|
||||
acceptance d'intégration doit utiliser une recette Compose jetable, construite
|
||||
depuis la source modifiée, avec données et identifiants synthétiques, ports,
|
||||
volumes, réseau, nom de projet et tags locaux uniques. Installer le nettoyage
|
||||
avant le premier build/démarrage. Après la recette, supprimer uniquement les
|
||||
ressources et tags exacts créés, vérifier leur absence et conserver les
|
||||
images amont. Ne jamais utiliser de prune global. Si Docker est indisponible,
|
||||
le signaler au lieu de prétendre que la recette a réussi.
|
||||
- Ne pas affirmer qu'un runner, registre, appareil, caméra ou stockage distant a
|
||||
été validé sans résultat d'une exécution réelle. Une acceptance synthétique
|
||||
locale ne prouve pas le comportement sur un hôte déployé, réseau externe ou
|
||||
matériel physique.
|
||||
- Toute PR touchant au déploiement ou à la publication documente les secrets
|
||||
requis et apporte une preuve locale pertinente du script. Ne jamais inclure
|
||||
de secret dans les changements, journaux ou artefacts.
|
||||
- Pour les recettes d'intégration, appliquer `disposable-test-environment` et
|
||||
choisir le script pertinent dans `scripts/acceptance/`.
|
||||
- Les validations de runner, registre, site, caméra ou stockage distant exigent
|
||||
une preuve d'exécution sur la cible concernée; les recettes locales ne
|
||||
constituent pas cette preuve.
|
||||
|
||||
## Recettes conservées
|
||||
|
||||
@@ -66,6 +51,12 @@ Les contrôles de build et de politique restent dans `scripts/ci/`. Voir
|
||||
[`gitea-builds.md`](gitea-builds.md) pour les workflows et contraintes de
|
||||
runners, et [`docker-compose.md`](docker-compose.md) pour les recettes jetables.
|
||||
|
||||
Pour les changements d'installation Agent, préserver la vérification de
|
||||
signature et de sommes de contrôle, ainsi que le rollback vers la release
|
||||
précédente si le démarrage échoue; voir
|
||||
[`agent-release-signing.md`](agent-release-signing.md). Les tests locaux de
|
||||
rollback ne remplacent pas la validation d'un service Linux ou Windows réel.
|
||||
|
||||
## Collaboration et conception
|
||||
|
||||
Pour les changements d'interface issus de Penpot, ouvrir le document avec la
|
||||
|
||||
@@ -155,10 +155,10 @@ network, or physical-camera behavior.
|
||||
|
||||
## Agent
|
||||
|
||||
Prefer the Compose shown in the Central UI's site installation panel. It uses
|
||||
the Agent image's `latest` tag and includes the site token, public Central URL,
|
||||
Agent name and release public key. Compose uses `pull_policy: always` so an
|
||||
explicit `docker compose up` checks for the latest image. Save it as
|
||||
Prefer the Compose shown in the Central UI's site installation panel. It pins
|
||||
the CPU or GPU Agent image to the signed `repository@sha256:digest` and includes
|
||||
the site token, public Central URL, Agent name and release public key. Compose
|
||||
uses `pull_policy: always` to fetch that exact digest. Save it as
|
||||
`docker-compose.yml`, then run `docker compose up -d`. The generated Compose
|
||||
contains the pinned trust key; no separate PEM file is required. Updates
|
||||
dispatched later by Central continue to verify the digest in the signed release
|
||||
|
||||
+13
-3
@@ -242,7 +242,7 @@ Dashboard shows agent offline state
|
||||
│ │ Commandes │ │
|
||||
│ │ Installer │ │
|
||||
│ │ ┌──────────────────────────────────────────┐ │ │
|
||||
│ │ │ curl ... install-agent.sh ... [⧉]│ │ │
|
||||
│ │ │ demander URL/token puis installer [⧉]│ │ │
|
||||
│ │ └──────────────────────────────────────────┘ │ │
|
||||
│ │ Lancer │ │
|
||||
│ │ ┌──────────────────────────────────────────┐ │ │
|
||||
@@ -260,6 +260,14 @@ Dashboard shows agent offline state
|
||||
|
||||
Le panneau suit le parcours de l'installateur Pangolin : choix de plateforme en tuiles, choix de méthode en tuiles, configuration optionnelle puis étapes de commandes. Les tuiles sont en trois colonnes sur écran large et s'empilent sur petit écran; les méthodes prennent toute la largeur disponible. La tuile sélectionnée garde un contour et un fond teinté de la couleur primaire.
|
||||
|
||||
Seuls Linux, Windows et Docker sont proposés. Les commandes natives exigent
|
||||
une release signée disponible; les commandes Docker utilisent l'image signée
|
||||
épinglée par digest et `pull_policy: always`. Les valeurs d'enrôlement ne sont
|
||||
pas incluses dans les commandes Linux: l'installateur les demande à l'exécution
|
||||
et les transmet via des fichiers temporaires protégés, supprimés à la sortie.
|
||||
Les textes visibles proviennent des ressources de localisation. Vérifier aussi
|
||||
les états sans release signée ou sans image GPU publiée.
|
||||
|
||||
```text
|
||||
Système d'exploitation
|
||||
[Linux] [Windows] [Docker]
|
||||
@@ -273,7 +281,7 @@ Configuration (Docker uniquement si l'image GPU est publiée)
|
||||
Commandes
|
||||
Installer
|
||||
┌──────────────────────────────────────────────┐
|
||||
│ commande/script [⧉]│
|
||||
│ demande URL et token masqué, puis installe [⧉]│
|
||||
└──────────────────────────────────────────────┘
|
||||
Lancer
|
||||
┌──────────────────────────────────────────────┐
|
||||
@@ -281,7 +289,9 @@ Lancer
|
||||
└──────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
Docker Compose affiche le YAML comme une étape « Configuration », suivie des commandes pour démarrer et vérifier l'Agent. Chaque bloc a une copie intégrée en haut à droite; après copie, l'icône devient une coche. Les commandes d'installation restent masquées tant que la release signée correspondante n'est pas disponible. Docker exige aussi les métadonnées d'image vérifiées de la release, puis installe l'image publiée avec le tag `latest`; les remplacements déclenchés par Central restent vérifiés par digest signé. En cas d'indisponibilité, le panneau montre une alerte explicite à la place des commandes.
|
||||
Docker Compose affiche le YAML comme une étape « Configuration », suivie des commandes pour démarrer et vérifier l'Agent. Chaque bloc a une copie intégrée en haut à droite; après copie, l'icône devient une coche. Les commandes d'installation restent masquées tant que la release signée correspondante n'est pas disponible. Docker exige les métadonnées d'image vérifiées de la release et épingle l'image CPU ou GPU sur son digest signé (`repository@sha256:digest`). Compose utilise `pull_policy: always` pour récupérer exactement ce digest; Docker Run utilise `--pull always`. En cas d'indisponibilité, le panneau montre une alerte explicite à la place des commandes.
|
||||
|
||||
La commande Linux ne contient ni l'URL Central ni le token du site. À son exécution, elle demande l'URL HTTPS puis le token sans afficher sa saisie, place les valeurs dans des fichiers temporaires protégés et télécharge les scripts par HTTPS avant leur exécution. L'installateur exige les fichiers d'enrôlement protégés et conserve le token comme credential systemd.
|
||||
|
||||
### États — Détail Site
|
||||
|
||||
|
||||
@@ -1,15 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
# install-agent.sh — Heimdall Agent installer for Linux
|
||||
set -euo pipefail
|
||||
CENTRAL_URL="" SITE_TOKEN="" AGENT_NAME="" STATE_DIR="/var/lib/heimdall" UPDATE_PUBLIC_KEY="" ALLOW_INSECURE_HTTP=false RUN_MODE=false INSTALL_ONLY=false
|
||||
CENTRAL_URL="" SITE_TOKEN="" CENTRAL_URL_FILE="" SITE_TOKEN_FILE="" AGENT_NAME="" STATE_DIR="/var/lib/heimdall" UPDATE_PUBLIC_KEY="" ALLOW_INSECURE_HTTP=false RUN_MODE=false INSTALL_ONLY=false
|
||||
INSTALL_ROOT="/opt/heimdall/agent" SERVICE_NAME="heimdall-agent" SERVICE_USER="heimdall"
|
||||
while [[ $# -gt 0 ]]; do case "$1" in --central-url) CENTRAL_URL="$2"; shift 2;; --site-token) SITE_TOKEN="$2"; shift 2;; --update-public-key) UPDATE_PUBLIC_KEY="$2"; shift 2;; --agent-name) AGENT_NAME="$2"; shift 2;; --state-dir) STATE_DIR="$2"; shift 2;; --allow-insecure-http) ALLOW_INSECURE_HTTP=true; shift;; --run) RUN_MODE=true; shift;; --install-only) INSTALL_ONLY=true; shift;; -h|--help) echo "Usage: $0 --central-url URL --site-token TOKEN [--agent-name NAME] [--run | --install-only] [--update-public-key LOCAL_PEM] [--state-dir PATH] [--allow-insecure-http]"; exit 0;; *) echo "Unknown: $1" >&2; exit 1;; esac; done
|
||||
[[ -z "$CENTRAL_URL" || -z "$SITE_TOKEN" ]] && { echo "Error: --central-url and --site-token are required" >&2; exit 1; }
|
||||
while [[ $# -gt 0 ]]; do case "$1" in --central-url-file) CENTRAL_URL_FILE="$2"; shift 2;; --site-token-file) SITE_TOKEN_FILE="$2"; shift 2;; --central-url|--site-token) echo "Error: pass enrollment settings through protected files, not command-line values" >&2; exit 1;; --update-public-key) UPDATE_PUBLIC_KEY="$2"; shift 2;; --agent-name) AGENT_NAME="$2"; shift 2;; --state-dir) STATE_DIR="$2"; shift 2;; --allow-insecure-http) ALLOW_INSECURE_HTTP=true; shift;; --run) RUN_MODE=true; shift;; --install-only) INSTALL_ONLY=true; shift;; -h|--help) echo "Usage: $0 --central-url-file PATH --site-token-file PATH [--agent-name NAME] [--run | --install-only] [--update-public-key LOCAL_PEM] [--state-dir PATH] [--allow-insecure-http]"; exit 0;; *) echo "Unknown: $1" >&2; exit 1;; esac; done
|
||||
read_protected_value() {
|
||||
local path="$1" label="$2" mode
|
||||
[[ -n "$path" && -f "$path" && ! -L "$path" ]] || { echo "Error: $label must reference a regular protected file" >&2; exit 1; }
|
||||
mode=$(stat -c '%a' "$path")
|
||||
(( (8#$mode & 077) == 0 )) || { echo "Error: $label file must not be accessible by group or others" >&2; exit 1; }
|
||||
cat -- "$path"
|
||||
}
|
||||
[[ -n "$CENTRAL_URL_FILE" && -n "$SITE_TOKEN_FILE" ]] || { echo "Error: --central-url-file and --site-token-file are required" >&2; exit 1; }
|
||||
CENTRAL_URL="$(read_protected_value "$CENTRAL_URL_FILE" 'Central URL')"
|
||||
SITE_TOKEN="$(read_protected_value "$SITE_TOKEN_FILE" 'site token')"
|
||||
[[ -n "$CENTRAL_URL" && -n "$SITE_TOKEN" ]] || { echo "Error: protected Central URL and site token files must be non-empty" >&2; exit 1; }
|
||||
[[ "$RUN_MODE" == true && "$INSTALL_ONLY" == true ]] && { echo '--run and --install-only cannot be combined' >&2; exit 1; }
|
||||
if [[ -n "$UPDATE_PUBLIC_KEY" && ! -f "$UPDATE_PUBLIC_KEY" ]]; then echo 'Publisher public key file is missing' >&2; exit 1; fi
|
||||
CENTRAL_URL="${CENTRAL_URL%/}"
|
||||
if [[ "$CENTRAL_URL" != https://* && ! ( "$ALLOW_INSECURE_HTTP" == true && "$CENTRAL_URL" == http://* ) ]]; then
|
||||
echo "Error: --central-url must use HTTPS (or explicitly opt in with --allow-insecure-http on an isolated network)" >&2
|
||||
echo "Error: Central URL must use HTTPS (or explicitly opt in with --allow-insecure-http on an isolated network)" >&2
|
||||
exit 1
|
||||
fi
|
||||
ARCH=$(uname -m); case "$ARCH" in x86_64|amd64) PLATFORM="linux-x64";; aarch64|arm64) PLATFORM="linux-arm64";; armv7l|armhf) PLATFORM="linux-arm";; *) echo "Unsupported: $ARCH" >&2; exit 1;; esac
|
||||
@@ -45,9 +55,11 @@ RELEASE_METADATA_URL="$CENTRAL_URL/api/updates/latest"
|
||||
for attempt in 1 2 3; do
|
||||
CURL_PROTOCOL=https
|
||||
[[ "$CENTRAL_URL" == https://* ]] || CURL_PROTOCOL=http
|
||||
printf '%s' "$RELEASE_METADATA_URL" | python3 -c 'import json,sys; open(sys.argv[1],"w").write("url = "+json.dumps(sys.stdin.read())+"\n")' "$TMP_DIR/release-metadata.curl"
|
||||
chmod 600 "$TMP_DIR/release-metadata.curl"
|
||||
HTTP_STATUS=$(curl -sS --proto "$CURL_PROTOCOL" \
|
||||
--connect-timeout 10 --max-time 30 \
|
||||
-w '%{http_code}' "$RELEASE_METADATA_URL" -o "$TMP_DIR/release.json") && CURL_STATUS=0 || CURL_STATUS=$?
|
||||
-w '%{http_code}' --config "$TMP_DIR/release-metadata.curl" -o "$TMP_DIR/release.json") && CURL_STATUS=0 || CURL_STATUS=$?
|
||||
if [[ "$CURL_STATUS" -eq 0 && "$HTTP_STATUS" =~ ^2[0-9][0-9]$ ]]; then
|
||||
break
|
||||
fi
|
||||
@@ -109,6 +121,11 @@ with tarfile.open(sys.argv[1], 'r:gz') as archive:
|
||||
shutil.copyfileobj(source,output)
|
||||
PY
|
||||
[[ -f "$TMP_DIR/agent/Heimdall.Agent.dll" ]] || { echo 'Archive has no agent assembly' >&2; exit 1; }
|
||||
printf '%s' "$CENTRAL_URL" | python3 -c 'import json,pathlib,sys; p=pathlib.Path(sys.argv[1]); raw=p.read_text() if p.exists() else "{}";
|
||||
try: d=json.loads(raw)
|
||||
except json.JSONDecodeError: d={}
|
||||
d.setdefault("Agent",{})["CentralUrl"]=sys.stdin.read(); p.write_text(json.dumps(d,indent=2)+"\n")' "$TMP_DIR/agent/appsettings.json"
|
||||
chmod 640 "$TMP_DIR/agent/appsettings.json"
|
||||
id "$SERVICE_USER" &>/dev/null || sudo useradd --system --no-create-home --shell /usr/sbin/nologin "$SERVICE_USER" 2>/dev/null || true
|
||||
sudo mkdir -p "$STATE_DIR" && sudo chown "$SERVICE_USER:$SERVICE_USER" "$STATE_DIR" && sudo chmod 700 "$STATE_DIR"
|
||||
sudo install -d -o "$SERVICE_USER" -g "$SERVICE_USER" -m 750 "$INSTALL_ROOT" "$INSTALL_ROOT/releases"
|
||||
@@ -122,7 +139,9 @@ sudo install -d -o root -g root -m 755 /usr/local/libexec
|
||||
SUPERVISOR_SOURCE="$(dirname "$0")/agent-supervisor.py"
|
||||
if [[ ! -f "$SUPERVISOR_SOURCE" ]]; then
|
||||
SUPERVISOR_SOURCE="$TMP_DIR/agent-supervisor.py"
|
||||
curl -fsS "$CENTRAL_URL/install/agent-supervisor.py" -o "$SUPERVISOR_SOURCE" || {
|
||||
printf '%s' "$CENTRAL_URL/install/agent-supervisor.py" | python3 -c 'import json,sys; open(sys.argv[1],"w").write("url = "+json.dumps(sys.stdin.read())+"\n")' "$TMP_DIR/supervisor.curl"
|
||||
chmod 600 "$TMP_DIR/supervisor.curl"
|
||||
curl -fsS --config "$TMP_DIR/supervisor.curl" -o "$SUPERVISOR_SOURCE" || {
|
||||
echo 'Failed to download the Heimdall Agent supervisor from Central' >&2; exit 1;
|
||||
}
|
||||
fi
|
||||
@@ -150,7 +169,6 @@ if [[ "$RUN_MODE" == true ]]; then
|
||||
ASPNETCORE_URLS=http://127.0.0.1:8081 \
|
||||
HEIMDALL_DOTNET="$DOTNET_BIN" \
|
||||
ASPNETCORE_ENVIRONMENT=Production \
|
||||
Agent__CentralUrl="$CENTRAL_URL" \
|
||||
Agent__AgentName="$AGENT_NAME" \
|
||||
Agent__AllowInsecureHttp="$ALLOW_INSECURE_HTTP" \
|
||||
Agent__StateDirectory="$STATE_DIR" \
|
||||
@@ -173,7 +191,6 @@ RestartSec=5
|
||||
Environment=ASPNETCORE_URLS=http://127.0.0.1:8081
|
||||
Environment=HEIMDALL_DOTNET=$DOTNET_BIN
|
||||
Environment=ASPNETCORE_ENVIRONMENT=Production
|
||||
Environment=Agent__CentralUrl=$CENTRAL_URL
|
||||
Environment=Agent__AllowInsecureHttp=$ALLOW_INSECURE_HTTP
|
||||
Environment=Agent__StateDirectory=$STATE_DIR
|
||||
Environment=Agent__UpdateInstallRoot=$INSTALL_ROOT
|
||||
@@ -183,6 +200,7 @@ $AGENT_NAME_CREDENTIAL
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
sudo chmod 600 "/etc/systemd/system/$SERVICE_NAME.service"
|
||||
sudo systemctl daemon-reload && sudo systemctl enable "$SERVICE_NAME"
|
||||
if [[ "$INSTALL_ONLY" == true ]]; then
|
||||
echo "Installed version $VERSION and enabled $SERVICE_NAME. Start it with: sudo systemctl start $SERVICE_NAME"
|
||||
|
||||
@@ -110,6 +110,8 @@ copy_source_asset() {
|
||||
|
||||
say "Installation de Heimdall Central (serveur + PostgreSQL)."
|
||||
destination="$(ask 'Dossier d’installation' "$HOME/heimdall")"
|
||||
compose_project="$(ask 'Nom isolé du projet Docker Compose' 'heimdall')"
|
||||
[[ "$compose_project" =~ ^[a-z0-9][a-z0-9_-]{0,62}$ ]] || { echo 'Nom de projet Compose invalide.' >&2; exit 1; }
|
||||
compose_path="$destination/docker-compose.yml"
|
||||
env_path="$destination/.env"
|
||||
is_existing=no
|
||||
@@ -125,7 +127,10 @@ if [[ -e "$compose_path" || -e "$env_path" ]]; then
|
||||
is_existing=yes
|
||||
else
|
||||
web_port="$(ask 'Port HTTP du serveur' '5000')"
|
||||
cors_origin="$(ask 'Origine(s) autorisée(s) par CORS' '*')"
|
||||
public_origin="${HEIMDALL_URL:-}"
|
||||
cors_default=''
|
||||
if [[ "$public_origin" =~ ^https://[A-Za-z0-9.-]+(:[0-9]{1,5})?$ ]]; then cors_default="$public_origin"; fi
|
||||
cors_origin="$(ask 'Origine(s) autorisée(s) par CORS' "${cors_default:-https://heimdall.invalid}")"
|
||||
[[ "$web_port" =~ ^[0-9]{1,5}$ ]] && (( web_port >= 1 && web_port <= 65535 )) || { echo "Port invalide." >&2; exit 1; }
|
||||
[[ "$cors_origin" =~ ^[A-Za-z0-9*.,:/_-]+$ ]] || { echo "Origine CORS invalide." >&2; exit 1; }
|
||||
fi
|
||||
@@ -186,8 +191,6 @@ fi
|
||||
compose_tmp="$(mktemp "$destination/.docker-compose.yml.XXXXXX")"
|
||||
trap 'rm -f "${compose_tmp:-}"' EXIT
|
||||
cat > "$compose_tmp" <<'COMPOSE'
|
||||
name: heimdall
|
||||
|
||||
services:
|
||||
postgresql:
|
||||
image: postgres:17-alpine
|
||||
@@ -257,11 +260,10 @@ secrets:
|
||||
|
||||
networks:
|
||||
heimdall-net:
|
||||
name: heimdall-net
|
||||
driver: bridge
|
||||
COMPOSE
|
||||
chmod 600 "$compose_tmp"
|
||||
docker compose --env-file "$env_path" -f "$compose_tmp" config --quiet
|
||||
docker compose --project-name "$compose_project" --env-file "$env_path" -f "$compose_tmp" config --quiet
|
||||
if [[ "$is_existing" == yes ]]; then
|
||||
backup_path="$compose_path.bak.$(date -u +%Y%m%dT%H%M%SZ)"
|
||||
cp -p "$compose_path" "$backup_path"
|
||||
@@ -291,7 +293,7 @@ say "Variables protégées dans $destination/.env (mode 600), secret PostgreSQL
|
||||
say "Validation du Compose avant démarrage…"
|
||||
start_core=no
|
||||
if [[ "$(ask 'Démarrer PostgreSQL et Heimdall maintenant ?' 'o')" =~ ^([oO]|[oO][uU][iI]|[yY]|[yY][eE][sS])$ ]]; then
|
||||
docker compose --env-file "$env_path" -f "$compose_path" up -d
|
||||
docker compose --project-name "$compose_project" --env-file "$env_path" -f "$compose_path" up -d
|
||||
start_core=yes
|
||||
fi
|
||||
|
||||
@@ -322,7 +324,7 @@ for service in "${selected[@]}"; do
|
||||
;;
|
||||
esac
|
||||
if [[ "$start_core" == yes ]] && [[ "$(ask "Démarrer le service optionnel ${service} ?" 'o')" =~ ^([oO]|[oO][uU][iI]|[yY]|[yY][eE][sS])$ ]]; then
|
||||
docker compose --project-directory "$compose_project_directory" --project-name "heimdall-${service}" \
|
||||
docker compose --project-directory "$compose_project_directory" --project-name "${compose_project}-${service}" \
|
||||
--env-file "$destination/.env" \
|
||||
-f "$destination/optional/docker-compose.${service}.yml" up -d
|
||||
else
|
||||
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
#!/usr/bin/env bash
|
||||
set -Eeuo pipefail
|
||||
|
||||
repo_root=$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)
|
||||
suffix="$(date -u +%Y%m%d%H%M%S)-$(od -An -N5 -tx1 /dev/urandom | tr -d ' \\n')"
|
||||
project="heimdall-sentry-privacy-${suffix}"
|
||||
temp_dir=$(mktemp -d "${TMPDIR:-/tmp}/${project}.XXXXXX")
|
||||
env_file="$temp_dir/acceptance.env"
|
||||
compose_file="$temp_dir/compose.yml"
|
||||
props_file="$temp_dir/acceptance.props"
|
||||
local_image_tags=()
|
||||
|
||||
cleanup() {
|
||||
status=$?
|
||||
trap - EXIT
|
||||
# Cleanup must continue through every independent resource even when the
|
||||
# caller enabled errexit/nounset or an earlier Docker query failed.
|
||||
set +e
|
||||
set +u
|
||||
cleanup_failed=0
|
||||
docker compose --project-directory "$repo_root" --env-file "$env_file" \
|
||||
-f "$compose_file" -p "$project" down --volumes --remove-orphans || cleanup_failed=1
|
||||
containers=$(docker ps -aq --filter "label=com.docker.compose.project=$project") || cleanup_failed=1
|
||||
if [[ -n "$containers" ]]; then
|
||||
while IFS= read -r container; do
|
||||
[[ -z "$container" ]] || docker rm -f "$container" >/dev/null || cleanup_failed=1
|
||||
done <<< "$containers"
|
||||
fi
|
||||
containers=$(docker ps -aq --filter "label=com.docker.compose.project=$project") || cleanup_failed=1
|
||||
volumes=$(docker volume ls -q --filter "label=com.docker.compose.project=$project") || cleanup_failed=1
|
||||
networks=$(docker network ls -q --filter "label=com.docker.compose.project=$project") || cleanup_failed=1
|
||||
if [[ -n "$containers" || -n "$volumes" || -n "$networks" ]]; then
|
||||
printf 'Project resources remain: containers=%s volumes=%s networks=%s\n' \
|
||||
"${containers:-<none>}" "${volumes:-<none>}" "${networks:-<none>}" >&2
|
||||
cleanup_failed=1
|
||||
else
|
||||
printf 'Verified no project containers, volumes, or networks remain: %s\n' "$project"
|
||||
fi
|
||||
if ((${#local_image_tags[@]} == 0)); then
|
||||
printf 'Local images built: none; upstream SDK image retained.\n'
|
||||
fi
|
||||
for tag in "${local_image_tags[@]}"; do
|
||||
docker image rm "$tag" >/dev/null 2>&1 || true
|
||||
if docker image inspect "$tag" >/dev/null 2>&1; then
|
||||
printf 'Recipe image remains: %s\n' "$tag" >&2
|
||||
cleanup_failed=1
|
||||
else
|
||||
printf 'Verified recipe image absent: %s\n' "$tag"
|
||||
fi
|
||||
done
|
||||
rm -f -- "$env_file" "$compose_file" "$props_file" || cleanup_failed=1
|
||||
rmdir -- "$temp_dir" || cleanup_failed=1
|
||||
if ((cleanup_failed)); then
|
||||
printf 'Disposable Sentry privacy acceptance cleanup failed for %s\n' "$project" >&2
|
||||
status=1
|
||||
fi
|
||||
exit "$status"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
cat > "$env_file" <<EOF
|
||||
REPO_ROOT=$repo_root
|
||||
ACCEPTANCE_PROJECT=$project
|
||||
ACCEPTANCE_DIR=$temp_dir
|
||||
ACCEPTANCE_UID=$(id -u)
|
||||
ACCEPTANCE_GID=$(id -g)
|
||||
EOF
|
||||
cat > "$props_file" <<'EOF'
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<BaseIntermediateOutputPath>/tmp/$(ACCEPTANCE_PROJECT)/obj/$(MSBuildProjectName)/</BaseIntermediateOutputPath>
|
||||
<MSBuildProjectExtensionsPath>/tmp/$(ACCEPTANCE_PROJECT)/obj/$(MSBuildProjectName)/</MSBuildProjectExtensionsPath>
|
||||
<BaseOutputPath>/tmp/$(ACCEPTANCE_PROJECT)/bin/$(MSBuildProjectName)/</BaseOutputPath>
|
||||
<DefaultItemExcludes>$(DefaultItemExcludes);**/obj/**;**/bin/**</DefaultItemExcludes>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
EOF
|
||||
cat > "$compose_file" <<'EOF'
|
||||
services:
|
||||
focused-tests:
|
||||
image: mcr.microsoft.com/dotnet/sdk:10.0
|
||||
entrypoint: ["dotnet"]
|
||||
user: "${ACCEPTANCE_UID}:${ACCEPTANCE_GID}"
|
||||
working_dir: /workspace
|
||||
environment:
|
||||
ACCEPTANCE_PROJECT: ${ACCEPTANCE_PROJECT}
|
||||
volumes:
|
||||
- ${REPO_ROOT}:/workspace
|
||||
- ${ACCEPTANCE_DIR}:/acceptance
|
||||
command:
|
||||
- test
|
||||
- tests/Heimdall.Web.Tests/Heimdall.Web.Tests.csproj
|
||||
- --filter
|
||||
- FullyQualifiedName~SentryTelemetryPrivacyTests
|
||||
- --verbosity
|
||||
- minimal
|
||||
- -p:RestoreLockedMode=true
|
||||
- -p:CustomBeforeDirectoryBuildProps=/acceptance/acceptance.props
|
||||
EOF
|
||||
|
||||
printf 'Disposable project: %s\nLocal images built: none\n' "$project"
|
||||
docker compose --project-directory "$repo_root" --env-file "$env_file" \
|
||||
-f "$compose_file" -p "$project" config --quiet
|
||||
docker compose --project-directory "$repo_root" --env-file "$env_file" \
|
||||
-f "$compose_file" -p "$project" run --rm focused-tests
|
||||
@@ -81,7 +81,7 @@ def plan(changed: list[str] | None) -> dict[str, object]:
|
||||
broad = True
|
||||
|
||||
if not broad and changed and not changed_projects and all(
|
||||
name.startswith(("docs/",))
|
||||
name.startswith(("docs/", "skills/"))
|
||||
or name in {"readme.md", "AGENTS.md", ".gitea/PULL_REQUEST_TEMPLATE.md"}
|
||||
for name in changed
|
||||
):
|
||||
|
||||
@@ -14,7 +14,15 @@ public sealed class AgentOptions
|
||||
|
||||
/// <summary>URL of the Heimdall Central server, supplied by the installation or deployment configuration.</summary>
|
||||
[Required, Url]
|
||||
public string CentralUrl { get; init; } = string.Empty;
|
||||
public string CentralUrl
|
||||
{
|
||||
get => string.IsNullOrWhiteSpace(_centralUrl)
|
||||
? ReadSystemdCredential("central-url") ?? string.Empty
|
||||
: _centralUrl;
|
||||
init => _centralUrl = value ?? string.Empty;
|
||||
}
|
||||
|
||||
private string _centralUrl = string.Empty;
|
||||
|
||||
/// <summary>Allow an unencrypted HTTP Central URL for isolated development networks only.</summary>
|
||||
public bool AllowInsecureHttp { get; init; }
|
||||
|
||||
@@ -171,7 +171,7 @@ public class AgentRegistrationService : BackgroundService
|
||||
throw new InvalidOperationException(
|
||||
"Agent registration requires Agent:SiteToken or a systemd site-token credential.");
|
||||
|
||||
_logger.LogInformation("Registering agent with Central at {CentralUrl}", _options.CentralUrl);
|
||||
_logger.LogInformation("Registering agent with Central.");
|
||||
|
||||
var maxRetries = _options.RegistrationMaxRetries;
|
||||
RegisterResponse? registration = null;
|
||||
|
||||
@@ -91,8 +91,8 @@
|
||||
},
|
||||
"AutoMapper": {
|
||||
"type": "Transitive",
|
||||
"resolved": "16.1.1",
|
||||
"contentHash": "VNEky8JA15ci+oIDRGHITOGOpV4dILsf8pnn24QhDl2urtqgJ2IXiS/V2EtGU17P/+f6OeFQPJETaZXV9QOIZg==",
|
||||
"resolved": "16.3.0",
|
||||
"contentHash": "wFTqA37e1I4AOEhTTYlxrqDE8BQ4OB3dqhlv2KwYmHv+a4tn7R1JW2n2bzXb8eTBhWVBSl7iTZ0VxEt0a57D4w==",
|
||||
"dependencies": {
|
||||
"Microsoft.IdentityModel.JsonWebTokens": "8.14.0"
|
||||
}
|
||||
@@ -326,7 +326,7 @@
|
||||
"heimdall.application": {
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"AutoMapper": "[16.1.1, )",
|
||||
"AutoMapper": "[16.3.0, )",
|
||||
"FluentValidation": "[11.11.0, )",
|
||||
"FluentValidation.DependencyInjectionExtensions": "[11.11.0, )",
|
||||
"Heimdall.Domain": "[1.0.0, )",
|
||||
|
||||
@@ -39,8 +39,6 @@
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "sk3VNcYEmgwYGPF4ze/112jpaeDKSsKGhmEZ8IlhOR8F6JT+1DYaZUb14jobVXiKhuXWIKcYXV7mkSPeA4dc3g==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Hosting": "10.0.13",
|
||||
"Microsoft.Extensions.Logging.EventLog": "10.0.13",
|
||||
"System.ServiceProcess.ServiceController": "10.0.13"
|
||||
}
|
||||
},
|
||||
@@ -91,8 +89,8 @@
|
||||
},
|
||||
"AutoMapper": {
|
||||
"type": "Transitive",
|
||||
"resolved": "16.1.1",
|
||||
"contentHash": "VNEky8JA15ci+oIDRGHITOGOpV4dILsf8pnn24QhDl2urtqgJ2IXiS/V2EtGU17P/+f6OeFQPJETaZXV9QOIZg==",
|
||||
"resolved": "16.3.0",
|
||||
"contentHash": "wFTqA37e1I4AOEhTTYlxrqDE8BQ4OB3dqhlv2KwYmHv+a4tn7R1JW2n2bzXb8eTBhWVBSl7iTZ0VxEt0a57D4w==",
|
||||
"dependencies": {
|
||||
"Microsoft.IdentityModel.JsonWebTokens": "8.14.0"
|
||||
}
|
||||
@@ -133,14 +131,6 @@
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "r9hlU+te+QWFJlUCt2C22TDKY3oMER8ayC7Qzeq6yJ5toHBKcSqshhyyaLKK1jgBuyNi4ejly0wE8ANV8TyfWQ=="
|
||||
},
|
||||
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "c6984ahCnqc3zqYgl5KqrBoY+LMKqJW6nZcFdBYNyp3PAA67prA/IgjQ/ySV0t3lEL2LEz3bcx91fbUYr8bRPA==",
|
||||
"dependencies": {
|
||||
"Microsoft.EntityFrameworkCore.Relational": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.AspNetCore.SignalR.Client.Core": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
@@ -202,290 +192,11 @@
|
||||
"SQLitePCLRaw.core": "2.1.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Configuration": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "inhujYI/nikhmLxYI6ZEcaCgZ28ipJsKMPPxxr2XWf3vM0Q2P+E9R3hDHABZOLBxzD3gjpgcbSH/+hd2+gvI2A==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Configuration.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.Primitives": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Configuration.Abstractions": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "DY4C2qzTt2lOIY3VoscBH/TCwTolI5DKOfgJLuI+k1QUvRNT5vTMS58AOerNiihdVRStO0wEpLeRWA8jytzHBQ==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Primitives": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Configuration.Binder": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "yJJl/b0+W+GEWbu+7viw6C3h2BoNkB69Vlz7s/4e+hm4mYbJqfhdcDSi9sCXJw47blsBaiQd3UDPgDtop92+ug==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Configuration": "10.0.13",
|
||||
"Microsoft.Extensions.Configuration.Abstractions": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Configuration.CommandLine": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "RwdNZ9JdGs8eZmeL5qRe7ugp0Irk3KVkWpC/w1c8kjJwu1R4HvCXYz9kwHZxn45WiaRBG5lphQKtqnBaJOQC+Q==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Configuration": "10.0.13",
|
||||
"Microsoft.Extensions.Configuration.Abstractions": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Configuration.EnvironmentVariables": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "qJK2dm9/AxyPVfqqBaZtjkUFl2hnBR/CQnMJtSO5LdEoyATMqvZjeQVY+8l0oa6PM6qlVe28iMEyXIRQ0wyZjA==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Configuration": "10.0.13",
|
||||
"Microsoft.Extensions.Configuration.Abstractions": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Configuration.FileExtensions": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "kwC1DY55CsqPmDtJAz+7alD3G+gJcM+XwHSZrcRO8mJGYB9hRq1qC6ZH8DL0SPW9WtJ/Bae5ikzPic8SxSv6Vw==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Configuration": "10.0.13",
|
||||
"Microsoft.Extensions.Configuration.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.FileProviders.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.FileProviders.Physical": "10.0.13",
|
||||
"Microsoft.Extensions.Primitives": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Configuration.Json": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "acCWM2+WR67kBAz6gAhD2zG+IZH9Q2VpKv5le7Msiu0vAMsnnLXpnV3BAzxd8/i+uOEo/dfb2XRYTynRVTDvEg==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Configuration": "10.0.13",
|
||||
"Microsoft.Extensions.Configuration.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.Configuration.FileExtensions": "10.0.13",
|
||||
"Microsoft.Extensions.FileProviders.Abstractions": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Configuration.UserSecrets": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "kQ/Tx972unP+ueQL8SSninthIj6w6XP2o0VnJPFC5HQIimPMwEN704MOspEgDkmm4FUL5SuxLEU0bNiW4HEZFA==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Configuration.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.Configuration.Json": "10.0.13",
|
||||
"Microsoft.Extensions.FileProviders.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.FileProviders.Physical": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.DependencyInjection": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "4tnWU9vrU/A8NwYe9Z6wvieZ0EBb/uM82LAT+edNhdepOBWREZ7M7mzb941EIDPJaeOFdbVrDd5+7s9e89U6bQ==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "G2GrGWNAPZBsii2F6AU8n+JT2tC1/I0Ml/e9ZyNCgPjf3hZqronP7o0X91aAynCmVeae8KkSIUNXXeXCNRmdVQ=="
|
||||
},
|
||||
"Microsoft.Extensions.DependencyModel": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "6TyllZsToy3S/Ziu67GddljRTttuVJ8bbrbVUrsdHqH5678Oax5MpaEubxLoPoWLvgUBYo4KfcAig0mkBtktXQ=="
|
||||
},
|
||||
"Microsoft.Extensions.Diagnostics": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "J9ODOrffj1mK3Et69elNsLGRguesPxvThTdVpFmQX7fLNPhIOgqHQfLdGnTBEwNAV3yf8yiyVlpDZNw2qN87Nw==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Configuration": "10.0.13",
|
||||
"Microsoft.Extensions.Diagnostics.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.Options.ConfigurationExtensions": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Diagnostics.Abstractions": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "oZzqZze8ed1fLS20HtIrkPxQXGRG/koq09srIw2ptnDHm9RHfwB++d35hosB/cXc55TH7Pshv85O0txongjCIg==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.Options": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.FileProviders.Abstractions": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "BZDwtN3uoWRghDi5lRRZPDjMMCg2Ds7J6YEYjqka/TLjqnzquEpXyvchrIMeoubwT1ns23ow6PPeAoBHJO81Rw==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Primitives": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.FileProviders.Physical": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "U7HkgGCNPICN5k7NVK6dmLsSPSPeO/EbNcuxOl/5qdC9Ahjp9UZWKOvlnUC+rYurmoxIlwyv9e5j0BaQlTOELA==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.FileProviders.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.FileSystemGlobbing": "10.0.13",
|
||||
"Microsoft.Extensions.Primitives": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.FileSystemGlobbing": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "vQVzmAbnzlhXSXA2caYnlxtG9GXxEwtj5bODiWLu06A6iqeJmfBtlfKjuOSJGRy0/CFaNUrm7u9nxEUlljc2Rg=="
|
||||
},
|
||||
"Microsoft.Extensions.Hosting": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "Q+hmPoDqeHipHyJcY7mDCQiLDUcn9jIgjoCThcgaOgjLTTT3ApTe8p6M2+twsDyfKuuCsKhSNlnNjaaggtXxRA==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Configuration": "10.0.13",
|
||||
"Microsoft.Extensions.Configuration.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.Configuration.Binder": "10.0.13",
|
||||
"Microsoft.Extensions.Configuration.CommandLine": "10.0.13",
|
||||
"Microsoft.Extensions.Configuration.EnvironmentVariables": "10.0.13",
|
||||
"Microsoft.Extensions.Configuration.FileExtensions": "10.0.13",
|
||||
"Microsoft.Extensions.Configuration.Json": "10.0.13",
|
||||
"Microsoft.Extensions.Configuration.UserSecrets": "10.0.13",
|
||||
"Microsoft.Extensions.DependencyInjection": "10.0.13",
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.Diagnostics": "10.0.13",
|
||||
"Microsoft.Extensions.FileProviders.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.FileProviders.Physical": "10.0.13",
|
||||
"Microsoft.Extensions.Hosting.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.Logging": "10.0.13",
|
||||
"Microsoft.Extensions.Logging.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.Logging.Configuration": "10.0.13",
|
||||
"Microsoft.Extensions.Logging.Console": "10.0.13",
|
||||
"Microsoft.Extensions.Logging.Debug": "10.0.13",
|
||||
"Microsoft.Extensions.Logging.EventLog": "10.0.13",
|
||||
"Microsoft.Extensions.Logging.EventSource": "10.0.13",
|
||||
"Microsoft.Extensions.Options": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Hosting.Abstractions": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "zIrbe9vkIFXxW3mOApIOWXw+xMwX7Cgsptr3ZSlglJt4hW2qp4fB/JU1NHgAevteBNH4PicvU9DsFPHxlnnloA==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Configuration.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.Diagnostics.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.FileProviders.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.Logging.Abstractions": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Logging": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "fqbiPy4nUp4H2XHKAVQXKN2y3T2h4cFIx1DAAgE6iY9OHkN/OA1cKFi+geJKRWGuX6pS5SFbsjIPWHJqrxE0eg==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.DependencyInjection": "10.0.13",
|
||||
"Microsoft.Extensions.Logging.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.Options": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Logging.Abstractions": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "aSZEhEig4fvNiw2zs8Z6NyDlniKtq6YjcF3DyHuqTEHcZ2VKA/6itMPZ+dW+yWABWExlDcQwwdbqX1Rcb7W8WQ==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Logging.Configuration": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "OyYJOaE9WbBx1Hp+Dd2zrqeFM0JwH5M/x0VL6tNUv3V18vIAVpix8UjhvY9eW/iXpguEHy68JO/Z9YkBOwftIw==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Configuration": "10.0.13",
|
||||
"Microsoft.Extensions.Configuration.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.Configuration.Binder": "10.0.13",
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.Logging": "10.0.13",
|
||||
"Microsoft.Extensions.Logging.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.Options": "10.0.13",
|
||||
"Microsoft.Extensions.Options.ConfigurationExtensions": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Logging.Console": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "i9rn0rHkiCxfNVbf4DRG7LOFcKPy/BioAxS07w6daWvIpLNRjskqDJcGGaYVFWndsq0iTRaS8Msry0t5fRYQug==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.Logging": "10.0.13",
|
||||
"Microsoft.Extensions.Logging.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.Logging.Configuration": "10.0.13",
|
||||
"Microsoft.Extensions.Options": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Logging.Debug": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "yBig0DNMq+3UgliwxYlUC48dg0fPqvqI5B3ljzmLTrpR6maoKTOO5i9QnPgQUmQoaQWZMgu74fuF6oSDihb6pg==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.Logging": "10.0.13",
|
||||
"Microsoft.Extensions.Logging.Abstractions": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Logging.EventLog": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "OAK40lXhgMuvyNwvzW3fxLvvucN8yr5XS7dQRcPmtnPf+Pt1lpbMgao5T4Wa6VdFagtIeDZNgPtV5Ig4xstziQ==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.Logging": "10.0.13",
|
||||
"Microsoft.Extensions.Logging.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.Options": "10.0.13",
|
||||
"System.Diagnostics.EventLog": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Logging.EventSource": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "SxJu3oczk+TJtHvpgAmCVzEkzx69/obA6GZCbGrbqYqc981YOAyfEprySBdFX7Yc5qatHJKHNTlpGeeBAQkZcA==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.Logging": "10.0.13",
|
||||
"Microsoft.Extensions.Logging.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.Options": "10.0.13",
|
||||
"Microsoft.Extensions.Primitives": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Options": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "tmMJgdrE4uhf1JcNs9CV9moAHW+hmDuvgMiPpnQxarKaUxqI2eN33sYK5S4l9Uw+rG9PJvlm4qPxMhvolTDTaQ==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.Primitives": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Options.ConfigurationExtensions": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "xVO5HhATc09WXuS/RaDmx8ZeWS0mTpT1L0tkEDMSBHtAnNpNsDr0ge0wIO2jinCWWqpq5dL1tRTzpYNVlvyqLw==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Configuration.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.Configuration.Binder": "10.0.13",
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.Options": "10.0.13",
|
||||
"Microsoft.Extensions.Primitives": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Primitives": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "ZjTwxzhiw2TMEzIbUDkMF0dfDB2I4NQgIfKD0ELu9/5Mk+SRGdKZcD0/lvBrRCAPo6KN2r0BW86MRancoyJkoA=="
|
||||
},
|
||||
"Microsoft.IdentityModel.Abstractions": {
|
||||
"type": "Transitive",
|
||||
"resolved": "8.14.0",
|
||||
@@ -584,11 +295,6 @@
|
||||
"SQLitePCLRaw.core": "3.0.5"
|
||||
}
|
||||
},
|
||||
"System.Diagnostics.EventLog": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "DkNjtQyPR5Ud/zHnWHdsOuKbFRL9nIC92Q76z0NmHVDoQm40toLtsGFTIWq7toBoVa6fo/DInL3PLxY3Asixyw=="
|
||||
},
|
||||
"System.Numerics.Tensors": {
|
||||
"type": "Transitive",
|
||||
"resolved": "9.0.0",
|
||||
@@ -602,12 +308,11 @@
|
||||
"heimdall.application": {
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"AutoMapper": "[16.1.1, )",
|
||||
"AutoMapper": "[16.3.0, )",
|
||||
"FluentValidation": "[11.11.0, )",
|
||||
"FluentValidation.DependencyInjectionExtensions": "[11.11.0, )",
|
||||
"Heimdall.Domain": "[1.0.0, )",
|
||||
"MediatR": "[12.5.0, )",
|
||||
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "[10.0.13, )",
|
||||
"Microsoft.Data.Sqlite": "[10.0.13, )",
|
||||
"Microsoft.EntityFrameworkCore": "[10.0.13, )",
|
||||
"Microsoft.EntityFrameworkCore.Sqlite": "[10.0.13, )",
|
||||
@@ -620,8 +325,7 @@
|
||||
"heimdall.domain": {
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Heimdall.Domain.Primitives": "[1.0.0, )",
|
||||
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "[10.0.13, )"
|
||||
"Heimdall.Domain.Primitives": "[1.0.0, )"
|
||||
}
|
||||
},
|
||||
"heimdall.domain.primitives": {
|
||||
@@ -632,4 +336,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoMapper" Version="16.1.1" />
|
||||
<PackageReference Include="AutoMapper" Version="16.3.0" />
|
||||
<PackageReference Include="FluentValidation" Version="11.11.0" />
|
||||
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.11.0" />
|
||||
<PackageReference Include="MediatR" Version="12.5.0" />
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
"net10.0": {
|
||||
"AutoMapper": {
|
||||
"type": "Direct",
|
||||
"requested": "[16.1.1, )",
|
||||
"resolved": "16.1.1",
|
||||
"contentHash": "VNEky8JA15ci+oIDRGHITOGOpV4dILsf8pnn24QhDl2urtqgJ2IXiS/V2EtGU17P/+f6OeFQPJETaZXV9QOIZg==",
|
||||
"requested": "[16.3.0, )",
|
||||
"resolved": "16.3.0",
|
||||
"contentHash": "wFTqA37e1I4AOEhTTYlxrqDE8BQ4OB3dqhlv2KwYmHv+a4tn7R1JW2n2bzXb8eTBhWVBSl7iTZ0VxEt0a57D4w==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "10.0.0",
|
||||
"Microsoft.Extensions.Options": "10.0.0",
|
||||
|
||||
@@ -145,8 +145,8 @@
|
||||
},
|
||||
"AutoMapper": {
|
||||
"type": "Transitive",
|
||||
"resolved": "16.1.1",
|
||||
"contentHash": "VNEky8JA15ci+oIDRGHITOGOpV4dILsf8pnn24QhDl2urtqgJ2IXiS/V2EtGU17P/+f6OeFQPJETaZXV9QOIZg==",
|
||||
"resolved": "16.3.0",
|
||||
"contentHash": "wFTqA37e1I4AOEhTTYlxrqDE8BQ4OB3dqhlv2KwYmHv+a4tn7R1JW2n2bzXb8eTBhWVBSl7iTZ0VxEt0a57D4w==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "10.0.0",
|
||||
"Microsoft.Extensions.Options": "10.0.0",
|
||||
@@ -791,12 +791,11 @@
|
||||
"heimdall.application": {
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"AutoMapper": "[16.1.1, )",
|
||||
"AutoMapper": "[16.3.0, )",
|
||||
"FluentValidation": "[11.11.0, )",
|
||||
"FluentValidation.DependencyInjectionExtensions": "[11.11.0, )",
|
||||
"Heimdall.Domain": "[1.0.0, )",
|
||||
"MediatR": "[12.5.0, )",
|
||||
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "[10.0.13, )",
|
||||
"Microsoft.Data.Sqlite": "[10.0.13, )",
|
||||
"Microsoft.EntityFrameworkCore": "[10.0.13, )",
|
||||
"Microsoft.EntityFrameworkCore.Sqlite": "[10.0.13, )",
|
||||
@@ -806,8 +805,7 @@
|
||||
"heimdall.domain": {
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Heimdall.Domain.Primitives": "[1.0.0, )",
|
||||
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "[10.0.13, )"
|
||||
"Heimdall.Domain.Primitives": "[1.0.0, )"
|
||||
}
|
||||
},
|
||||
"heimdall.domain.primitives": {
|
||||
|
||||
@@ -113,6 +113,10 @@ else if (_method == "docker-run")
|
||||
</MudTooltip>
|
||||
</MudPaper>
|
||||
}
|
||||
@if (_method is "linux-run" or "linux-systemd")
|
||||
{
|
||||
<MudAlert Severity="Severity.Info" Class="mb-3">@Text["SiteInstallPanel_LinuxSecretPrompt"]</MudAlert>
|
||||
}
|
||||
@foreach (var command in Commands)
|
||||
{
|
||||
<MudText Typo="Typo.subtitle2" Class="mb-2 mt-3">@Text[command.Label]</MudText>
|
||||
@@ -244,12 +248,8 @@ else if (_method == "windows-service")
|
||||
!string.IsNullOrWhiteSpace(release?.SignedManifest) &&
|
||||
!string.IsNullOrWhiteSpace(release?.ManifestSignature) &&
|
||||
release?.Assets.Count > 0;
|
||||
if (!string.IsNullOrWhiteSpace(release?.ContainerImage) &&
|
||||
!string.IsNullOrWhiteSpace(release.ContainerImageDigest))
|
||||
_agentImageReference = LatestImageReference(release.ContainerImage);
|
||||
if (!string.IsNullOrWhiteSpace(release?.ContainerImageGpu) &&
|
||||
!string.IsNullOrWhiteSpace(release.ContainerImageGpuDigest))
|
||||
_agentGpuImageReference = LatestImageReference(release.ContainerImageGpu);
|
||||
_agentImageReference = ImmutableImageReference(release?.ContainerImage, release?.ContainerImageDigest);
|
||||
_agentGpuImageReference = ImmutableImageReference(release?.ContainerImageGpu, release?.ContainerImageGpuDigest);
|
||||
_updatePublicKeyPem = release?.UpdatePublicKeyPem;
|
||||
}
|
||||
catch
|
||||
@@ -262,12 +262,14 @@ else if (_method == "windows-service")
|
||||
}
|
||||
}
|
||||
|
||||
private static string LatestImageReference(string image)
|
||||
private static string? ImmutableImageReference(string? image, string? digest)
|
||||
{
|
||||
var lastSlash = image.LastIndexOf('/');
|
||||
var lastColon = image.LastIndexOf(':');
|
||||
var repository = lastColon > lastSlash ? image[..lastColon] : image;
|
||||
return $"{repository}:latest";
|
||||
if (string.IsNullOrWhiteSpace(image) || image.Contains('@', StringComparison.Ordinal) ||
|
||||
string.IsNullOrWhiteSpace(digest) || !System.Text.RegularExpressions.Regex.IsMatch(
|
||||
digest, "^sha256:[0-9a-fA-F]{64}$", System.Text.RegularExpressions.RegexOptions.CultureInvariant))
|
||||
return null;
|
||||
|
||||
return $"{image}@{digest.ToLowerInvariant()}";
|
||||
}
|
||||
|
||||
private string ComposeYaml
|
||||
@@ -410,15 +412,16 @@ else if (_method == "windows-service")
|
||||
|
||||
private string LinuxInstallCommand(bool service)
|
||||
{
|
||||
var baseUrl = CentralUrl.TrimEnd('/');
|
||||
var scriptUrl = ShellQuote(baseUrl + "/install/install-agent.sh");
|
||||
var supervisorUrl = ShellQuote(baseUrl + "/install/agent-supervisor.py");
|
||||
var args = $"--central-url {ShellQuote(CentralUrl)} --site-token {ShellQuote(SiteToken)} --agent-name {ShellQuote(SiteName)}";
|
||||
var args = $"--central-url-file \"$tmp/central-url\" --site-token-file \"$tmp/site-token\" --agent-name {ShellQuote(SiteName)}";
|
||||
args += service ? " --install-only" : " --run";
|
||||
return "tmp=$(mktemp -d) && " +
|
||||
$"curl -fsSL {scriptUrl} -o \"$tmp/install-agent.sh\" && " +
|
||||
$"curl -fsSL {supervisorUrl} -o \"$tmp/agent-supervisor.py\" && " +
|
||||
$"sudo bash \"$tmp/install-agent.sh\" {args}; rc=$?; rm -rf \"$tmp\"; exit $rc";
|
||||
return "set -eu\n" +
|
||||
"tmp=$(mktemp -d)\nchmod 700 \"$tmp\"\n" +
|
||||
"cleanup() { rc=$?; trap - EXIT; rm -f \"$tmp/install-agent.sh\" \"$tmp/agent-supervisor.py\" \"$tmp/central-url\" \"$tmp/site-token\"; rmdir \"$tmp\"; exit $rc; }\ntrap cleanup EXIT HUP INT TERM\n" +
|
||||
"printf 'Central HTTPS URL: '; IFS= read -r central_url\n" +
|
||||
"printf 'Site enrollment token (input hidden): '; IFS= read -r -s site_token; printf '\\n'\n" +
|
||||
"umask 077\nprintf '%s' \"$central_url\" > \"$tmp/central-url\"\nprintf '%s' \"$site_token\" > \"$tmp/site-token\"\nunset central_url site_token\n" +
|
||||
"python3 - \"$tmp\" <<'PY'\nimport pathlib, sys, urllib.request\nroot=pathlib.Path(sys.argv[1])\nbase=(root/'central-url').read_text().rstrip('/')\nif not base.startswith('https://'): raise SystemExit('Central URL must use HTTPS')\nfor name in ('install-agent.sh','agent-supervisor.py'):\n request=urllib.request.Request(base+'/install/'+name, headers={'User-Agent':'Heimdall-Agent-Installer'})\n with urllib.request.urlopen(request, timeout=30) as response:\n if response.status != 200: raise SystemExit('Central installer asset request failed')\n (root/name).write_bytes(response.read())\nPY\n" +
|
||||
$"sudo bash \"$tmp/install-agent.sh\" {args}";
|
||||
}
|
||||
|
||||
private string WindowsServiceName => "HeimdallAgent-" + Slugify(SiteName)[..Math.Min(60, Slugify(SiteName).Length)];
|
||||
|
||||
@@ -131,44 +131,41 @@ public class UpdatesController : ControllerBase
|
||||
return null;
|
||||
var release = await ReadForgejoReleaseAsync(response.Content, ct);
|
||||
if (release is null) return null;
|
||||
var assets = new Dictionary<string, PlatformAsset>();
|
||||
foreach (var asset in release.Assets ?? [])
|
||||
{
|
||||
var platform = DetectPlatform(asset.Name);
|
||||
if (platform is null) continue;
|
||||
assets[platform] = new PlatformAsset { Url = asset.BrowserDownloadUrl, Sha256 = ExtractSha256(asset.Digest), Size = asset.Size };
|
||||
}
|
||||
var result = new LatestReleaseResponse { Version = release.TagName, ReleaseNotes = release.Body, PublishedAt = release.PublishedAt, Assets = assets };
|
||||
var publicKeyBytes = await FetchBoundedReleaseAssetAsync(release.Assets,
|
||||
"agent-release-public.pem", client, 4096, ct);
|
||||
if (publicKeyBytes is not null)
|
||||
{
|
||||
try
|
||||
{
|
||||
var publicKeyPem = System.Text.Encoding.UTF8.GetString(publicKeyBytes);
|
||||
using var verifier = ECDsa.Create();
|
||||
verifier.ImportFromPem(publicKeyPem);
|
||||
if (verifier.KeySize == 256)
|
||||
result.UpdatePublicKeyPem = publicKeyPem;
|
||||
}
|
||||
catch (CryptographicException) { }
|
||||
catch (ArgumentException) { }
|
||||
}
|
||||
var image = await FetchAgentImageManifestAsync(release.Assets, "agent-image.json", client, ct);
|
||||
result.ContainerImage = image?.Image;
|
||||
result.ContainerImageDigest = image?.Digest;
|
||||
var gpuImage = await FetchAgentImageManifestAsync(release.Assets, "agent-image-gpu.json", client, ct);
|
||||
result.ContainerImageGpu = gpuImage?.Image;
|
||||
result.ContainerImageGpuDigest = gpuImage?.Digest;
|
||||
"agent-release-public.pem", client, 4096, sourceUri, ct);
|
||||
var manifestBytes = await FetchBoundedReleaseAssetAsync(release.Assets,
|
||||
"agent-update-manifest.json", client, 1_048_576, ct);
|
||||
"agent-update-manifest.json", client, 1_048_576, sourceUri, ct);
|
||||
var signatureBytes = await FetchBoundedReleaseAssetAsync(release.Assets,
|
||||
"agent-update-manifest.sig", client, 512, ct);
|
||||
if (manifestBytes is not null && signatureBytes is not null)
|
||||
"agent-update-manifest.sig", client, 512, sourceUri, ct);
|
||||
var publicKeyPem = publicKeyBytes is null ? null : System.Text.Encoding.UTF8.GetString(publicKeyBytes);
|
||||
if (publicKeyPem is null || manifestBytes is null || signatureBytes is null ||
|
||||
!AgentReleaseManifestVerifier.TryVerify(publicKeyPem, manifestBytes, signatureBytes,
|
||||
release.TagName, out var signedManifest) || signedManifest is null)
|
||||
return null;
|
||||
|
||||
var assets = new Dictionary<string, PlatformAsset>();
|
||||
foreach (var (platform, sha256) in signedManifest.Assets)
|
||||
{
|
||||
result.SignedManifest = Convert.ToBase64String(manifestBytes);
|
||||
result.ManifestSignature = Convert.ToBase64String(signatureBytes);
|
||||
var asset = release.Assets?.SingleOrDefault(a => DetectPlatform(a.Name) == platform);
|
||||
if (asset is null || !IsSameHttpsOrigin(asset.BrowserDownloadUrl, sourceUri)) return null;
|
||||
assets[platform] = new PlatformAsset { Url = asset.BrowserDownloadUrl, Sha256 = sha256, Size = asset.Size };
|
||||
}
|
||||
if (assets.Count == 0) return null;
|
||||
|
||||
var result = new LatestReleaseResponse
|
||||
{
|
||||
Version = signedManifest.Version,
|
||||
ReleaseNotes = release.Body,
|
||||
PublishedAt = release.PublishedAt,
|
||||
Assets = assets,
|
||||
ContainerImage = signedManifest.ContainerImage,
|
||||
ContainerImageDigest = signedManifest.ContainerImageDigest,
|
||||
ContainerImageGpu = signedManifest.ContainerImageGpu,
|
||||
ContainerImageGpuDigest = signedManifest.ContainerImageGpuDigest,
|
||||
UpdatePublicKeyPem = publicKeyPem,
|
||||
SignedManifest = Convert.ToBase64String(manifestBytes),
|
||||
ManifestSignature = Convert.ToBase64String(signatureBytes),
|
||||
};
|
||||
lock (_cacheLock) { _cache = new LatestReleaseCache(source!, result, DateTime.UtcNow); }
|
||||
return result;
|
||||
}
|
||||
@@ -236,52 +233,19 @@ public class UpdatesController : ControllerBase
|
||||
statusCode is System.Net.HttpStatusCode.RequestTimeout or System.Net.HttpStatusCode.TooManyRequests ||
|
||||
(int)statusCode >= 500;
|
||||
|
||||
private static async Task<AgentImageManifest?> FetchAgentImageManifestAsync(List<ForgejoAsset>? assets,
|
||||
string assetName, HttpClient client, CancellationToken ct)
|
||||
{
|
||||
var asset = assets?.FirstOrDefault(a => string.Equals(a.Name, assetName, StringComparison.OrdinalIgnoreCase));
|
||||
var expectedSha256 = asset is null ? null : ExtractSha256(asset.Digest);
|
||||
if (asset is null || !IsSha256Digest(expectedSha256)) return null;
|
||||
try
|
||||
{
|
||||
using var response = await client.GetAsync(asset.BrowserDownloadUrl, HttpCompletionOption.ResponseHeadersRead, ct);
|
||||
if (!response.IsSuccessStatusCode || response.Content.Headers.ContentLength is > 1_048_576)
|
||||
return null;
|
||||
await using var stream = await response.Content.ReadAsStreamAsync(ct);
|
||||
using var buffer = new MemoryStream();
|
||||
var chunk = new byte[8192];
|
||||
while (true)
|
||||
{
|
||||
var read = await stream.ReadAsync(chunk, ct);
|
||||
if (read == 0) break;
|
||||
if (buffer.Length + read > 1_048_576) return null;
|
||||
buffer.Write(chunk, 0, read);
|
||||
}
|
||||
var bytes = buffer.ToArray();
|
||||
var actualSha256 = Convert.ToHexString(SHA256.HashData(bytes));
|
||||
if (!string.Equals(actualSha256, expectedSha256, StringComparison.OrdinalIgnoreCase)) return null;
|
||||
var manifest = JsonSerializer.Deserialize<AgentImageManifest>(bytes, Json);
|
||||
return manifest is not null && IsValidContainerImageRepository(manifest.Image) && IsValidContainerImageDigest(manifest.Digest)
|
||||
? manifest
|
||||
: null;
|
||||
}
|
||||
catch (OperationCanceledException) when (ct.IsCancellationRequested) { throw; }
|
||||
catch { return null; }
|
||||
}
|
||||
|
||||
private static bool IsSha256Digest(string? value) => value is { Length: 64 } && value.All(Uri.IsHexDigit);
|
||||
|
||||
private static async Task<byte[]?> FetchBoundedReleaseAssetAsync(List<ForgejoAsset>? assets,
|
||||
string name, HttpClient client, int maxBytes, CancellationToken ct)
|
||||
string name, HttpClient client, int maxBytes, Uri sourceUri, CancellationToken ct)
|
||||
{
|
||||
var asset = assets?.FirstOrDefault(a => string.Equals(a.Name, name, StringComparison.Ordinal));
|
||||
var expected = asset is null ? null : ExtractSha256(asset.Digest);
|
||||
if (asset is null || !IsSha256Digest(expected)) return null;
|
||||
if (asset is null || !IsSameHttpsOrigin(asset.BrowserDownloadUrl, sourceUri) ||
|
||||
(asset.Digest is not null && !IsSha256Digest(expected))) return null;
|
||||
try
|
||||
{
|
||||
using var response = await client.GetAsync(asset.BrowserDownloadUrl,
|
||||
HttpCompletionOption.ResponseHeadersRead, ct);
|
||||
if (!response.IsSuccessStatusCode || response.Content.Headers.ContentLength is long length && length > maxBytes)
|
||||
if (!response.IsSuccessStatusCode || response.Content.Headers.ContentLength is long length && length > maxBytes ||
|
||||
response.RequestMessage?.RequestUri is not { } finalUri || !IsSameHttpsOrigin(finalUri, sourceUri))
|
||||
return null;
|
||||
await using var stream = await response.Content.ReadAsStreamAsync(ct);
|
||||
using var buffer = new MemoryStream();
|
||||
@@ -294,29 +258,23 @@ public class UpdatesController : ControllerBase
|
||||
buffer.Write(chunk, 0, read);
|
||||
}
|
||||
var bytes = buffer.ToArray();
|
||||
return string.Equals(Convert.ToHexString(SHA256.HashData(bytes)), expected,
|
||||
return expected is null || string.Equals(Convert.ToHexString(SHA256.HashData(bytes)), expected,
|
||||
StringComparison.OrdinalIgnoreCase) ? bytes : null;
|
||||
}
|
||||
catch (OperationCanceledException) when (ct.IsCancellationRequested) { throw; }
|
||||
catch { return null; }
|
||||
}
|
||||
|
||||
private static bool IsValidContainerImageRepository(string? image) => image is { Length: > 0 and <= 255 }
|
||||
&& char.IsAsciiLetterOrDigit(image[0])
|
||||
&& image.All(c => char.IsAsciiLetterOrDigit(c) || c is '.' or '_' or ':' or '/' or '-')
|
||||
&& !image.Contains('@')
|
||||
&& !image.Any(char.IsWhiteSpace)
|
||||
&& !image.Split('/').Last().Contains(':');
|
||||
private static bool IsSameHttpsOrigin(string candidate, Uri sourceUri) =>
|
||||
Uri.TryCreate(candidate, UriKind.Absolute, out var candidateUri) && IsSameHttpsOrigin(candidateUri, sourceUri);
|
||||
|
||||
private static bool IsValidContainerImageDigest(string? digest) => digest is { Length: 71 }
|
||||
&& digest.StartsWith("sha256:", StringComparison.OrdinalIgnoreCase)
|
||||
&& digest[7..].All(Uri.IsHexDigit);
|
||||
private static bool IsSameHttpsOrigin(Uri candidateUri, Uri sourceUri) =>
|
||||
candidateUri.Scheme == Uri.UriSchemeHttps &&
|
||||
string.Equals(candidateUri.Host, sourceUri.Host, StringComparison.OrdinalIgnoreCase) &&
|
||||
candidateUri.Port == sourceUri.Port && string.IsNullOrEmpty(candidateUri.UserInfo) &&
|
||||
string.IsNullOrEmpty(candidateUri.Fragment);
|
||||
|
||||
private sealed class AgentImageManifest
|
||||
{
|
||||
[JsonPropertyName("image")] public string Image { get; init; } = string.Empty;
|
||||
[JsonPropertyName("digest")] public string Digest { get; init; } = string.Empty;
|
||||
}
|
||||
private static bool IsSha256Digest(string? value) => value is { Length: 64 } && value.All(Uri.IsHexDigit);
|
||||
|
||||
private async Task RefreshCacheAsync(string? source, CancellationToken ct)
|
||||
{
|
||||
|
||||
@@ -4071,6 +4071,9 @@
|
||||
<data name="SiteInstallPanel_InstallAndRun" xml:space="preserve">
|
||||
<value>Install and run</value>
|
||||
</data>
|
||||
<data name="SiteInstallPanel_LinuxSecretPrompt" xml:space="preserve">
|
||||
<value>At runtime, enter the Central HTTPS URL and then the site token (token input is hidden). These values are not included in the copied command.</value>
|
||||
</data>
|
||||
<data name="SiteInstallPanel_Run" xml:space="preserve">
|
||||
<value>Run</value>
|
||||
</data>
|
||||
@@ -4078,7 +4081,7 @@
|
||||
<value>Check</value>
|
||||
</data>
|
||||
<data name="SiteInstallPanel_DockerUpdateNote" xml:space="preserve">
|
||||
<value>Docker installation uses the latest image. Updates dispatched by Central verify the signed digest before replacing the Agent. Docker mode mounts the host Docker socket, giving the Agent broad control of that host. On Linux, before Compose, set DOCKER_GID to the socket GID: export DOCKER_GID="$(stat -c '%g' /var/run/docker.sock)".</value>
|
||||
<value>Docker installation pins the CPU or GPU Agent image to the signed repository@sha256:digest. Updates dispatched by Central verify the signed digest before replacing the Agent. Docker mode mounts the host Docker socket, giving the Agent broad control of that host. On Linux, before Compose, set DOCKER_GID to the socket GID: export DOCKER_GID="$(stat -c '%g' /var/run/docker.sock)".</value>
|
||||
</data>
|
||||
<data name="SiteInstallPanel_WindowsConsoleNote" xml:space="preserve">
|
||||
<value>The Agent starts in the background so you can check it from this PowerShell session. Choose Windows Service to restart it after logoff or reboot.</value>
|
||||
|
||||
@@ -4071,6 +4071,9 @@
|
||||
<data name="SiteInstallPanel_InstallAndRun" xml:space="preserve">
|
||||
<value>Installer et lancer</value>
|
||||
</data>
|
||||
<data name="SiteInstallPanel_LinuxSecretPrompt" xml:space="preserve">
|
||||
<value>À l’exécution, saisissez l’URL HTTPS de Central puis le token du site (la saisie du token est masquée). Ces valeurs ne sont pas incluses dans la commande copiée.</value>
|
||||
</data>
|
||||
<data name="SiteInstallPanel_Run" xml:space="preserve">
|
||||
<value>Lancer</value>
|
||||
</data>
|
||||
|
||||
@@ -4071,6 +4071,9 @@
|
||||
<data name="SiteInstallPanel_InstallAndRun" xml:space="preserve">
|
||||
<value>Install and run</value>
|
||||
</data>
|
||||
<data name="SiteInstallPanel_LinuxSecretPrompt" xml:space="preserve">
|
||||
<value>At runtime, enter the Central HTTPS URL and then the site token (token input is hidden). These values are not included in the copied command.</value>
|
||||
</data>
|
||||
<data name="SiteInstallPanel_Run" xml:space="preserve">
|
||||
<value>Run</value>
|
||||
</data>
|
||||
@@ -4078,7 +4081,7 @@
|
||||
<value>Check</value>
|
||||
</data>
|
||||
<data name="SiteInstallPanel_DockerUpdateNote" xml:space="preserve">
|
||||
<value>Docker installation uses the latest image. Updates dispatched by Central verify the signed digest before replacing the Agent. Docker mode mounts the host Docker socket, giving the Agent broad control of that host. On Linux, before Compose, set DOCKER_GID to the socket GID: export DOCKER_GID="$(stat -c '%g' /var/run/docker.sock)".</value>
|
||||
<value>Docker installation pins the CPU or GPU Agent image to the signed repository@sha256:digest. Updates dispatched by Central verify the signed digest before replacing the Agent. Docker mode mounts the host Docker socket, giving the Agent broad control of that host. On Linux, before Compose, set DOCKER_GID to the socket GID: export DOCKER_GID="$(stat -c '%g' /var/run/docker.sock)".</value>
|
||||
</data>
|
||||
<data name="SiteInstallPanel_WindowsConsoleNote" xml:space="preserve">
|
||||
<value>The Agent starts in the background so you can check it from this PowerShell session. Choose Windows Service to restart it after logoff or reboot.</value>
|
||||
|
||||
@@ -17,6 +17,7 @@ using Heimdall.Api.Hubs;
|
||||
using Heimdall.Api;
|
||||
using Heimdall.Web.Services;
|
||||
using Heimdall.Web;
|
||||
using Heimdall.Web.Security;
|
||||
using Hangfire;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||
@@ -822,18 +823,14 @@ public partial class Program
|
||||
options.SetBeforeSend(static (sentryEvent, _) =>
|
||||
{
|
||||
sentryEvent.ServerName = null;
|
||||
if (sentryEvent.Extra?.ContainsKey("password") == true)
|
||||
(sentryEvent.Extra as IDictionary<string, object?>)?.Remove("password");
|
||||
if (sentryEvent.Extra?.ContainsKey("token") == true)
|
||||
(sentryEvent.Extra as IDictionary<string, object?>)?.Remove("token");
|
||||
if (sentryEvent.Extra?.ContainsKey("secret") == true)
|
||||
(sentryEvent.Extra as IDictionary<string, object?>)?.Remove("secret");
|
||||
return sentryEvent;
|
||||
return SentryTelemetryPrivacy.Sanitize(sentryEvent);
|
||||
});
|
||||
options.SetBeforeSendTransaction(static (transaction, _) =>
|
||||
SentryTelemetryPrivacy.Sanitize(transaction));
|
||||
options.SetBeforeBreadcrumb(breadcrumb
|
||||
=> breadcrumb.Category == "Microsoft.AspNetCore.RateLimiting"
|
||||
? null
|
||||
: breadcrumb);
|
||||
: SentryTelemetryPrivacy.SanitizeBreadcrumb(breadcrumb));
|
||||
}
|
||||
|
||||
internal static void ConfigureMiddleware(WebApplication app)
|
||||
|
||||
@@ -0,0 +1,230 @@
|
||||
using Sentry;
|
||||
|
||||
namespace Heimdall.Web.Security;
|
||||
|
||||
/// <summary>Removes authentication material from request data before error telemetry is sent.</summary>
|
||||
internal static class SentryTelemetryPrivacy
|
||||
{
|
||||
private const string Redacted = "[Filtered]";
|
||||
|
||||
internal static SentryEvent Sanitize(SentryEvent sentryEvent)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(sentryEvent);
|
||||
|
||||
SanitizeRequest(sentryEvent.Request);
|
||||
SanitizeContexts(sentryEvent.Contexts);
|
||||
|
||||
foreach (var key in sentryEvent.Tags.Keys.ToArray())
|
||||
{
|
||||
if (IsSensitiveName(key))
|
||||
sentryEvent.SetTag(key, Redacted);
|
||||
}
|
||||
|
||||
if (sentryEvent.Extra is IDictionary<string, object?> extra)
|
||||
RedactObjectValues(extra);
|
||||
|
||||
return sentryEvent;
|
||||
}
|
||||
|
||||
internal static SentryTransaction Sanitize(SentryTransaction transaction)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(transaction);
|
||||
|
||||
SanitizeRequest(transaction.Request);
|
||||
SanitizeContexts(transaction.Contexts);
|
||||
RedactObjectValues(transaction.Data, transaction.SetData);
|
||||
|
||||
foreach (var key in transaction.Tags.Keys.ToArray())
|
||||
{
|
||||
if (IsSensitiveName(key))
|
||||
transaction.SetTag(key, Redacted);
|
||||
}
|
||||
|
||||
if (transaction.Breadcrumbs is IList<Breadcrumb> breadcrumbs)
|
||||
{
|
||||
for (var index = 0; index < breadcrumbs.Count; index++)
|
||||
breadcrumbs[index] = SanitizeBreadcrumb(breadcrumbs[index]);
|
||||
}
|
||||
|
||||
foreach (var span in transaction.Spans)
|
||||
{
|
||||
RedactObjectValues(span.Data, span.SetData);
|
||||
foreach (var key in span.Tags.Keys.ToArray())
|
||||
{
|
||||
if (IsSensitiveName(key))
|
||||
span.SetTag(key, Redacted);
|
||||
}
|
||||
}
|
||||
|
||||
return transaction;
|
||||
}
|
||||
|
||||
internal static Breadcrumb SanitizeBreadcrumb(Breadcrumb breadcrumb)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(breadcrumb);
|
||||
if (breadcrumb.Data is IDictionary<string, string> mutableData)
|
||||
{
|
||||
RedactStringValues(mutableData);
|
||||
return breadcrumb;
|
||||
}
|
||||
|
||||
var data = breadcrumb.Data?.ToDictionary(
|
||||
pair => pair.Key,
|
||||
pair => IsSensitiveName(pair.Key) ? Redacted : pair.Value,
|
||||
StringComparer.Ordinal);
|
||||
return new Breadcrumb(
|
||||
breadcrumb.Message ?? string.Empty,
|
||||
breadcrumb.Type ?? string.Empty,
|
||||
data,
|
||||
breadcrumb.Category,
|
||||
breadcrumb.Level);
|
||||
}
|
||||
|
||||
private static void RedactStringValues(IDictionary<string, string>? values)
|
||||
{
|
||||
if (values is null)
|
||||
return;
|
||||
|
||||
foreach (var key in values.Keys.ToArray())
|
||||
{
|
||||
if (IsSensitiveName(key))
|
||||
values[key] = Redacted;
|
||||
}
|
||||
}
|
||||
|
||||
private static void SanitizeRequest(SentryRequest? request)
|
||||
{
|
||||
if (request is null)
|
||||
return;
|
||||
|
||||
RedactStringValues(request.Headers);
|
||||
RedactStringValues(request.Env);
|
||||
RedactStringValues(request.Other);
|
||||
request.Cookies = null;
|
||||
request.Url = StripQueryAndUserInfo(request.Url);
|
||||
request.QueryString = null;
|
||||
request.Data = null;
|
||||
}
|
||||
|
||||
private static void SanitizeContexts(SentryContexts contexts)
|
||||
{
|
||||
RedactObjectValues(contexts.Trace.Data, contexts.Trace.SetData);
|
||||
RedactStringValues(contexts.Response.Headers);
|
||||
contexts.Response.Cookies = null;
|
||||
contexts.Response.Data = null;
|
||||
|
||||
foreach (var key in contexts.Keys.ToArray())
|
||||
{
|
||||
if (key is "trace" or "response")
|
||||
continue;
|
||||
|
||||
if (IsSensitiveName(key))
|
||||
contexts[key] = Redacted;
|
||||
else
|
||||
contexts[key] = RedactValue(contexts[key])!;
|
||||
}
|
||||
}
|
||||
|
||||
private static void RedactObjectValues(IDictionary<string, object?> values)
|
||||
{
|
||||
foreach (var key in values.Keys.ToArray())
|
||||
{
|
||||
if (IsSensitiveName(key))
|
||||
{
|
||||
values[key] = Redacted;
|
||||
continue;
|
||||
}
|
||||
|
||||
values[key] = RedactValue(values[key]);
|
||||
}
|
||||
}
|
||||
|
||||
private static void RedactObjectValues(
|
||||
IReadOnlyDictionary<string, object?> values,
|
||||
Action<string, object?> setValue)
|
||||
{
|
||||
foreach (var key in values.Keys.ToArray())
|
||||
{
|
||||
if (IsSensitiveName(key))
|
||||
{
|
||||
setValue(key, Redacted);
|
||||
continue;
|
||||
}
|
||||
|
||||
setValue(key, RedactValue(values[key])!);
|
||||
}
|
||||
}
|
||||
|
||||
private static object? RedactValue(object? value)
|
||||
{
|
||||
if (value is IDictionary<string, object?> mutableDictionary)
|
||||
{
|
||||
RedactObjectValues(mutableDictionary);
|
||||
return value;
|
||||
}
|
||||
|
||||
if (value is IReadOnlyDictionary<string, object?> readOnlyDictionary)
|
||||
{
|
||||
var sanitized = new Dictionary<string, object?>(StringComparer.Ordinal);
|
||||
foreach (var pair in readOnlyDictionary)
|
||||
sanitized[pair.Key] = IsSensitiveName(pair.Key) ? Redacted : RedactValue(pair.Value);
|
||||
return sanitized;
|
||||
}
|
||||
|
||||
if (value is System.Collections.IDictionary dictionary)
|
||||
{
|
||||
var sanitized = new Dictionary<string, object?>(StringComparer.Ordinal);
|
||||
foreach (System.Collections.DictionaryEntry entry in dictionary)
|
||||
{
|
||||
if (entry.Key is not string key)
|
||||
return Redacted;
|
||||
sanitized[key] = IsSensitiveName(key) ? Redacted : RedactValue(entry.Value);
|
||||
}
|
||||
return sanitized;
|
||||
}
|
||||
|
||||
if (value is System.Collections.IEnumerable and not string)
|
||||
return Redacted;
|
||||
|
||||
// Arbitrary objects may serialize properties containing credentials under unknown names.
|
||||
// Keep primitive values; discard unsupported object graphs rather than emit them unsanitized.
|
||||
return value is null or string or bool or byte or sbyte or short or ushort or int or uint or long or ulong or float or double or decimal
|
||||
? value
|
||||
: Redacted;
|
||||
}
|
||||
|
||||
private static bool IsSensitiveName(string name)
|
||||
{
|
||||
var normalized = name.Replace("-", string.Empty, StringComparison.Ordinal)
|
||||
.Replace("_", string.Empty, StringComparison.Ordinal);
|
||||
|
||||
return normalized.Contains("authorization", StringComparison.OrdinalIgnoreCase) ||
|
||||
normalized.Contains("apikey", StringComparison.OrdinalIgnoreCase) ||
|
||||
normalized.Contains("token", StringComparison.OrdinalIgnoreCase) ||
|
||||
normalized.Contains("secret", StringComparison.OrdinalIgnoreCase) ||
|
||||
normalized.Contains("password", StringComparison.OrdinalIgnoreCase) ||
|
||||
normalized.Contains("credential", StringComparison.OrdinalIgnoreCase) ||
|
||||
normalized.Contains("cookie", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
private static string? StripQueryAndUserInfo(string? url)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(url))
|
||||
return url;
|
||||
|
||||
if (Uri.TryCreate(url, UriKind.Absolute, out var uri))
|
||||
{
|
||||
var builder = new UriBuilder(uri)
|
||||
{
|
||||
UserName = string.Empty,
|
||||
Password = string.Empty,
|
||||
Query = string.Empty,
|
||||
Fragment = string.Empty,
|
||||
};
|
||||
return builder.Uri.GetLeftPart(UriPartial.Path);
|
||||
}
|
||||
|
||||
var queryStart = url.IndexOfAny(['?', '#']);
|
||||
return queryStart >= 0 ? url[..queryStart] : url;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
using System.Security.Cryptography;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Heimdall.Web.Services;
|
||||
|
||||
/// <summary>Verifies the signed Agent release metadata before Central exposes it to installers.</summary>
|
||||
public static class AgentReleaseManifestVerifier
|
||||
{
|
||||
private static readonly JsonSerializerOptions Json = new() { PropertyNameCaseInsensitive = true };
|
||||
|
||||
public static bool TryVerify(string publicKeyPem, byte[] manifestBytes, byte[] signatureBytes,
|
||||
string releaseTag, out AgentReleaseManifest? manifest)
|
||||
{
|
||||
manifest = null;
|
||||
if (string.IsNullOrWhiteSpace(publicKeyPem) || manifestBytes.Length is 0 or > 1_048_576 ||
|
||||
signatureBytes.Length is 0 or > 512 || string.IsNullOrWhiteSpace(releaseTag))
|
||||
return false;
|
||||
|
||||
try
|
||||
{
|
||||
using var verifier = ECDsa.Create();
|
||||
verifier.ImportFromPem(publicKeyPem);
|
||||
if (verifier.KeySize != 256 || !verifier.VerifyData(manifestBytes, signatureBytes,
|
||||
HashAlgorithmName.SHA256, DSASignatureFormat.Rfc3279DerSequence))
|
||||
return false;
|
||||
|
||||
var parsed = JsonSerializer.Deserialize<AgentReleaseManifest>(manifestBytes, Json);
|
||||
if (parsed is null || parsed.Assets is null ||
|
||||
!string.Equals(NormalizeVersion(parsed.Version), NormalizeVersion(releaseTag),
|
||||
StringComparison.Ordinal) || parsed.Assets.Count == 0 ||
|
||||
parsed.Assets.Any(asset => string.IsNullOrWhiteSpace(asset.Key) || asset.Value is null || !IsSha256(asset.Value)) ||
|
||||
!IsValidContainerImageRepository(parsed.ContainerImage) ||
|
||||
!IsValidContainerImageDigest(parsed.ContainerImageDigest) ||
|
||||
((parsed.ContainerImageGpu is null) != (parsed.ContainerImageGpuDigest is null)) ||
|
||||
(parsed.ContainerImageGpu is not null &&
|
||||
(!IsValidContainerImageRepository(parsed.ContainerImageGpu) ||
|
||||
!IsValidContainerImageDigest(parsed.ContainerImageGpuDigest))))
|
||||
return false;
|
||||
|
||||
manifest = parsed;
|
||||
return true;
|
||||
}
|
||||
catch (CryptographicException) { return false; }
|
||||
catch (ArgumentException) { return false; }
|
||||
catch (JsonException) { return false; }
|
||||
}
|
||||
|
||||
private static string NormalizeVersion(string value) => value.Trim().TrimStart('v', 'V');
|
||||
private static bool IsSha256(string value) => value.Length == 64 && value.All(Uri.IsHexDigit);
|
||||
private static bool IsValidContainerImageRepository(string? image) => image is { Length: > 0 and <= 255 }
|
||||
&& char.IsAsciiLetterOrDigit(image[0])
|
||||
&& image.All(c => char.IsAsciiLetterOrDigit(c) || c is '.' or '_' or ':' or '/' or '-')
|
||||
&& !image.Contains('@') && !image.Any(char.IsWhiteSpace) && !image.Split('/').Last().Contains(':');
|
||||
private static bool IsValidContainerImageDigest(string? digest) => digest is { Length: 71 }
|
||||
&& digest.StartsWith("sha256:", StringComparison.OrdinalIgnoreCase)
|
||||
&& digest[7..].All(Uri.IsHexDigit);
|
||||
}
|
||||
|
||||
public sealed class AgentReleaseManifest
|
||||
{
|
||||
[JsonPropertyName("version")] public string Version { get; init; } = string.Empty;
|
||||
[JsonPropertyName("assets")] public Dictionary<string, string> Assets { get; init; } = [];
|
||||
[JsonPropertyName("containerImage")] public string? ContainerImage { get; init; }
|
||||
[JsonPropertyName("containerImageDigest")] public string? ContainerImageDigest { get; init; }
|
||||
[JsonPropertyName("containerImageGpu")] public string? ContainerImageGpu { get; init; }
|
||||
[JsonPropertyName("containerImageGpuDigest")] public string? ContainerImageGpuDigest { get; init; }
|
||||
}
|
||||
@@ -142,8 +142,8 @@
|
||||
},
|
||||
"AutoMapper": {
|
||||
"type": "Transitive",
|
||||
"resolved": "16.1.1",
|
||||
"contentHash": "VNEky8JA15ci+oIDRGHITOGOpV4dILsf8pnn24QhDl2urtqgJ2IXiS/V2EtGU17P/+f6OeFQPJETaZXV9QOIZg==",
|
||||
"resolved": "16.3.0",
|
||||
"contentHash": "wFTqA37e1I4AOEhTTYlxrqDE8BQ4OB3dqhlv2KwYmHv+a4tn7R1JW2n2bzXb8eTBhWVBSl7iTZ0VxEt0a57D4w==",
|
||||
"dependencies": {
|
||||
"Microsoft.IdentityModel.JsonWebTokens": "8.14.0"
|
||||
}
|
||||
@@ -491,7 +491,7 @@
|
||||
"heimdall.application": {
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"AutoMapper": "[16.1.1, )",
|
||||
"AutoMapper": "[16.3.0, )",
|
||||
"FluentValidation": "[11.11.0, )",
|
||||
"FluentValidation.DependencyInjectionExtensions": "[11.11.0, )",
|
||||
"Heimdall.Domain": "[1.0.0, )",
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
namespace Heimdall.Agent.Tests;
|
||||
|
||||
[CollectionDefinition("AgentOptions environment", DisableParallelization = true)]
|
||||
public sealed class AgentOptionsEnvironmentScope
|
||||
{
|
||||
public const string Name = "AgentOptions environment";
|
||||
}
|
||||
|
||||
[Collection(AgentOptionsEnvironmentScope.Name)]
|
||||
public sealed class AgentOptionsTests
|
||||
{
|
||||
[Fact]
|
||||
public void CentralUrl_LoadsFromSystemdCredentialWhenNoEnvironmentSettingExists()
|
||||
{
|
||||
var previous = Environment.GetEnvironmentVariable("CREDENTIALS_DIRECTORY");
|
||||
var directory = Path.Combine(Path.GetTempPath(), $"heimdall-agent-options-{Guid.NewGuid():N}");
|
||||
Directory.CreateDirectory(directory);
|
||||
File.WriteAllText(Path.Combine(directory, "central-url"), "https://central.example.test\n");
|
||||
|
||||
try
|
||||
{
|
||||
Environment.SetEnvironmentVariable("CREDENTIALS_DIRECTORY", directory);
|
||||
new AgentOptions { }.CentralUrl.ShouldBe("https://central.example.test");
|
||||
}
|
||||
finally
|
||||
{
|
||||
Environment.SetEnvironmentVariable("CREDENTIALS_DIRECTORY", previous);
|
||||
Directory.Delete(directory, recursive: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -82,8 +82,8 @@
|
||||
},
|
||||
"AutoMapper": {
|
||||
"type": "Transitive",
|
||||
"resolved": "16.1.1",
|
||||
"contentHash": "VNEky8JA15ci+oIDRGHITOGOpV4dILsf8pnn24QhDl2urtqgJ2IXiS/V2EtGU17P/+f6OeFQPJETaZXV9QOIZg==",
|
||||
"resolved": "16.3.0",
|
||||
"contentHash": "wFTqA37e1I4AOEhTTYlxrqDE8BQ4OB3dqhlv2KwYmHv+a4tn7R1JW2n2bzXb8eTBhWVBSl7iTZ0VxEt0a57D4w==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "10.0.0",
|
||||
"Microsoft.Extensions.Options": "10.0.0",
|
||||
@@ -166,14 +166,6 @@
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "INZVBMOPbQC5xj1oTpwhELtokdH9LcY7oCsTVDEavziMpsoGJJPejax5WdFNfPeTMGq9eT6fL8GcVHeobvqORA=="
|
||||
},
|
||||
"Microsoft.AspNetCore.Cryptography.KeyDerivation": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "mt935Uji4EdglTPrgJrqHdXkWM2EI6d7V8fEfvlC+KevB16MtHUHGiaKycawlOJgbOMw1D9etbHIfLL2nnWV4Q==",
|
||||
"dependencies": {
|
||||
"Microsoft.AspNetCore.Cryptography.Internal": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.AspNetCore.DataProtection.Abstractions": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
@@ -197,15 +189,6 @@
|
||||
"Microsoft.AspNetCore.Connections.Abstractions": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "c6984ahCnqc3zqYgl5KqrBoY+LMKqJW6nZcFdBYNyp3PAA67prA/IgjQ/ySV0t3lEL2LEz3bcx91fbUYr8bRPA==",
|
||||
"dependencies": {
|
||||
"Microsoft.EntityFrameworkCore.Relational": "10.0.13",
|
||||
"Microsoft.Extensions.Identity.Stores": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.AspNetCore.SignalR.Client": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
@@ -543,27 +526,6 @@
|
||||
"Microsoft.Extensions.Options": "10.0.0"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Identity.Core": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "76aNRvI7HU9sYjevIlpFuT/VyspRoiREwOZI+RFXM/HRJ3v6nC7gxSZoX881FEBkF+0udKHuFxtsWbRLytqsSA==",
|
||||
"dependencies": {
|
||||
"Microsoft.AspNetCore.Cryptography.KeyDerivation": "10.0.13",
|
||||
"Microsoft.Extensions.Diagnostics": "10.0.13",
|
||||
"Microsoft.Extensions.Logging": "10.0.13",
|
||||
"Microsoft.Extensions.Options": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Identity.Stores": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "qNZr9maHa2Kg7mRh+hLEJ59ts2OfYMiJJ5GVjx8BDrmhPxx/V345CTdIrUcZ5FZwwHepITsZY0e9qss7NB2U5A==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Caching.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.Identity.Core": "10.0.13",
|
||||
"Microsoft.Extensions.Logging": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Logging": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
@@ -874,7 +836,10 @@
|
||||
"System.ServiceProcess.ServiceController": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "0Zh/U/1+hy1MCxx1BTikJi4L5o1Ys6VhB8PKlTNOB4/n2d6ua2+TuoD6T7xN9RV0uiOGod575pQrUSTXg+aYGQ=="
|
||||
"contentHash": "0Zh/U/1+hy1MCxx1BTikJi4L5o1Ys6VhB8PKlTNOB4/n2d6ua2+TuoD6T7xN9RV0uiOGod575pQrUSTXg+aYGQ==",
|
||||
"dependencies": {
|
||||
"System.Diagnostics.EventLog": "10.0.13"
|
||||
}
|
||||
},
|
||||
"xunit.abstractions": {
|
||||
"type": "Transitive",
|
||||
@@ -936,12 +901,11 @@
|
||||
"heimdall.application": {
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"AutoMapper": "[16.1.1, )",
|
||||
"AutoMapper": "[16.3.0, )",
|
||||
"FluentValidation": "[11.11.0, )",
|
||||
"FluentValidation.DependencyInjectionExtensions": "[11.11.0, )",
|
||||
"Heimdall.Domain": "[1.0.0, )",
|
||||
"MediatR": "[12.5.0, )",
|
||||
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "[10.0.13, )",
|
||||
"Microsoft.Data.Sqlite": "[10.0.13, )",
|
||||
"Microsoft.EntityFrameworkCore": "[10.0.13, )",
|
||||
"Microsoft.EntityFrameworkCore.Sqlite": "[10.0.13, )",
|
||||
@@ -954,8 +918,7 @@
|
||||
"heimdall.domain": {
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Heimdall.Domain.Primitives": "[1.0.0, )",
|
||||
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "[10.0.13, )"
|
||||
"Heimdall.Domain.Primitives": "[1.0.0, )"
|
||||
}
|
||||
},
|
||||
"heimdall.domain.primitives": {
|
||||
@@ -969,4 +932,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -56,8 +56,8 @@
|
||||
},
|
||||
"AutoMapper": {
|
||||
"type": "Transitive",
|
||||
"resolved": "16.1.1",
|
||||
"contentHash": "VNEky8JA15ci+oIDRGHITOGOpV4dILsf8pnn24QhDl2urtqgJ2IXiS/V2EtGU17P/+f6OeFQPJETaZXV9QOIZg==",
|
||||
"resolved": "16.3.0",
|
||||
"contentHash": "wFTqA37e1I4AOEhTTYlxrqDE8BQ4OB3dqhlv2KwYmHv+a4tn7R1JW2n2bzXb8eTBhWVBSl7iTZ0VxEt0a57D4w==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "10.0.0",
|
||||
"Microsoft.Extensions.Options": "10.0.0",
|
||||
@@ -1061,12 +1061,11 @@
|
||||
"heimdall.application": {
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"AutoMapper": "[16.1.1, )",
|
||||
"AutoMapper": "[16.3.0, )",
|
||||
"FluentValidation": "[11.11.0, )",
|
||||
"FluentValidation.DependencyInjectionExtensions": "[11.11.0, )",
|
||||
"Heimdall.Domain": "[1.0.0, )",
|
||||
"MediatR": "[12.5.0, )",
|
||||
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "[10.0.13, )",
|
||||
"Microsoft.Data.Sqlite": "[10.0.13, )",
|
||||
"Microsoft.EntityFrameworkCore": "[10.0.13, )",
|
||||
"Microsoft.EntityFrameworkCore.Sqlite": "[10.0.13, )",
|
||||
@@ -1079,8 +1078,7 @@
|
||||
"heimdall.domain": {
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Heimdall.Domain.Primitives": "[1.0.0, )",
|
||||
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "[10.0.13, )"
|
||||
"Heimdall.Domain.Primitives": "[1.0.0, )"
|
||||
}
|
||||
},
|
||||
"heimdall.domain.primitives": {
|
||||
|
||||
@@ -62,8 +62,8 @@
|
||||
},
|
||||
"AutoMapper": {
|
||||
"type": "Transitive",
|
||||
"resolved": "16.1.1",
|
||||
"contentHash": "VNEky8JA15ci+oIDRGHITOGOpV4dILsf8pnn24QhDl2urtqgJ2IXiS/V2EtGU17P/+f6OeFQPJETaZXV9QOIZg==",
|
||||
"resolved": "16.3.0",
|
||||
"contentHash": "wFTqA37e1I4AOEhTTYlxrqDE8BQ4OB3dqhlv2KwYmHv+a4tn7R1JW2n2bzXb8eTBhWVBSl7iTZ0VxEt0a57D4w==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "10.0.0",
|
||||
"Microsoft.Extensions.Options": "10.0.0",
|
||||
@@ -115,28 +115,6 @@
|
||||
"resolved": "2.0.1",
|
||||
"contentHash": "FYv95bNT4UwcNA+G/J1oX5OpRiSUxteXaUt2BJbRSdRNiIUNbggJF69wy6mnk2wYToaanpdXZdCwVylt96MpwQ=="
|
||||
},
|
||||
"Microsoft.AspNetCore.Cryptography.Internal": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "INZVBMOPbQC5xj1oTpwhELtokdH9LcY7oCsTVDEavziMpsoGJJPejax5WdFNfPeTMGq9eT6fL8GcVHeobvqORA=="
|
||||
},
|
||||
"Microsoft.AspNetCore.Cryptography.KeyDerivation": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "mt935Uji4EdglTPrgJrqHdXkWM2EI6d7V8fEfvlC+KevB16MtHUHGiaKycawlOJgbOMw1D9etbHIfLL2nnWV4Q==",
|
||||
"dependencies": {
|
||||
"Microsoft.AspNetCore.Cryptography.Internal": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "c6984ahCnqc3zqYgl5KqrBoY+LMKqJW6nZcFdBYNyp3PAA67prA/IgjQ/ySV0t3lEL2LEz3bcx91fbUYr8bRPA==",
|
||||
"dependencies": {
|
||||
"Microsoft.EntityFrameworkCore.Relational": "10.0.13",
|
||||
"Microsoft.Extensions.Identity.Stores": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.CodeCoverage": {
|
||||
"type": "Transitive",
|
||||
"resolved": "17.14.1",
|
||||
@@ -240,15 +218,6 @@
|
||||
"Microsoft.Extensions.Primitives": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Configuration": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "inhujYI/nikhmLxYI6ZEcaCgZ28ipJsKMPPxxr2XWf3vM0Q2P+E9R3hDHABZOLBxzD3gjpgcbSH/+hd2+gvI2A==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Configuration.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.Primitives": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Configuration.Abstractions": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
@@ -257,15 +226,6 @@
|
||||
"Microsoft.Extensions.Primitives": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Configuration.Binder": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "yJJl/b0+W+GEWbu+7viw6C3h2BoNkB69Vlz7s/4e+hm4mYbJqfhdcDSi9sCXJw47blsBaiQd3UDPgDtop92+ug==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Configuration": "10.0.13",
|
||||
"Microsoft.Extensions.Configuration.Abstractions": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.DependencyInjection": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
@@ -284,46 +244,6 @@
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "6TyllZsToy3S/Ziu67GddljRTttuVJ8bbrbVUrsdHqH5678Oax5MpaEubxLoPoWLvgUBYo4KfcAig0mkBtktXQ=="
|
||||
},
|
||||
"Microsoft.Extensions.Diagnostics": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "J9ODOrffj1mK3Et69elNsLGRguesPxvThTdVpFmQX7fLNPhIOgqHQfLdGnTBEwNAV3yf8yiyVlpDZNw2qN87Nw==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Configuration": "10.0.13",
|
||||
"Microsoft.Extensions.Diagnostics.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.Options.ConfigurationExtensions": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Diagnostics.Abstractions": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "oZzqZze8ed1fLS20HtIrkPxQXGRG/koq09srIw2ptnDHm9RHfwB++d35hosB/cXc55TH7Pshv85O0txongjCIg==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.Options": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Identity.Core": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "76aNRvI7HU9sYjevIlpFuT/VyspRoiREwOZI+RFXM/HRJ3v6nC7gxSZoX881FEBkF+0udKHuFxtsWbRLytqsSA==",
|
||||
"dependencies": {
|
||||
"Microsoft.AspNetCore.Cryptography.KeyDerivation": "10.0.13",
|
||||
"Microsoft.Extensions.Diagnostics": "10.0.13",
|
||||
"Microsoft.Extensions.Logging": "10.0.13",
|
||||
"Microsoft.Extensions.Options": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Identity.Stores": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "qNZr9maHa2Kg7mRh+hLEJ59ts2OfYMiJJ5GVjx8BDrmhPxx/V345CTdIrUcZ5FZwwHepITsZY0e9qss7NB2U5A==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Caching.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.Identity.Core": "10.0.13",
|
||||
"Microsoft.Extensions.Logging": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Logging": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
@@ -351,18 +271,6 @@
|
||||
"Microsoft.Extensions.Primitives": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Options.ConfigurationExtensions": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "xVO5HhATc09WXuS/RaDmx8ZeWS0mTpT1L0tkEDMSBHtAnNpNsDr0ge0wIO2jinCWWqpq5dL1tRTzpYNVlvyqLw==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Configuration.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.Configuration.Binder": "10.0.13",
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.Options": "10.0.13",
|
||||
"Microsoft.Extensions.Primitives": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Primitives": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
@@ -513,12 +421,11 @@
|
||||
"heimdall.application": {
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"AutoMapper": "[16.1.1, )",
|
||||
"AutoMapper": "[16.3.0, )",
|
||||
"FluentValidation": "[11.11.0, )",
|
||||
"FluentValidation.DependencyInjectionExtensions": "[11.11.0, )",
|
||||
"Heimdall.Domain": "[1.0.0, )",
|
||||
"MediatR": "[12.5.0, )",
|
||||
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "[10.0.13, )",
|
||||
"Microsoft.Data.Sqlite": "[10.0.13, )",
|
||||
"Microsoft.EntityFrameworkCore": "[10.0.13, )",
|
||||
"Microsoft.EntityFrameworkCore.Sqlite": "[10.0.13, )",
|
||||
@@ -528,8 +435,7 @@
|
||||
"heimdall.domain": {
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Heimdall.Domain.Primitives": "[1.0.0, )",
|
||||
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "[10.0.13, )"
|
||||
"Heimdall.Domain.Primitives": "[1.0.0, )"
|
||||
}
|
||||
},
|
||||
"heimdall.domain.primitives": {
|
||||
|
||||
@@ -76,208 +76,11 @@
|
||||
"resolved": "4.4.0",
|
||||
"contentHash": "gwJEfIGS7FhykvtZoscwXj/XwW+mJY6UbAZk+qtLKFUGWC95kfKXnj8VkxsZQnWBxJemM/q664rGLN5nf+OHZw=="
|
||||
},
|
||||
"Microsoft.AspNetCore.Cryptography.Internal": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "INZVBMOPbQC5xj1oTpwhELtokdH9LcY7oCsTVDEavziMpsoGJJPejax5WdFNfPeTMGq9eT6fL8GcVHeobvqORA=="
|
||||
},
|
||||
"Microsoft.AspNetCore.Cryptography.KeyDerivation": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "mt935Uji4EdglTPrgJrqHdXkWM2EI6d7V8fEfvlC+KevB16MtHUHGiaKycawlOJgbOMw1D9etbHIfLL2nnWV4Q==",
|
||||
"dependencies": {
|
||||
"Microsoft.AspNetCore.Cryptography.Internal": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "c6984ahCnqc3zqYgl5KqrBoY+LMKqJW6nZcFdBYNyp3PAA67prA/IgjQ/ySV0t3lEL2LEz3bcx91fbUYr8bRPA==",
|
||||
"dependencies": {
|
||||
"Microsoft.EntityFrameworkCore.Relational": "10.0.13",
|
||||
"Microsoft.Extensions.Identity.Stores": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.CodeCoverage": {
|
||||
"type": "Transitive",
|
||||
"resolved": "17.14.1",
|
||||
"contentHash": "pmTrhfFIoplzFVbhVwUquT+77CbGH+h4/3mBpdmIlYtBi9nAB+kKI6dN3A/nV4DFi3wLLx/BlHIPK+MkbQ6Tpg=="
|
||||
},
|
||||
"Microsoft.EntityFrameworkCore": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "u/z4nTQUJ5nJEXAQekgQEQZkh0delp4gL+ESHn7Z6k037c8HC5mSNu1/YdBgxGm7DtLjhOxktNl+aQMzw6wN7A==",
|
||||
"dependencies": {
|
||||
"Microsoft.EntityFrameworkCore.Abstractions": "10.0.13",
|
||||
"Microsoft.EntityFrameworkCore.Analyzers": "10.0.13",
|
||||
"Microsoft.Extensions.Caching.Memory": "10.0.13",
|
||||
"Microsoft.Extensions.Logging": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.EntityFrameworkCore.Abstractions": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "ARw+tZ3eiTosnK5nJPUGEzeUQcjyqCqs3qKA3lPtIRH5yJo3qIgxm7AvkZVIT9iWkS2083UsWe3Rj1MysW3p5A=="
|
||||
},
|
||||
"Microsoft.EntityFrameworkCore.Analyzers": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "zBx6VeEz/hkhlm0BJ2V+9xebUuDDIszcKvurJceQHuZPEXuXubrL6Lneo9VZiliRyJbQlB2oNKLkJXd3gHteQA=="
|
||||
},
|
||||
"Microsoft.EntityFrameworkCore.Relational": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "QU/sbTtDR5wVAJRVecC1GwM7mwH8bvKOZNm+lulzMr5rhjdb8DDEFIqqdhF08JIo51DPv5uQdZ1nXoZsD5pTag==",
|
||||
"dependencies": {
|
||||
"Microsoft.EntityFrameworkCore": "10.0.13",
|
||||
"Microsoft.Extensions.Caching.Memory": "10.0.13",
|
||||
"Microsoft.Extensions.Configuration.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.Logging": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Caching.Abstractions": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "UOJqcdNMoFcV/5RUcOlVKq9pPmbrcmbpLx5iYz9QtrmMcWRQzlL5Q/NZRfbPPLNyIEc1HWjjs5Z7nIwqewU1sg==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Primitives": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Caching.Memory": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "q+At65RACuCtGwUDVI08TmmrC73YFouimMkJAtlhsGhFcU/dVpqYEKpNBOF9TUxkJ6aefEOShqe7StLK7q3NqA==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Caching.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.Logging.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.Options": "10.0.13",
|
||||
"Microsoft.Extensions.Primitives": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Configuration": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "inhujYI/nikhmLxYI6ZEcaCgZ28ipJsKMPPxxr2XWf3vM0Q2P+E9R3hDHABZOLBxzD3gjpgcbSH/+hd2+gvI2A==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Configuration.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.Primitives": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Configuration.Abstractions": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "DY4C2qzTt2lOIY3VoscBH/TCwTolI5DKOfgJLuI+k1QUvRNT5vTMS58AOerNiihdVRStO0wEpLeRWA8jytzHBQ==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Primitives": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Configuration.Binder": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "yJJl/b0+W+GEWbu+7viw6C3h2BoNkB69Vlz7s/4e+hm4mYbJqfhdcDSi9sCXJw47blsBaiQd3UDPgDtop92+ug==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Configuration": "10.0.13",
|
||||
"Microsoft.Extensions.Configuration.Abstractions": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.DependencyInjection": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "4tnWU9vrU/A8NwYe9Z6wvieZ0EBb/uM82LAT+edNhdepOBWREZ7M7mzb941EIDPJaeOFdbVrDd5+7s9e89U6bQ==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "G2GrGWNAPZBsii2F6AU8n+JT2tC1/I0Ml/e9ZyNCgPjf3hZqronP7o0X91aAynCmVeae8KkSIUNXXeXCNRmdVQ=="
|
||||
},
|
||||
"Microsoft.Extensions.Diagnostics": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "J9ODOrffj1mK3Et69elNsLGRguesPxvThTdVpFmQX7fLNPhIOgqHQfLdGnTBEwNAV3yf8yiyVlpDZNw2qN87Nw==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Configuration": "10.0.13",
|
||||
"Microsoft.Extensions.Diagnostics.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.Options.ConfigurationExtensions": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Diagnostics.Abstractions": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "oZzqZze8ed1fLS20HtIrkPxQXGRG/koq09srIw2ptnDHm9RHfwB++d35hosB/cXc55TH7Pshv85O0txongjCIg==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.Options": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Identity.Core": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "76aNRvI7HU9sYjevIlpFuT/VyspRoiREwOZI+RFXM/HRJ3v6nC7gxSZoX881FEBkF+0udKHuFxtsWbRLytqsSA==",
|
||||
"dependencies": {
|
||||
"Microsoft.AspNetCore.Cryptography.KeyDerivation": "10.0.13",
|
||||
"Microsoft.Extensions.Diagnostics": "10.0.13",
|
||||
"Microsoft.Extensions.Logging": "10.0.13",
|
||||
"Microsoft.Extensions.Options": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Identity.Stores": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "qNZr9maHa2Kg7mRh+hLEJ59ts2OfYMiJJ5GVjx8BDrmhPxx/V345CTdIrUcZ5FZwwHepITsZY0e9qss7NB2U5A==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Caching.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.Identity.Core": "10.0.13",
|
||||
"Microsoft.Extensions.Logging": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Logging": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "fqbiPy4nUp4H2XHKAVQXKN2y3T2h4cFIx1DAAgE6iY9OHkN/OA1cKFi+geJKRWGuX6pS5SFbsjIPWHJqrxE0eg==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.DependencyInjection": "10.0.13",
|
||||
"Microsoft.Extensions.Logging.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.Options": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Logging.Abstractions": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "aSZEhEig4fvNiw2zs8Z6NyDlniKtq6YjcF3DyHuqTEHcZ2VKA/6itMPZ+dW+yWABWExlDcQwwdbqX1Rcb7W8WQ==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Options": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "tmMJgdrE4uhf1JcNs9CV9moAHW+hmDuvgMiPpnQxarKaUxqI2eN33sYK5S4l9Uw+rG9PJvlm4qPxMhvolTDTaQ==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.Primitives": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Options.ConfigurationExtensions": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "xVO5HhATc09WXuS/RaDmx8ZeWS0mTpT1L0tkEDMSBHtAnNpNsDr0ge0wIO2jinCWWqpq5dL1tRTzpYNVlvyqLw==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Configuration.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.Configuration.Binder": "10.0.13",
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.13",
|
||||
"Microsoft.Extensions.Options": "10.0.13",
|
||||
"Microsoft.Extensions.Primitives": "10.0.13"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.Primitives": {
|
||||
"type": "Transitive",
|
||||
"resolved": "10.0.13",
|
||||
"contentHash": "ZjTwxzhiw2TMEzIbUDkMF0dfDB2I4NQgIfKD0ELu9/5Mk+SRGdKZcD0/lvBrRCAPo6KN2r0BW86MRancoyJkoA=="
|
||||
},
|
||||
"Microsoft.TestPlatform.ObjectModel": {
|
||||
"type": "Transitive",
|
||||
"resolved": "17.14.1",
|
||||
@@ -358,8 +161,7 @@
|
||||
"heimdall.domain": {
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Heimdall.Domain.Primitives": "[1.0.0, )",
|
||||
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "[10.0.13, )"
|
||||
"Heimdall.Domain.Primitives": "[1.0.0, )"
|
||||
}
|
||||
},
|
||||
"heimdall.domain.primitives": {
|
||||
|
||||
@@ -104,7 +104,12 @@ public class UserManagementTests : E2ETestBase
|
||||
using var cleanup = new HttpClient { BaseAddress = new Uri(BaseUrl) };
|
||||
cleanup.DefaultRequestHeaders.Authorization = new("Bearer", token);
|
||||
var deleteResponse = await cleanup.DeleteAsync($"/api/users/{body.GetProperty("user").GetProperty("id").GetString()}");
|
||||
deleteResponse.StatusCode.ShouldBeOneOf(HttpStatusCode.OK, HttpStatusCode.NoContent);
|
||||
var deleteError = await deleteResponse.Content.ReadAsStringAsync();
|
||||
deleteError = deleteError.Replace(email, "[email]", StringComparison.Ordinal)
|
||||
.Replace(password, "[password]", StringComparison.Ordinal);
|
||||
if (deleteResponse.StatusCode is not (HttpStatusCode.OK or HttpStatusCode.NoContent))
|
||||
throw new InvalidOperationException(
|
||||
$"Viewer/Supervisor cleanup failed with HTTP {(int)deleteResponse.StatusCode}: {deleteError}");
|
||||
}
|
||||
|
||||
private static async Task SelectCreateRoleAsync(ILocator dialog, string role)
|
||||
|
||||
@@ -74,8 +74,8 @@
|
||||
},
|
||||
"AutoMapper": {
|
||||
"type": "Transitive",
|
||||
"resolved": "16.1.1",
|
||||
"contentHash": "VNEky8JA15ci+oIDRGHITOGOpV4dILsf8pnn24QhDl2urtqgJ2IXiS/V2EtGU17P/+f6OeFQPJETaZXV9QOIZg==",
|
||||
"resolved": "16.3.0",
|
||||
"contentHash": "wFTqA37e1I4AOEhTTYlxrqDE8BQ4OB3dqhlv2KwYmHv+a4tn7R1JW2n2bzXb8eTBhWVBSl7iTZ0VxEt0a57D4w==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "10.0.0",
|
||||
"Microsoft.Extensions.Options": "10.0.0",
|
||||
@@ -1335,12 +1335,11 @@
|
||||
"heimdall.application": {
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"AutoMapper": "[16.1.1, )",
|
||||
"AutoMapper": "[16.3.0, )",
|
||||
"FluentValidation": "[11.11.0, )",
|
||||
"FluentValidation.DependencyInjectionExtensions": "[11.11.0, )",
|
||||
"Heimdall.Domain": "[1.0.0, )",
|
||||
"MediatR": "[12.5.0, )",
|
||||
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "[10.0.13, )",
|
||||
"Microsoft.Data.Sqlite": "[10.0.13, )",
|
||||
"Microsoft.EntityFrameworkCore": "[10.0.13, )",
|
||||
"Microsoft.EntityFrameworkCore.Sqlite": "[10.0.13, )",
|
||||
@@ -1353,8 +1352,7 @@
|
||||
"heimdall.domain": {
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Heimdall.Domain.Primitives": "[1.0.0, )",
|
||||
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "[10.0.13, )"
|
||||
"Heimdall.Domain.Primitives": "[1.0.0, )"
|
||||
}
|
||||
},
|
||||
"heimdall.domain.primitives": {
|
||||
|
||||
@@ -77,8 +77,8 @@
|
||||
},
|
||||
"AutoMapper": {
|
||||
"type": "Transitive",
|
||||
"resolved": "16.1.1",
|
||||
"contentHash": "VNEky8JA15ci+oIDRGHITOGOpV4dILsf8pnn24QhDl2urtqgJ2IXiS/V2EtGU17P/+f6OeFQPJETaZXV9QOIZg==",
|
||||
"resolved": "16.3.0",
|
||||
"contentHash": "wFTqA37e1I4AOEhTTYlxrqDE8BQ4OB3dqhlv2KwYmHv+a4tn7R1JW2n2bzXb8eTBhWVBSl7iTZ0VxEt0a57D4w==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "10.0.0",
|
||||
"Microsoft.Extensions.Options": "10.0.0",
|
||||
@@ -876,12 +876,11 @@
|
||||
"heimdall.application": {
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"AutoMapper": "[16.1.1, )",
|
||||
"AutoMapper": "[16.3.0, )",
|
||||
"FluentValidation": "[11.11.0, )",
|
||||
"FluentValidation.DependencyInjectionExtensions": "[11.11.0, )",
|
||||
"Heimdall.Domain": "[1.0.0, )",
|
||||
"MediatR": "[12.5.0, )",
|
||||
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "[10.0.13, )",
|
||||
"Microsoft.Data.Sqlite": "[10.0.13, )",
|
||||
"Microsoft.EntityFrameworkCore": "[10.0.13, )",
|
||||
"Microsoft.EntityFrameworkCore.Sqlite": "[10.0.13, )",
|
||||
@@ -905,8 +904,7 @@
|
||||
"heimdall.domain": {
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Heimdall.Domain.Primitives": "[1.0.0, )",
|
||||
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "[10.0.13, )"
|
||||
"Heimdall.Domain.Primitives": "[1.0.0, )"
|
||||
}
|
||||
},
|
||||
"heimdall.domain.primitives": {
|
||||
|
||||
@@ -67,8 +67,8 @@
|
||||
},
|
||||
"AutoMapper": {
|
||||
"type": "Transitive",
|
||||
"resolved": "16.1.1",
|
||||
"contentHash": "VNEky8JA15ci+oIDRGHITOGOpV4dILsf8pnn24QhDl2urtqgJ2IXiS/V2EtGU17P/+f6OeFQPJETaZXV9QOIZg==",
|
||||
"resolved": "16.3.0",
|
||||
"contentHash": "wFTqA37e1I4AOEhTTYlxrqDE8BQ4OB3dqhlv2KwYmHv+a4tn7R1JW2n2bzXb8eTBhWVBSl7iTZ0VxEt0a57D4w==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "10.0.0",
|
||||
"Microsoft.Extensions.Options": "10.0.0",
|
||||
@@ -1310,12 +1310,11 @@
|
||||
"heimdall.application": {
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"AutoMapper": "[16.1.1, )",
|
||||
"AutoMapper": "[16.3.0, )",
|
||||
"FluentValidation": "[11.11.0, )",
|
||||
"FluentValidation.DependencyInjectionExtensions": "[11.11.0, )",
|
||||
"Heimdall.Domain": "[1.0.0, )",
|
||||
"MediatR": "[12.5.0, )",
|
||||
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "[10.0.13, )",
|
||||
"Microsoft.Data.Sqlite": "[10.0.13, )",
|
||||
"Microsoft.EntityFrameworkCore": "[10.0.13, )",
|
||||
"Microsoft.EntityFrameworkCore.Sqlite": "[10.0.13, )",
|
||||
@@ -1328,8 +1327,7 @@
|
||||
"heimdall.domain": {
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Heimdall.Domain.Primitives": "[1.0.0, )",
|
||||
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "[10.0.13, )"
|
||||
"Heimdall.Domain.Primitives": "[1.0.0, )"
|
||||
}
|
||||
},
|
||||
"heimdall.domain.primitives": {
|
||||
|
||||
@@ -82,7 +82,7 @@ public class SiteDetailTests : PageTestBase
|
||||
cut.Markup.ShouldContain("Agent__SiteToken");
|
||||
cut.Markup.ShouldContain("Régénérer");
|
||||
var compose = cut.Find("pre code").TextContent;
|
||||
compose.ShouldContain("image: registry.example/heimdall-agent:latest");
|
||||
compose.ShouldContain("image: registry.example/heimdall-agent@sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
compose.ShouldContain("pull_policy: always");
|
||||
compose.ShouldContain("network_mode: host");
|
||||
compose.ShouldContain("Agent__CentralUrl: \"http://localhost\"");
|
||||
@@ -95,7 +95,7 @@ public class SiteDetailTests : PageTestBase
|
||||
var agent = GetAgentService(ParseCompose(compose));
|
||||
agent.Children.ShouldNotContainKey(new YamlScalarNode("deploy"));
|
||||
((YamlScalarNode)agent.Children[new YamlScalarNode("image")]).Value
|
||||
.ShouldBe("registry.example/heimdall-agent:latest");
|
||||
.ShouldBe("registry.example/heimdall-agent@sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
((YamlScalarNode)agent.Children[new YamlScalarNode("pull_policy")]).Value.ShouldBe("always");
|
||||
var volumes = (YamlSequenceNode)agent.Children[new YamlScalarNode("volumes")];
|
||||
volumes.Children.Select(node => ((YamlScalarNode)node).Value)
|
||||
@@ -112,12 +112,12 @@ public class SiteDetailTests : PageTestBase
|
||||
{
|
||||
var commands = cut.FindAll("pre code").Select(code => code.TextContent).ToArray();
|
||||
commands.Length.ShouldBe(6);
|
||||
commands[0].ShouldContain("docker pull registry.example/heimdall-agent:latest");
|
||||
commands[0].ShouldContain("docker pull registry.example/heimdall-agent@sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
commands[1].ShouldContain("--pull always");
|
||||
commands[1].ShouldContain("registry.example/heimdall-agent:latest");
|
||||
commands[3].ShouldContain("docker pull 'registry.example/heimdall-agent:latest'");
|
||||
commands[1].ShouldContain("registry.example/heimdall-agent@sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
commands[3].ShouldContain("docker pull 'registry.example/heimdall-agent@sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'");
|
||||
commands[4].ShouldContain("'--pull','always'");
|
||||
commands[4].ShouldContain("'registry.example/heimdall-agent:latest'");
|
||||
commands[4].ShouldContain("'registry.example/heimdall-agent@sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'");
|
||||
});
|
||||
}
|
||||
|
||||
@@ -140,6 +140,29 @@ public class SiteDetailTests : PageTestBase
|
||||
cut.Markup.ShouldNotContain("install-agent.ps1");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SiteDetail_CommandeLinuxNeContientNiUrlCentralNiToken()
|
||||
{
|
||||
Handler.OnGet("api/updates/latest", AgentRelease());
|
||||
Handler.OnGet("api/sites/", new SiteItem(
|
||||
SiteId, "Site Principal", null, "UTC", null, true, false, DateTime.UtcNow));
|
||||
Handler.On(HttpMethod.Post, "api/sites/", new TokenResult("tok-linux-private-42", DateTime.UtcNow.AddHours(24)));
|
||||
LoginAs();
|
||||
|
||||
var cut = RenderPage<SiteDetail>(p => p.Add(x => x.Id, SiteId));
|
||||
cut.WaitForAssertion(() => cut.Markup.ShouldContain("Générer un token"));
|
||||
cut.FindAll("button").Single(b => b.TextContent.Contains("Générer un token")).Click();
|
||||
cut.WaitForAssertion(() => cut.Markup.ShouldContain("tok-linux-private-42"));
|
||||
|
||||
var command = cut.Find("pre code").TextContent;
|
||||
command.ShouldContain("--central-url-file");
|
||||
command.ShouldContain("--site-token-file");
|
||||
command.ShouldContain("read -r -s site_token");
|
||||
command.ShouldNotContain("tok-linux-private-42");
|
||||
command.ShouldNotContain("http://localhost");
|
||||
cut.Markup.ShouldContain("saisie du token est masquée");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SiteDetail_ChoisirImageNvidia_GenereComposeAvecGpuEtProviderCuda()
|
||||
{
|
||||
@@ -160,7 +183,7 @@ public class SiteDetailTests : PageTestBase
|
||||
cut.WaitForAssertion(() =>
|
||||
{
|
||||
var compose = cut.Find("pre code").TextContent;
|
||||
compose.ShouldContain("image: registry.example/heimdall-agent-gpu:latest");
|
||||
compose.ShouldContain("image: registry.example/heimdall-agent-gpu@sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
compose.ShouldContain("pull_policy: always");
|
||||
compose.ShouldContain("Agent__InferenceExecutionProvider: CUDA");
|
||||
compose.ShouldContain("driver: nvidia");
|
||||
@@ -168,7 +191,7 @@ public class SiteDetailTests : PageTestBase
|
||||
compose.ShouldContain("\n deploy:\n resources:\n reservations:");
|
||||
var agent = GetAgentService(ParseCompose(compose));
|
||||
((YamlScalarNode)agent.Children[new YamlScalarNode("image")]).Value.ShouldBe(
|
||||
"registry.example/heimdall-agent-gpu:latest");
|
||||
"registry.example/heimdall-agent-gpu@sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
((YamlScalarNode)agent.Children[new YamlScalarNode("pull_policy")]).Value.ShouldBe("always");
|
||||
var deploy = (YamlMappingNode)agent.Children[new YamlScalarNode("deploy")];
|
||||
var resources = (YamlMappingNode)deploy.Children[new YamlScalarNode("resources")];
|
||||
@@ -185,11 +208,33 @@ public class SiteDetailTests : PageTestBase
|
||||
run.ShouldContain("--gpus all");
|
||||
run.ShouldContain("Agent__InferenceExecutionProvider=CUDA");
|
||||
run.ShouldContain("--pull always");
|
||||
run.ShouldContain("registry.example/heimdall-agent-gpu:latest");
|
||||
run.ShouldContain("registry.example/heimdall-agent-gpu@sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
run.ShouldContain("--group-add \"$(stat -c '%g' /var/run/docker.sock)\"");
|
||||
run.ShouldContain("-v /var/run/docker.sock:/var/run/docker.sock");
|
||||
commands[4].ShouldContain("'--pull','always'");
|
||||
commands[4].ShouldContain("'registry.example/heimdall-agent-gpu:latest'");
|
||||
commands[4].ShouldContain("'registry.example/heimdall-agent-gpu@sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'");
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SiteDetail_RefuseDockerComposeQuandDigestImageInvalide()
|
||||
{
|
||||
Handler.OnGet("api/updates/latest", AgentRelease("sha256:not-a-digest"));
|
||||
Handler.OnGet("api/sites/", new SiteItem(
|
||||
SiteId, "Site Principal", null, "UTC", null, true, false, DateTime.UtcNow.AddDays(-10)));
|
||||
Handler.On(HttpMethod.Post, "api/sites/", new TokenResult("tok-invalid-digest", DateTime.UtcNow.AddHours(24)));
|
||||
LoginAs();
|
||||
|
||||
var cut = RenderPage<SiteDetail>(p => p.Add(x => x.Id, SiteId));
|
||||
cut.WaitForAssertion(() => cut.Markup.ShouldContain("Générer un token"));
|
||||
cut.FindAll("button").Single(b => b.TextContent.Contains("Générer un token")).Click();
|
||||
cut.WaitForAssertion(() => cut.Markup.ShouldContain("tok-invalid-digest"));
|
||||
cut.FindAll("button").Single(b => b.TextContent.Contains("Docker", StringComparison.OrdinalIgnoreCase)).Click();
|
||||
|
||||
cut.WaitForAssertion(() =>
|
||||
{
|
||||
cut.Markup.ShouldContain("Le manifeste d’image de l’agent fourni par Central est indisponible");
|
||||
cut.FindAll(".installer-copy-box").ShouldBeEmpty();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -250,11 +295,11 @@ public class SiteDetailTests : PageTestBase
|
||||
LastUsedAt = lastUsed,
|
||||
};
|
||||
|
||||
private static LatestReleaseInfo AgentRelease() => new()
|
||||
private static LatestReleaseInfo AgentRelease(string? imageDigest = null) => new()
|
||||
{
|
||||
Version = "1.0.0",
|
||||
ContainerImage = "registry.example/heimdall-agent",
|
||||
ContainerImageDigest = "sha256:" + new string('a', 64),
|
||||
ContainerImageDigest = imageDigest ?? "sha256:" + new string('a', 64),
|
||||
UpdatePublicKeyPem = "test-public-key",
|
||||
SignedManifest = "eyJ2ZXJzaW9uIjoiMS4wLjAifQ==",
|
||||
ManifestSignature = "c2lnbmF0dXJl",
|
||||
|
||||
@@ -9,6 +9,26 @@ namespace Heimdall.Web.Tests.Controllers;
|
||||
|
||||
public sealed class UpdatesControllerRetryTests
|
||||
{
|
||||
[Fact]
|
||||
public async Task FetchBoundedReleaseAssetAsync_allowsMissingForgejoDigestForSignedMetadata()
|
||||
{
|
||||
using var client = new HttpClient(new StaticResponseHandler("verified-by-release-signature"));
|
||||
var result = await FetchAssetAsync("https://forgejo.example/attachments/release-key", digest: null, client);
|
||||
|
||||
Assert.Equal("verified-by-release-signature", Encoding.UTF8.GetString(result!));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task FetchBoundedReleaseAssetAsync_rejectsCrossOriginUrls()
|
||||
{
|
||||
var handler = new StaticResponseHandler("unexpected");
|
||||
using var client = new HttpClient(handler);
|
||||
var result = await FetchAssetAsync("https://other.example/asset", digest: null, client);
|
||||
|
||||
Assert.Null(result);
|
||||
Assert.Equal(0, handler.RequestCount);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("<html><title>Proxy error</title></html>")]
|
||||
[InlineData("{not-json")]
|
||||
@@ -63,6 +83,40 @@ public sealed class UpdatesControllerRetryTests
|
||||
return task.GetType().GetProperty("Result")?.GetValue(task);
|
||||
}
|
||||
|
||||
private static async Task<byte[]?> FetchAssetAsync(string url, string? digest, HttpClient client)
|
||||
{
|
||||
var assetType = typeof(UpdatesController).GetNestedType("ForgejoAsset", BindingFlags.NonPublic);
|
||||
Assert.NotNull(assetType);
|
||||
var asset = Activator.CreateInstance(assetType)!;
|
||||
assetType.GetProperty("Name")!.SetValue(asset, "agent-release-public.pem");
|
||||
assetType.GetProperty("BrowserDownloadUrl")!.SetValue(asset, url);
|
||||
assetType.GetProperty("Digest")!.SetValue(asset, digest);
|
||||
var listType = typeof(List<>).MakeGenericType(assetType);
|
||||
var assets = (System.Collections.IList)Activator.CreateInstance(listType)!;
|
||||
assets.Add(asset);
|
||||
var method = typeof(UpdatesController).GetMethod("FetchBoundedReleaseAssetAsync",
|
||||
BindingFlags.NonPublic | BindingFlags.Static);
|
||||
Assert.NotNull(method);
|
||||
var task = (Task<byte[]?>)method.Invoke(null,
|
||||
[assets, "agent-release-public.pem", client, 4096, new Uri("https://forgejo.example/api/v1/releases/latest"), CancellationToken.None])!;
|
||||
return await task;
|
||||
}
|
||||
|
||||
private sealed class StaticResponseHandler(string body) : HttpMessageHandler
|
||||
{
|
||||
public int RequestCount { get; private set; }
|
||||
|
||||
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
|
||||
{
|
||||
RequestCount++;
|
||||
return Task.FromResult(new HttpResponseMessage(HttpStatusCode.OK)
|
||||
{
|
||||
RequestMessage = request,
|
||||
Content = new StringContent(body, Encoding.UTF8),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(HttpStatusCode.RequestTimeout, true)]
|
||||
[InlineData(HttpStatusCode.TooManyRequests, true)]
|
||||
|
||||
@@ -0,0 +1,183 @@
|
||||
using Heimdall.Web.Security;
|
||||
using Sentry;
|
||||
|
||||
namespace Heimdall.Web.Tests.Security;
|
||||
|
||||
public sealed class SentryTelemetryPrivacyTests
|
||||
{
|
||||
[Fact]
|
||||
public void Sanitize_RedactsAuthenticationHeadersAndCookies_AndKeepsSafeRequestMetadata()
|
||||
{
|
||||
const string apiKey = "SENTINEL_API_KEY_411";
|
||||
const string cookie = "SENTINEL_SESSION_COOKIE_411";
|
||||
using var document = System.Text.Json.JsonDocument.Parse($$"""
|
||||
{
|
||||
"request": {
|
||||
"url": "https://user:SENTINEL_URL_PASSWORD_411@central.example/api/agents?access_token=SENTINEL_QUERY_TOKEN_411",
|
||||
"query_string": "access_token=SENTINEL_QUERY_TOKEN_411",
|
||||
"headers": {
|
||||
"x-api-key": "{{apiKey}}",
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
"env": { "AUTHORIZATION": "SENTINEL_ENV_AUTH_411", "REMOTE_ADDR": "192.0.2.1" },
|
||||
"other": { "access_token": "SENTINEL_OTHER_TOKEN_411", "safe": "preserved" },
|
||||
"cookies": "session={{cookie}}",
|
||||
"data": { "access_token": "SENTINEL_BODY_TOKEN_411" }
|
||||
},
|
||||
"extra": {
|
||||
"safeValue": "preserved",
|
||||
"nested": { "clientSecret": "SENTINEL_EXTRA_SECRET_411" },
|
||||
"array": [ { "accessToken": "SENTINEL_ARRAY_TOKEN_411", "safe": "preserved" } ],
|
||||
"opaque": { "credential": "SENTINEL_OPAQUE_CREDENTIAL_411" }
|
||||
}
|
||||
}
|
||||
""");
|
||||
var sentryEvent = SentryEvent.FromJson(document.RootElement);
|
||||
|
||||
var sanitized = SentryTelemetryPrivacy.Sanitize(sentryEvent);
|
||||
|
||||
Assert.Same(sentryEvent, sanitized);
|
||||
Assert.Equal("[Filtered]", sanitized.Request!.Headers!["x-api-key"]);
|
||||
Assert.Equal("application/json", sanitized.Request.Headers["Content-Type"]);
|
||||
Assert.Equal("[Filtered]", sanitized.Request.Env!["AUTHORIZATION"]);
|
||||
Assert.Equal("192.0.2.1", sanitized.Request.Env["REMOTE_ADDR"]);
|
||||
Assert.Equal("[Filtered]", sanitized.Request.Other!["access_token"]);
|
||||
Assert.Equal("preserved", sanitized.Request.Other["safe"]);
|
||||
Assert.Null(sanitized.Request.Cookies);
|
||||
Assert.Equal("https://central.example/api/agents", sanitized.Request.Url);
|
||||
Assert.Null(sanitized.Request.QueryString);
|
||||
Assert.Null(sanitized.Request.Data);
|
||||
Assert.Equal("preserved", sanitized.Extra!["safeValue"]);
|
||||
Assert.Equal("[Filtered]", ((IDictionary<string, object?>)sanitized.Extra["nested"]!)["clientSecret"]);
|
||||
Assert.Equal("[Filtered]", sanitized.Extra["array"]);
|
||||
Assert.Equal("[Filtered]", ((IDictionary<string, object?>)sanitized.Extra["opaque"]!)["credential"]);
|
||||
|
||||
var serialized = SerializeEvent(sanitized);
|
||||
Assert.DoesNotContain(apiKey, serialized, StringComparison.Ordinal);
|
||||
Assert.DoesNotContain(cookie, serialized, StringComparison.Ordinal);
|
||||
Assert.DoesNotContain("SENTINEL_", serialized, StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SanitizeBreadcrumb_RedactsSensitiveDataAndPreservesSafeData()
|
||||
{
|
||||
var breadcrumb = new Breadcrumb(
|
||||
"request",
|
||||
"http",
|
||||
new Dictionary<string, string>
|
||||
{
|
||||
["Authorization"] = "SENTINEL_BREADCRUMB_AUTH_411",
|
||||
["method"] = "GET",
|
||||
},
|
||||
"http.client",
|
||||
BreadcrumbLevel.Info);
|
||||
|
||||
var sanitized = SentryTelemetryPrivacy.SanitizeBreadcrumb(breadcrumb);
|
||||
|
||||
Assert.Same(breadcrumb, sanitized);
|
||||
Assert.Equal("[Filtered]", sanitized.Data!["Authorization"]);
|
||||
Assert.Equal("GET", sanitized.Data["method"]);
|
||||
Assert.DoesNotContain("SENTINEL_", System.Text.Json.JsonSerializer.Serialize(sanitized), StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SanitizeTransaction_RedactsRequestContextsBreadcrumbsTagsAndSpans()
|
||||
{
|
||||
using var document = System.Text.Json.JsonDocument.Parse("""
|
||||
{
|
||||
"transaction": "GET /api/agents",
|
||||
"start_timestamp": "2026-11-13T12:00:00Z",
|
||||
"request": {
|
||||
"url": "https://central.example/api/agents?api_key=SENTINEL_TRANSACTION_URL_411",
|
||||
"query_string": "api_key=SENTINEL_TRANSACTION_QUERY_411",
|
||||
"headers": {
|
||||
"Authorization": "SENTINEL_TRANSACTION_AUTH_411",
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
"cookies": "session=SENTINEL_TRANSACTION_COOKIE_411",
|
||||
"data": { "password": "SENTINEL_TRANSACTION_BODY_411" }
|
||||
},
|
||||
"contexts": {
|
||||
"trace": { "type": "trace", "data": { "api_key": "SENTINEL_TRANSACTION_TRACE_411", "safe": "preserved" } },
|
||||
"response": { "type": "response", "cookies": "session=SENTINEL_TRANSACTION_RESPONSE_COOKIE_411", "headers": { "Set-Cookie": "SENTINEL_TRANSACTION_SET_COOKIE_411", "Content-Type": "application/json" }, "data": { "token": "SENTINEL_TRANSACTION_RESPONSE_BODY_411" } },
|
||||
"custom": { "clientSecret": "SENTINEL_TRANSACTION_CONTEXT_411", "mode": "safe", "metadata": [ { "token": "SENTINEL_CONTEXT_ARRAY_411" } ] }
|
||||
},
|
||||
"breadcrumbs": [
|
||||
{ "message": "request", "type": "http", "category": "http.client", "data": { "Authorization": "SENTINEL_TRANSACTION_BREADCRUMB_411", "method": "GET" } }
|
||||
],
|
||||
"tags": { "api_key": "SENTINEL_TRANSACTION_TAG_411", "method": "GET" },
|
||||
"spans": [
|
||||
{ "start_timestamp": "2026-11-13T12:00:00Z", "op": "http.client", "description": "GET /health", "data": { "credential": "SENTINEL_TRANSACTION_SPAN_411", "status_code": 200 }, "tags": { "secret": "SENTINEL_TRANSACTION_SPAN_TAG_411", "method": "GET" } }
|
||||
]
|
||||
}
|
||||
""");
|
||||
var transaction = SentryTransaction.FromJson(document.RootElement);
|
||||
|
||||
var sanitized = SentryTelemetryPrivacy.Sanitize(transaction);
|
||||
|
||||
Assert.Same(transaction, sanitized);
|
||||
Assert.Equal("[Filtered]", sanitized.Request.Headers!["Authorization"]);
|
||||
Assert.Equal("application/json", sanitized.Request.Headers["Content-Type"]);
|
||||
Assert.Null(sanitized.Request.Cookies);
|
||||
Assert.Null(sanitized.Request.QueryString);
|
||||
Assert.Null(sanitized.Request.Data);
|
||||
Assert.Equal("[Filtered]", sanitized.Contexts.Trace.Data["api_key"]);
|
||||
Assert.Equal("preserved", sanitized.Contexts.Trace.Data["safe"]);
|
||||
Assert.Equal("[Filtered]", sanitized.Contexts.Response.Headers["Set-Cookie"]);
|
||||
Assert.Equal("application/json", sanitized.Contexts.Response.Headers["Content-Type"]);
|
||||
Assert.Null(sanitized.Contexts.Response.Cookies);
|
||||
Assert.Null(sanitized.Contexts.Response.Data);
|
||||
Assert.Equal("[Filtered]", ((IDictionary<string, object?>)sanitized.Contexts["custom"])["clientSecret"]);
|
||||
Assert.Equal("safe", ((IDictionary<string, object?>)sanitized.Contexts["custom"])["mode"]);
|
||||
Assert.Equal("[Filtered]", ((IDictionary<string, object?>)sanitized.Contexts["custom"])["metadata"]);
|
||||
Assert.Equal("[Filtered]", sanitized.Breadcrumbs.Single().Data!["Authorization"]);
|
||||
Assert.Equal("GET", sanitized.Breadcrumbs.Single().Data!["method"]);
|
||||
Assert.Equal("[Filtered]", sanitized.Tags["api_key"]);
|
||||
Assert.Equal("GET", sanitized.Tags["method"]);
|
||||
Assert.Equal("[Filtered]", sanitized.Spans.Single().Data["credential"]);
|
||||
Assert.Equal("200", sanitized.Spans.Single().Data["status_code"]?.ToString());
|
||||
Assert.Equal("[Filtered]", sanitized.Spans.Single().Tags["secret"]);
|
||||
Assert.Equal("GET", sanitized.Spans.Single().Tags["method"]);
|
||||
|
||||
var serialized = SerializeTransaction(sanitized);
|
||||
Assert.DoesNotContain("SENTINEL_", serialized, StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Sanitize_RedactsSensitiveEventTagsInSdkPayload()
|
||||
{
|
||||
using var document = System.Text.Json.JsonDocument.Parse("""
|
||||
{ "message": "synthetic", "tags": { "api_key": "SENTINEL_EVENT_TAG_411", "method": "GET" } }
|
||||
""");
|
||||
var sentryEvent = SentryEvent.FromJson(document.RootElement);
|
||||
|
||||
var sanitized = SentryTelemetryPrivacy.Sanitize(sentryEvent);
|
||||
|
||||
Assert.Equal("[Filtered]", sanitized.Tags["api_key"]);
|
||||
Assert.Equal("GET", sanitized.Tags["method"]);
|
||||
var serialized = SerializeEvent(sanitized);
|
||||
Assert.DoesNotContain("SENTINEL_EVENT_TAG_411", serialized, StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
private static string SerializeTransaction(SentryTransaction transaction)
|
||||
{
|
||||
using var stream = new MemoryStream();
|
||||
using (var writer = new System.Text.Json.Utf8JsonWriter(stream))
|
||||
{
|
||||
transaction.WriteTo(writer, null);
|
||||
}
|
||||
|
||||
return System.Text.Encoding.UTF8.GetString(stream.ToArray());
|
||||
}
|
||||
|
||||
private static string SerializeEvent(SentryEvent sentryEvent)
|
||||
{
|
||||
using var stream = new MemoryStream();
|
||||
using (var writer = new System.Text.Json.Utf8JsonWriter(stream))
|
||||
{
|
||||
sentryEvent.WriteTo(writer, null);
|
||||
}
|
||||
|
||||
return System.Text.Encoding.UTF8.GetString(stream.ToArray());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
using System.Security.Cryptography;
|
||||
using System.Text.Json;
|
||||
using Heimdall.Web.Services;
|
||||
using Xunit;
|
||||
|
||||
namespace Heimdall.Web.Tests.Services;
|
||||
|
||||
public sealed class AgentReleaseManifestVerifierTests
|
||||
{
|
||||
[Fact]
|
||||
public void TryVerify_AcceptsSignedManifestWhenForgejoAssetDigestIsUnavailable()
|
||||
{
|
||||
using var key = ECDsa.Create(ECCurve.NamedCurves.nistP256);
|
||||
var bytes = ManifestBytes();
|
||||
var signature = key.SignData(bytes, HashAlgorithmName.SHA256, DSASignatureFormat.Rfc3279DerSequence);
|
||||
|
||||
var valid = AgentReleaseManifestVerifier.TryVerify(
|
||||
key.ExportSubjectPublicKeyInfoPem(), bytes, signature, "1.0.7", out var manifest);
|
||||
|
||||
Assert.True(valid);
|
||||
Assert.NotNull(manifest);
|
||||
Assert.Equal("1.0.7", manifest.Version);
|
||||
Assert.True(manifest.Assets.ContainsKey("portable"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TryVerify_AcceptsCpuOnlySignedManifest()
|
||||
{
|
||||
using var key = ECDsa.Create(ECCurve.NamedCurves.nistP256);
|
||||
var bytes = ManifestBytes(includeGpuImage: false);
|
||||
var signature = key.SignData(bytes, HashAlgorithmName.SHA256, DSASignatureFormat.Rfc3279DerSequence);
|
||||
|
||||
var valid = AgentReleaseManifestVerifier.TryVerify(
|
||||
key.ExportSubjectPublicKeyInfoPem(), bytes, signature, "1.0.7", out var manifest);
|
||||
|
||||
Assert.True(valid);
|
||||
Assert.NotNull(manifest);
|
||||
Assert.Null(manifest.ContainerImageGpu);
|
||||
Assert.Null(manifest.ContainerImageGpuDigest);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TryVerify_RejectsIncompleteGpuImageMetadata()
|
||||
{
|
||||
using var key = ECDsa.Create(ECCurve.NamedCurves.nistP256);
|
||||
var bytes = ManifestBytes(invalidGpuPair: true);
|
||||
var signature = key.SignData(bytes, HashAlgorithmName.SHA256, DSASignatureFormat.Rfc3279DerSequence);
|
||||
|
||||
Assert.False(AgentReleaseManifestVerifier.TryVerify(key.ExportSubjectPublicKeyInfoPem(), bytes, signature,
|
||||
"1.0.7", out _));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TryVerify_RejectsModifiedManifest()
|
||||
{
|
||||
using var key = ECDsa.Create(ECCurve.NamedCurves.nistP256);
|
||||
var bytes = ManifestBytes();
|
||||
var signature = key.SignData(bytes, HashAlgorithmName.SHA256, DSASignatureFormat.Rfc3279DerSequence);
|
||||
bytes[^2] ^= 1;
|
||||
|
||||
Assert.False(AgentReleaseManifestVerifier.TryVerify(key.ExportSubjectPublicKeyInfoPem(), bytes, signature,
|
||||
"1.0.7", out _));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TryVerify_RejectsTagMismatchAndMalformedArchiveDigest()
|
||||
{
|
||||
using var key = ECDsa.Create(ECCurve.NamedCurves.nistP256);
|
||||
var bytes = ManifestBytes();
|
||||
var signature = key.SignData(bytes, HashAlgorithmName.SHA256, DSASignatureFormat.Rfc3279DerSequence);
|
||||
|
||||
Assert.False(AgentReleaseManifestVerifier.TryVerify(key.ExportSubjectPublicKeyInfoPem(), bytes, signature,
|
||||
"1.0.8", out _));
|
||||
|
||||
bytes = ManifestBytes(invalidArchiveHash: true);
|
||||
signature = key.SignData(bytes, HashAlgorithmName.SHA256, DSASignatureFormat.Rfc3279DerSequence);
|
||||
Assert.False(AgentReleaseManifestVerifier.TryVerify(key.ExportSubjectPublicKeyInfoPem(), bytes, signature,
|
||||
"1.0.7", out _));
|
||||
}
|
||||
|
||||
private static byte[] ManifestBytes(bool invalidArchiveHash = false, bool includeGpuImage = true,
|
||||
bool invalidGpuPair = false)
|
||||
{
|
||||
var manifest = new Dictionary<string, object?>
|
||||
{
|
||||
["version"] = "1.0.7",
|
||||
["assets"] = new Dictionary<string, string>
|
||||
{
|
||||
["portable"] = invalidArchiveHash ? "not-a-sha256" : new string('c', 64)
|
||||
},
|
||||
["containerImage"] = "eltruncho/heimdall-agent",
|
||||
["containerImageDigest"] = "sha256:" + new string('a', 64),
|
||||
};
|
||||
if (includeGpuImage || invalidGpuPair)
|
||||
manifest["containerImageGpu"] = "eltruncho/heimdall-agent-gpu";
|
||||
if (includeGpuImage && !invalidGpuPair)
|
||||
manifest["containerImageGpuDigest"] = "sha256:" + new string('b', 64);
|
||||
return JsonSerializer.SerializeToUtf8Bytes(manifest);
|
||||
}
|
||||
}
|
||||
@@ -131,8 +131,8 @@
|
||||
},
|
||||
"AutoMapper": {
|
||||
"type": "Transitive",
|
||||
"resolved": "16.1.1",
|
||||
"contentHash": "VNEky8JA15ci+oIDRGHITOGOpV4dILsf8pnn24QhDl2urtqgJ2IXiS/V2EtGU17P/+f6OeFQPJETaZXV9QOIZg==",
|
||||
"resolved": "16.3.0",
|
||||
"contentHash": "wFTqA37e1I4AOEhTTYlxrqDE8BQ4OB3dqhlv2KwYmHv+a4tn7R1JW2n2bzXb8eTBhWVBSl7iTZ0VxEt0a57D4w==",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "10.0.0",
|
||||
"Microsoft.Extensions.Options": "10.0.0",
|
||||
@@ -1188,7 +1188,7 @@
|
||||
"heimdall.application": {
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"AutoMapper": "[16.1.1, )",
|
||||
"AutoMapper": "[16.3.0, )",
|
||||
"FluentValidation": "[11.11.0, )",
|
||||
"FluentValidation.DependencyInjectionExtensions": "[11.11.0, )",
|
||||
"Heimdall.Domain": "[1.0.0, )",
|
||||
|
||||
Reference in new issue
Block a user