From 145832763828da4ef3607e308040a506f5aab1d8 Mon Sep 17 00:00:00 2001 From: "Sean (ANGRYxScotsman)" <36518683+seanh1995@users.noreply.github.com> Date: Mon, 10 Aug 2026 02:11:35 +0100 Subject: [PATCH] Containerize docs site tooling for security and update documentation (#4942) * Containerize the docs site's npm tooling Run Astro/Starlight dev, build, and preview commands through Docker (docs/Dockerfile, docker-compose.yml, service winutil-astro) instead of bare npm on the host, and document the required commands and rationale in docs/README.md. * Document Docker-only npm policy for agents Add a Dependency Installs, Builds, And Dev Servers section to AGENTS.md requiring docs/ tooling to run through Docker rather than directly on the host, point SPEC.md's Docs Site section at the new Dockerfile/docker-compose.yml, and renumber the remaining AGENTS.md sections to stay sequential. * Harden docs Docker dev environment Tightened docs-container safety and clarified contributor workflow. The docs Docker image now switches to the non-root `node` user after setting ownership, and compose now binds Astro to `127.0.0.1` instead of all interfaces. Updated AGENTS and docs README instructions to explain the security boundary of the bind mount and to require rebuilding plus `docker compose down -v` after dependency changes so `node_modules` is reseeded correctly. * Clarify docs secret handling in AGENTS Updates AGENTS.md to tighten docs security guidance: secrets must not be stored anywhere under `docs/`, because `docs/.dockerignore` only affects image build context and does not protect files from the Docker Compose bind mount used for docs dev/build commands. * Fix preview command to expose port in Docker The previous preview command didn't expose the port outside the container. Adding --service-ports and binding to 0.0.0.0 makes the preview server accessible from the host. --- AGENTS.md | 41 ++++++++++++++++++++++------------- SPEC.md | 1 + docs/.dockerignore | 7 ++++++ docs/Dockerfile | 16 ++++++++++++++ docs/README.md | 48 +++++++++++++++++++++++++---------------- docs/docker-compose.yml | 16 ++++++++++++++ 6 files changed, 96 insertions(+), 33 deletions(-) create mode 100644 docs/.dockerignore create mode 100644 docs/Dockerfile create mode 100644 docs/docker-compose.yml diff --git a/AGENTS.md b/AGENTS.md index ca951623..43aada50 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -42,25 +42,36 @@ These rules override everything else in this file when in conflict: ```powershell Invoke-ScriptAnalyzer -Path . -Settings .\lint\PSScriptAnalyser.ps1 -Recurse ``` -- Docs site dev server (run from `docs/`): +- Docs site dev server (run from `docs/`; see Section 2 for why this goes through Docker): ```powershell - npm install - npm run dev + docker compose up winutil-astro ``` - Docs site production build (run from `docs/`): ```powershell - npm run build + docker compose run --rm winutil-astro npm run build ``` Prefer the narrowest useful verification while iterating. Use the full relevant check before finishing. -## 2. Source Of Truth +## 2. Dependency Installs, Builds, And Dev Servers + +Given the current wave of npm/pnpm/yarn supply-chain worms (malicious postinstall/preinstall scripts, credential-stealing packages): **never run npm/pnpm/yarn/npx directly on the host, full stop.** The docs site (`docs/`) is the only npm-based project in this repo; always run its tooling inside Docker via `docs/Dockerfile` and `docs/docker-compose.yml` (service `winutil-astro`). + +- Never run `npm install`, `npm run