From 0a7bfc183d106dff58c06c0a44d14547c1139705 Mon Sep 17 00:00:00 2001 From: Shinuwa Date: Wed, 2 Dec 2026 12:24:15 +0100 Subject: [PATCH] ci: run tests and audit on every push, deploy exact commit with health check - npm audit fix (multer 2.5.0, body-parser, qs, proxy-addr): 0 vulnerabilities - engines node >=22.9 and .nvmrc (prod runs Node 26) - GET /healthz for deployment checks - workflow: check job (npm ci, npm test, npm audit) on every push; deploy only on main after checks, with pinned host key, BatchMode and exact commit SHA - ops/deploy-gameservers-control.sh: lock, refuse dirty tree, fast-forward to the commit, npm ci --omit=dev, wait for /healthz, roll back on failure - stop tracking storage/servers.json (prod storage now lives outside the repo) Co-Authored-By: Claude Opus 5.5 --- .forgejo/workflows/deploy.yml | 57 ++++++++++-- .nvmrc | 1 + README.md | 9 ++ ops/README.md | 41 +++++++++ ops/deploy-gameservers-control.sh | 94 +++++++++++++++++++ package-lock.json | 144 +++++++++--------------------- package.json | 5 +- src/app.js | 1 + storage/servers.json | 20 ----- test/api.test.js | 6 ++ 10 files changed, 249 insertions(+), 129 deletions(-) create mode 100644 .nvmrc create mode 100644 ops/README.md create mode 100755 ops/deploy-gameservers-control.sh delete mode 100644 storage/servers.json diff --git a/.forgejo/workflows/deploy.yml b/.forgejo/workflows/deploy.yml index dbcc92c..d35ae94 100644 --- a/.forgejo/workflows/deploy.yml +++ b/.forgejo/workflows/deploy.yml @@ -1,28 +1,69 @@ name: Deploy Gameservers Control +# Les contrôles tournent à chaque push, sur toutes les branches (une PR est donc contrôlée par +# le push de sa branche) ; le déploiement, seulement après un push sur main dont les +# contrôles ont réussi. on: push: - branches: - - main jobs: - deploy: + check: runs-on: docker + timeout-minutes: 10 + # Même version majeure de Node que la prod (v26 sur webapps). + container: + image: node:26-bookworm + + steps: + - uses: https://data.forgejo.org/actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 + - name: Install dependencies + run: npm ci --no-fund + - name: Tests + run: npm test + - name: Audit des dépendances de production + run: npm audit --omit=dev --audit-level=high + + deploy: + needs: check + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + runs-on: docker + timeout-minutes: 10 + container: + image: node:26-bookworm steps: - name: Deploy on WebApps env: DEPLOY_SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }} + # Clé d'hôte de la VM (sortie de `ssh-keyscan -p 2911 192.168.0.100`) : sans elle, + # n'importe quelle machine qui répondrait à cette adresse recevrait la connexion. + DEPLOY_KNOWN_HOSTS: ${{ secrets.DEPLOY_KNOWN_HOSTS }} + DEPLOY_COMMIT: ${{ github.sha }} run: | - apt-get update - apt-get install -y openssh-client + if ! command -v ssh >/dev/null; then + apt-get update + apt-get install -y --no-install-recommends openssh-client + fi + if [ -z "$DEPLOY_KNOWN_HOSTS" ]; then + echo "Secret DEPLOY_KNOWN_HOSTS manquant (ssh-keyscan -p 2911 192.168.0.100)" >&2 + exit 1 + fi + printf '%s' "$DEPLOY_COMMIT" | grep -Eq '^[0-9a-f]{40}$' + + umask 077 mkdir -p ~/.ssh printf '%s\n' "$DEPLOY_SSH_KEY" > ~/.ssh/id_ed25519 - chmod 600 ~/.ssh/id_ed25519 + printf '%s\n' "$DEPLOY_KNOWN_HOSTS" > ~/.ssh/known_hosts - ssh -o StrictHostKeyChecking=no \ + # La clé n'autorise que des commandes précises côté serveur + # (/usr/local/sbin/deploy-ssh-gate) : garder exactement cette forme. + ssh -o BatchMode=yes -o StrictHostKeyChecking=yes \ -i ~/.ssh/id_ed25519 \ -p 2911 \ shinuwa@192.168.0.100 \ - "sudo /usr/local/bin/deploy-gameservers-control" \ No newline at end of file + "sudo /usr/local/bin/deploy-gameservers-control --commit '$DEPLOY_COMMIT'" + + - name: Remove the deployment key + if: always() + run: rm -f ~/.ssh/id_ed25519 diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..6f4247a --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +26 diff --git a/README.md b/README.md index 86e0454..709429a 100644 --- a/README.md +++ b/README.md @@ -53,3 +53,12 @@ Au premier demarrage, si aucun groupe n'existe, un groupe `admin` est cree et so - `storage/groups.json`: groupes et permissions. - `storage/launch-logs.json`: lancements conserves 7 jours. - `mocked/dev-gameservers-status.json`: statut mock de developpement. + +Le dossier `storage/` n'est pas versionne: il est cree au premier demarrage avec des valeurs +par defaut. En production, `STORAGE_DIR` pointe hors du depot (droits `700`). + +## Deploiement + +Chaque push lance les tests et `npm audit` (`.forgejo/workflows/deploy.yml`). Un push sur `main` +dont les controles passent deploie le commit en production. Mise en place cote serveur: +voir [ops/README.md](ops/README.md). diff --git a/ops/README.md b/ops/README.md new file mode 100644 index 0000000..cf2e6af --- /dev/null +++ b/ops/README.md @@ -0,0 +1,41 @@ +# Exploitation + +## Déploiement + +La CI se connecte en SSH à la VM webapps (`shinuwa@192.168.0.100:2911`) avec la clé +`forgejo-runner@webapps`, puis lance : + +``` +sudo /usr/local/bin/deploy-gameservers-control --commit '' +``` + +Côté serveur, cette clé est limitée par `/usr/local/sbin/deploy-ssh-gate` (commande forcée dans +`~/.ssh/authorized_keys`) : toute nouvelle commande SSH dans le workflow doit y être ajoutée. + +### Secrets Forgejo du dépôt + +| Secret | Contenu | +|---|---| +| `DEPLOY_SSH_KEY` | Clé privée `forgejo-runner@webapps` | +| `DEPLOY_KNOWN_HOSTS` | Sortie de `ssh-keyscan -p 2911 192.168.0.100` | + +### Installer ou mettre à jour le script de déploiement + +Sur la VM webapps, depuis le dépôt à jour : + +```bash +sudo install -o root -g root -m 755 ops/deploy-gameservers-control.sh /usr/local/bin/deploy-gameservers-control +``` + +Le script : + +1. prend un verrou, pour qu'un seul déploiement tourne à la fois ; +2. refuse de déployer si des fichiers suivis par git ont été modifiés à la main en prod ; +3. avance `main` jusqu'au commit demandé (avance rapide seulement, jamais de recul) ; +4. lance `npm ci --omit=dev`, redémarre le service, puis attend `/healthz` pendant 30 s ; +5. si `/healthz` ne répond pas, revient au commit précédent et termine en erreur. + +## Données + +`STORAGE_DIR` pointe hors du dépôt (`/data/webapps/data/gameservers-control`, droits `700`, +fichiers `600`). diff --git a/ops/deploy-gameservers-control.sh b/ops/deploy-gameservers-control.sh new file mode 100755 index 0000000..44f3387 --- /dev/null +++ b/ops/deploy-gameservers-control.sh @@ -0,0 +1,94 @@ +#!/usr/bin/env bash +# Rôle : déploie un commit de main en production sur la VM webapps. +# Installé dans /usr/local/bin/deploy-gameservers-control (root:root, 755) et lancé par la CI +# via `sudo /usr/local/bin/deploy-gameservers-control --commit ` (cf. ops/README.md). +# +# Étapes : verrou -> contrôle du dépôt -> avance rapide jusqu'au commit -> npm ci -> redémarrage +# -> attente de /healthz. Si /healthz ne répond pas, retour automatique au commit précédent. +set -euo pipefail + +APP_DIR=/data/webapps/apps/gameservers-control +APP_USER=shinuwa +SERVICE=gameservers-control +NODE_BIN=/home/shinuwa/.nvm/versions/node/v26.3.0/bin +LOCK_FILE=/run/lock/deploy-gameservers-control.lock +HEALTH_TRIES=30 + +usage() { + echo "Usage: $0 [--commit ]" >&2 + exit 2 +} + +COMMIT="" +if [[ $# -gt 0 ]]; then + [[ $# -eq 2 && "$1" == "--commit" && "$2" =~ ^[0-9a-f]{40}$ ]] || usage + COMMIT="$2" +fi + +# Un seul déploiement à la fois : un second attend la fin du premier. +exec 9>"$LOCK_FILE" +flock 9 + +as_app() { + sudo -u "$APP_USER" env PATH="$NODE_BIN:/usr/bin:/bin" HOME="/home/$APP_USER" "$@" +} + +cd "$APP_DIR" + +# Refuse de déployer par-dessus des modifications locales de fichiers suivis par git : +# un correctif fait à la main en prod serait écrasé ou bloquerait l'avance rapide. +if [[ -n "$(as_app git status --porcelain --untracked-files=no)" ]]; then + echo "Modifications locales dans $APP_DIR, déploiement annulé :" >&2 + as_app git status --short --untracked-files=no >&2 + exit 1 +fi + +as_app git fetch --prune origin main +TARGET="${COMMIT:-$(as_app git rev-parse origin/main)}" + +if ! as_app git merge-base --is-ancestor "$TARGET" origin/main; then + echo "Le commit $TARGET n'est pas sur origin/main, déploiement annulé." >&2 + exit 1 +fi + +PREVIOUS="$(as_app git rev-parse HEAD)" +# Un commit plus ancien que celui en place (CI en retard) ne fait pas reculer la prod. +as_app git merge --ff-only "$TARGET" +DEPLOYED="$(as_app git rev-parse HEAD)" +echo "Commit en place : $DEPLOYED (précédent : $PREVIOUS)" + +PORT="$(sed -n 's/^PORT=//p' .env 2>/dev/null | tail -n 1)" +HEALTH_URL="http://127.0.0.1:${PORT:-3100}/healthz" + +install_and_restart() { + as_app npm ci --omit=dev --no-audit --no-fund + systemctl restart "$SERVICE" +} + +wait_healthy() { + local i + for ((i = 1; i <= HEALTH_TRIES; i++)); do + if curl -fsS --max-time 2 "$HEALTH_URL" >/dev/null 2>&1; then + return 0 + fi + sleep 1 + done + return 1 +} + +install_and_restart +if wait_healthy; then + echo "Déploiement OK : $DEPLOYED répond sur $HEALTH_URL" + exit 0 +fi + +echo "$HEALTH_URL ne répond pas après ${HEALTH_TRIES}s, retour à $PREVIOUS." >&2 +journalctl -u "$SERVICE" -n 30 --no-pager >&2 || true +as_app git reset --hard "$PREVIOUS" +install_and_restart +if wait_healthy; then + echo "Retour arrière OK : $PREVIOUS est de nouveau en place." >&2 +else + echo "Le retour arrière ne répond pas non plus : intervention manuelle nécessaire." >&2 +fi +exit 1 diff --git a/package-lock.json b/package-lock.json index a3bff0a..4c5106f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,9 +9,12 @@ "version": "1.0.0", "dependencies": { "express": "^5.1.0", - "multer": "^2.0.2" + "multer": "^2.5.0" }, - "devDependencies": {} + "devDependencies": {}, + "engines": { + "node": ">=22.9" + } }, "node_modules/accepts": { "version": "2.0.0", @@ -33,20 +36,20 @@ "license": "MIT" }, "node_modules/body-parser": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.2.2.tgz", - "integrity": "sha512-oP5VkATKlNwcgvxi0vM0p/D3n2C3EReYVX+DNYs5TjZFn/oQt2j+4sVJtSMr18pdRr8wjTcBl6LoV+FUwzPmNA==", + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.4.0.tgz", + "integrity": "sha512-Ifk1KcLrxaGt1occQagQNFNNOqRt1LFuehEnHHzB8Z6cRgIxRU1TBaiIsUiCdA+gy5PL7Y1IX31DNKkRmxtXjQ==", "license": "MIT", "dependencies": { "bytes": "^3.1.2", - "content-type": "^1.0.5", + "content-type": "^2.1.0", "debug": "^4.4.3", - "http-errors": "^2.0.0", - "iconv-lite": "^0.7.0", + "http-errors": "^2.0.1", + "iconv-lite": "^0.7.3", "on-finished": "^2.4.1", - "qs": "^6.14.1", - "raw-body": "^3.0.1", - "type-is": "^2.0.1" + "qs": "^6.16.1", + "raw-body": "^3.0.2", + "type-is": "^2.1.0" }, "engines": { "node": ">=18" @@ -56,11 +59,18 @@ "url": "https://opencollective.com/express" } }, - "node_modules/buffer-from": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", - "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", - "license": "MIT" + "node_modules/body-parser/node_modules/content-type": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-2.1.0.tgz", + "integrity": "sha512-mj7UPXE0jaqaOsukNZRUEfEi2AcL7C/vwmwcHV0O97eO1E1pxBZuyjlZrx5seTaNBg1U6+o35wpa35Qfcc+7ag==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } }, "node_modules/busboy": { "version": "1.6.0", @@ -111,21 +121,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/concat-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-2.0.0.tgz", - "integrity": "sha512-MWufYdFw53ccGjCA+Ol7XJYpAlW6/prSMzuPOTRnJGcGzuhLn4Scrz7qf6o8bROZ514ltazcIFJZevcfbo0x7A==", - "engines": [ - "node >= 6.0" - ], - "license": "MIT", - "dependencies": { - "buffer-from": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^3.0.2", - "typedarray": "^0.0.6" - } - }, "node_modules/content-disposition": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.1.0.tgz", @@ -451,9 +446,9 @@ } }, "node_modules/iconv-lite": { - "version": "0.7.2", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.2.tgz", - "integrity": "sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw==", + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.3.tgz", + "integrity": "sha512-IKXpvIzjnC9XTAUbVBcMfGS0EPaIXtW6v+zr+RRp+hqULEpo0owZax6wyRwPOJbWbzjYspQwusTsfVr0ifh4uQ==", "license": "MIT", "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" @@ -549,14 +544,13 @@ "license": "MIT" }, "node_modules/multer": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/multer/-/multer-2.1.1.tgz", - "integrity": "sha512-mo+QTzKlx8R7E5ylSXxWzGoXoZbOsRMpyitcht8By2KHvMbf3tjwosZ/Mu/XYU6UuJ3VZnODIrak5ZrPiPyB6A==", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/multer/-/multer-2.5.0.tgz", + "integrity": "sha512-BsqOzYGVq49JcW2IzoSAxeKYRevb+dGGPPWleOR8Lrlk4igwxu1/9pwSXlByhCb7MVZDrNJFC0IBP5/O5nLYRw==", "license": "MIT", "dependencies": { "append-field": "^1.0.0", "busboy": "^1.6.0", - "concat-stream": "^2.0.0", "type-is": "^1.6.18" }, "engines": { @@ -672,9 +666,9 @@ } }, "node_modules/proxy-addr": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", - "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.8.tgz", + "integrity": "sha512-5nnx0yGyVUcY6t9RnWcARWtwT9F1D8O9rt08htPvnd49W1IgZtmLkhu9WfMzQj1cFxjHIO6connUNVW5k7AVyQ==", "license": "MIT", "dependencies": { "forwarded": "0.2.0", @@ -682,15 +676,20 @@ }, "engines": { "node": ">= 0.10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" } }, "node_modules/qs": { - "version": "6.15.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.15.2.tgz", - "integrity": "sha512-Rzq0KEyX/w/tEybncDgdkZrJgVUsUMk3xjh3t5bv3S1HTAtg+uOYt72+ZfwiQwKdysThkTBdL/rTi6HDmX9Ddw==", + "version": "6.17.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.17.1.tgz", + "integrity": "sha512-jd3COkaKVgGUW+ZHyEHCG9bH7RoaaiWuMgzsIBjUMVjLAaWGWpoUAVwljVvBHxRu/2qEHnadLGZrkutYUBPQJA==", "license": "BSD-3-Clause", "dependencies": { - "side-channel": "^1.1.0" + "es-define-property": "^1.0.1", + "side-channel": "^1.1.1" }, "engines": { "node": ">=0.6" @@ -723,20 +722,6 @@ "node": ">= 0.10" } }, - "node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "license": "MIT", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/router": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz", @@ -753,26 +738,6 @@ "node": ">= 18" } }, - "node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, "node_modules/safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", @@ -919,15 +884,6 @@ "node": ">=10.0.0" } }, - "node_modules/string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "license": "MIT", - "dependencies": { - "safe-buffer": "~5.2.0" - } - }, "node_modules/toidentifier": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", @@ -968,12 +924,6 @@ "url": "https://opencollective.com/express" } }, - "node_modules/typedarray": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", - "integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==", - "license": "MIT" - }, "node_modules/unpipe": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", @@ -983,12 +933,6 @@ "node": ">= 0.8" } }, - "node_modules/util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", - "license": "MIT" - }, "node_modules/vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", diff --git a/package.json b/package.json index a7a3bb5..011fdcb 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,9 @@ "description": "Interface web de controle des serveurs de jeux", "type": "module", "main": "src/server.js", + "engines": { + "node": ">=22.9" + }, "scripts": { "start": "node --env-file-if-exists=.env src/server.js", "dev": "NODE_ENV=development node --env-file-if-exists=.env src/server.js", @@ -11,7 +14,7 @@ }, "dependencies": { "express": "^5.1.0", - "multer": "^2.0.2" + "multer": "^2.5.0" }, "devDependencies": {} } diff --git a/src/app.js b/src/app.js index 18e7aa6..7ad704b 100644 --- a/src/app.js +++ b/src/app.js @@ -10,6 +10,7 @@ import { serversRouter } from "./routes/servers.js"; function createApp() { const app = express(); app.use(express.json()); + app.get("/healthz", (_req, res) => res.json({ ok: true })); app.use("/server-images", express.static(config.serverImagesDir)); app.use("/api", authRouter); diff --git a/storage/servers.json b/storage/servers.json deleted file mode 100644 index b160949..0000000 --- a/storage/servers.json +++ /dev/null @@ -1,20 +0,0 @@ -[ - { - "id": "game-1", - "game": "Jeu 1", - "address": "srv.mocked.com:12345", - "port": 12345, - "startProfile": "GAME_1", - "secrets": {} - }, - { - "id": "game-2", - "game": "Jeu 2", - "address": "srv.mocked.com:67890", - "port": 67890, - "startProfile": "GAME_2", - "secrets": { - "password": "change-me" - } - } -] diff --git a/test/api.test.js b/test/api.test.js index 8635815..ded2e76 100644 --- a/test/api.test.js +++ b/test/api.test.js @@ -90,6 +90,12 @@ const baseUrl = `http://127.0.0.1:${server.address().port}`; test.after(() => server.close()); +test("healthz answers without authentication", async () => { + const response = await request("/healthz"); + assert.equal(response.status, 200); + assert.deepEqual(response.body, { ok: true }); +}); + test("rejects invalid password and accepts group password", async () => { const rejected = await request("/api/login", { method: "POST",