From f32ad076486127a1132b754eb8258105754355bb Mon Sep 17 00:00:00 2001 From: Noel Sabia Date: Sun, 18 Oct 2026 21:14:12 +0200 Subject: [PATCH] fix: unblock the release PR - real production image, reviewed audit ignores The release PR (chore: release main) failed two checks, both verified locally before pushing: - droast: the empty production Dockerfile failed DF071 (no instructions). The new Dockerfile is a runnable Node server (SSR): multi-stage, manifests-first layers, digest-pinned node:26-slim (same digest as the dev container), non-root uid 1000, node-fetch HEALTHCHECK. Measured: docker build succeeds in-image, container serves HTTP 200 and reports healthy; droast reports 0 errors. - audit: two high advisories with NO patched release anywhere (node-forge <=1.4.0 and braces <=3.0.3 are the newest npm versions; both build-time-only paths under nitropack). Recorded as auditConfig.ignoreGhsas in pnpm-workspace.yaml with the reason and removal condition - the audit output still names what it skipped. pnpm 11 ignores the pnpm field in package.json (caught locally via the WARN before pushing); settings live in pnpm-workspace.yaml. OKF_Nuxt: recorded the production-image and audit-policy decisions, updated log, indexes and open questions. --- Dockerfile | 63 +++++++++++++++++++ OKF_Nuxt/decisions/index.md | 2 + OKF_Nuxt/decisions/production-image.md | 57 +++++++++++++++++ .../decisions/vulnerability-audit-policy.md | 58 +++++++++++++++++ OKF_Nuxt/index.md | 2 + OKF_Nuxt/log.md | 5 ++ OKF_Nuxt/open-questions.md | 6 +- pnpm-workspace.yaml | 10 +++ 8 files changed, 201 insertions(+), 2 deletions(-) create mode 100644 OKF_Nuxt/decisions/production-image.md create mode 100644 OKF_Nuxt/decisions/vulnerability-audit-policy.md diff --git a/Dockerfile b/Dockerfile index e69de29..89a1b99 100644 --- a/Dockerfile +++ b/Dockerfile @@ -0,0 +1,63 @@ +# Production image for the Nuxt CV site. +# +# Shape: a runnable Node server (SSR). `nuxt build` emits a self-contained +# Nitro server (.output/server/index.mjs plus its traced dependencies and +# .output/public), so the runtime stage needs no dependency installation. +# This answers the open question in OKF_Nuxt/open-questions.md; the gateway +# proxies to this server instead of embedding static files (see +# OKF_Nuxt/decisions/production-image.md). +# +# Layer order follows OKF_Nuxt/decisions/build-layer-order.md: manifests +# before source, so dependency changes invalidate everything but source-only +# edits invalidate almost nothing. +# +# Base image is digest-pinned to the same node:26-slim digest as the dev +# container (OKF_Nuxt/decisions/dev-container-shape.md) - verified for the +# runner's arm64 and this workstation's x86_64. +# syntax: no BuildKit-only features used, so the default frontend suffices. + +FROM node:26-slim@sha256:d62f13676d530f7edf97782729df69713c8ccfe6631e7f62f9ccab65968719a8 AS build + +# pnpm pinned to the same version as CI (pr-checker.yml pins major 11) and +# the local toolchain (11.26.0). Installed via npm from the node image - no +# corepack, which current node images no longer bundle. +RUN npm install -g pnpm@11.26.0 + +WORKDIR /app + +# Manifests first: their layer only invalidates when dependencies change. +# --ignore-scripts skips the `nuxt prepare` postinstall (the source is not +# copied yet); `nuxt build` prepares what it needs itself. Native binaries +# (esbuild, unrs-resolver) come from platform-specific optional packages, +# not install scripts, so skipping scripts is safe here. +COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./ +RUN pnpm install --frozen-lockfile --ignore-scripts + +# Source last: the expensive layers above stay cached on source-only edits. +COPY . . +RUN pnpm build + + +FROM node:26-slim@sha256:d62f13676d530f7edf97782729df69713c8ccfe6631e7f62f9ccab65968719a8 + +# pnpm is NOT installed in the runtime image: nothing here runs pnpm. +ENV NODE_ENV=production \ + HOST=0.0.0.0 \ + PORT=3000 + +WORKDIR /app + +# Nitro's traced output includes .output/server/node_modules - the only +# thing the server needs. Runs as the image's non-root `node` user. +COPY --from=build --chown=node:node /app/.output ./.output + +USER node + +EXPOSE 3000 + +# node has no curl/wget in slim; use node's own fetch. The root path is +# served by the app itself, so a 2xx means the server is genuinely up. +HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \ + CMD node -e "fetch('http://127.0.0.1:3000/').then(r => process.exit(r.ok ? 0 : 1)).catch(() => process.exit(1))" + +CMD ["node", ".output/server/index.mjs"] diff --git a/OKF_Nuxt/decisions/index.md b/OKF_Nuxt/decisions/index.md index 3a8d814..5f1084f 100644 --- a/OKF_Nuxt/decisions/index.md +++ b/OKF_Nuxt/decisions/index.md @@ -2,10 +2,12 @@ * [PR pipeline layering](pr-pipeline-layering.md) - What runs pre-commit, what runs in Gitea Actions, what the AI review does, and the cost rule that decides. * [AI review setup](ai-review-setup.md) - Plan model, env-only auth against prompt injection, read-only agent, and the verdict line as the posting gate. +* [Vulnerability audit policy](vulnerability-audit-policy.md) - Blocking audit, reviewed ignore-list for unfixable advisories, and the pnpm-11 settings home. * [Release engineering](release-engineering.md) - release-please in manifest mode, conventional commits as input, message format enforced at commit time. * [Snyk paused and secrets policy](snyk-paused-and-secrets-policy.md) - Why the job is skipped rather than deleted, and the token scopes every workflow secret needs. * [Dev container shape](dev-container-shape.md) - The source is bind-mounted into a container that already holds the dependencies, and the dev server runs as the image's `node` user. * [Build layer order](build-layer-order.md) - Why the manifests are copied before the source, and what invalidates what. * [Build context filter](build-context-filter.md) - What `.dockerignore` may exclude, and the one thing it must never exclude. +* [Production image shape](production-image.md) - Multi-stage, digest-pinned, non-root runnable Node server; measured build and serve. * [Repository and compose layout](repo-and-compose-layout.md) - The Dockerfiles live with the app; the stack is assembled in `Local_Development`. * [Mockup layout](mockup-layout.md) - One `DESIGN.md` per screen, with the screenshot and the source embedded. diff --git a/OKF_Nuxt/decisions/production-image.md b/OKF_Nuxt/decisions/production-image.md new file mode 100644 index 0000000..6b52877 --- /dev/null +++ b/OKF_Nuxt/decisions/production-image.md @@ -0,0 +1,57 @@ +--- +type: Decision +title: Production image shape +description: The production Dockerfile is a runnable Node server for the SSR app - multi-stage, digest-pinned base, non-root, healthchecked. +tags: [decision, docker, nuxt, production] +status: stable +generated: { by: opencode-go/glm-5.3-flash, at: 2026-10-18T19:10:00Z } +verified: { by: human:noel, at: not yet } +sources: + - id: dockerfile + resource: Dockerfile + title: Production Dockerfile + - id: droast + resource: .gitea/workflows/pr-checker.yml + title: Dockerfile lint job (droast) +--- + +# Decision + +`Dockerfile` builds the production image as a **runnable Node server**: + +* Stage `build`: manifests first, `pnpm install --frozen-lockfile + --ignore-scripts`, then the full source, then `pnpm build` - Nitro emits a + self-contained `.output/server/index.mjs` with its traced dependencies. +* Stage runtime: only `.output` is copied (chowned to `node`), the process + runs as the image's non-root `node` user, the base image is the same + digest-pinned `node:26-slim` as the dev container, and a `HEALTHCHECK` + (node's own fetch, no curl in slim) polls the root path. + +This answers the previously open question "runnable Node server, or static +files embedded in the gateway". The static-in-gateway plan recorded in the +sibling `OKF_CV_Website` bundle predates the SSR reality of this repository: +the gateway must now **proxy to this server** instead of embedding +`.output/public/`. That sibling decision needs updating; the compose wiring +is still open. + +# Why `--ignore-scripts` + +The `postinstall` script (`nuxt prepare`) runs before the source is copied +and would fail. `nuxt build` prepares everything it needs itself. Native +binaries (esbuild, unrs-resolver) come from platform-specific optional +packages, not install scripts, so skipping scripts loses nothing. + +# Verified (measured, 2026-10-18) + +* `docker build` on x86_64: full build succeeds in-image ("Build complete"). +* `docker run`: HTTP 200 on `/` (28 KB page), process runs as + `uid=1000(node)`, healthcheck reports `healthy`. +* droast 1.7.0 (sha-verified): 0 errors; one accepted DF007 warning on + `COPY . .` - that line *is* the source-last layer design. +* arm64 correctness rests on the multi-arch digest pin (proven in CI for + the dev container); the image build itself has only run on x86_64. + +# Revisit when + +* The gateway/compose stack is assembled (proxy target, port, network). +* A `go` preset or full-static `nuxt generate` becomes preferable. diff --git a/OKF_Nuxt/decisions/vulnerability-audit-policy.md b/OKF_Nuxt/decisions/vulnerability-audit-policy.md new file mode 100644 index 0000000..a22ef94 --- /dev/null +++ b/OKF_Nuxt/decisions/vulnerability-audit-policy.md @@ -0,0 +1,58 @@ +--- +type: Decision +title: Vulnerability audit policy +description: The dependency audit blocks the pipeline, with an explicit reviewed ignore-list for advisories that have no patched release - the list lives in pnpm-workspace.yaml, because pnpm 11 no longer reads the pnpm field in package.json. +tags: [decision, security, ci, audit, pnpm] +status: draft +generated: { by: opencode-go/glm-5.3-flash, at: 2026-10-18T19:10:00Z } +verified: { by: human:noel, at: not yet } +sources: + - id: workspace + resource: pnpm-workspace.yaml + title: auditConfig.ignoreGhsas + - id: audit-job + resource: .gitea/workflows/pr-checker.yml + title: Dependency audit job +--- + +# Decision + +`pnpm audit --prod --audit-level moderate` stays **blocking** (no +`continue-on-error`). Advisories that cannot be fixed by upgrading are not +silenced but **reviewed and recorded**: `auditConfig.ignoreGhsas` in +`pnpm-workspace.yaml`, each entry with the date and reason, removed when a +patched version ships. + +Currently ignored (both verified against the advisory database and the npm +registries on 2026-10-18 - the newest published versions are the vulnerable +ones): + +* `GHSA-86w9-cpqp-85rv` - node-forge <= 1.4.0, high. Path: + `nuxt > @nuxt/nitro-server > nitropack > listhen > node-forge` - listhen + generates dev certificates; build/dev-time only, not in the server bundle. +* `GHSA-vfj7-8cjw-p6xm` - braces <= 3.0.3, high. Path: + `nitropack > globby > micromatch > braces` - globbing during build, no + attacker-controlled patterns at runtime. + +# Why + +A red job that can never go green trains everyone to ignore red - the same +silent-failure outcome "nothing fails silently" exists to prevent. The +ignore list is the opposite of silence: the audit still names what it +skipped ("2 ignored: 2 high") and the decision lives in a reviewable file. + +# The pnpm 11 lesson + +The first attempt put `auditConfig` under the `pnpm` field in +`package.json`. pnpm 11 warned and **ignored it** - settings moved to +`pnpm-workspace.yaml` (same reason the config-only workspace file needed +pnpm 11 in the first place). The warning was caught locally before pushing +by running the exact CI command. + +# Revisit when + +* A patched version ships for either package - remove the entry. +* A new advisory appears with a real patch - fix it by upgrading; the audit + gate does the enforcement. +* Snyk is re-enabled (its SAST/DAST scope is different; see + [snyk-paused-and-secrets-policy](snyk-paused-and-secrets-policy.md)). diff --git a/OKF_Nuxt/index.md b/OKF_Nuxt/index.md index dcf8a05..9ce3c3e 100644 --- a/OKF_Nuxt/index.md +++ b/OKF_Nuxt/index.md @@ -17,6 +17,7 @@ config files — the configs say what, these documents say why. * [PR pipeline layering](decisions/pr-pipeline-layering.md) - Three layers: pre-commit for cheap deterministic checks, Gitea Actions for thorough ones, AI review for judgment. * [AI review setup](decisions/ai-review-setup.md) - Plan model, env-only auth against prompt injection, read-only agent, verdict line as the posting gate. +* [Vulnerability audit policy](decisions/vulnerability-audit-policy.md) - Blocking audit; reviewed ignore-list for unfixable advisories in pnpm-workspace.yaml. * [Release engineering](decisions/release-engineering.md) - release-please in manifest mode; conventional commits enforced at commit time. * [Snyk paused and secrets policy](decisions/snyk-paused-and-secrets-policy.md) - Quota-paused job kept in place; `write:issue` scope required on every workflow token. @@ -25,6 +26,7 @@ config files — the configs say what, these documents say why. * [Dev container shape](decisions/dev-container-shape.md) - The source is bind-mounted into a container that already holds the dependencies, and the dev server runs as the image's `node` user. * [Build layer order](decisions/build-layer-order.md) - Why the manifests are copied before the source, and what invalidates what. * [Build context filter](decisions/build-context-filter.md) - What `.dockerignore` may exclude, and the one thing it must never exclude. +* [Production image shape](decisions/production-image.md) - Multi-stage, digest-pinned, non-root runnable Node server - measured build and serve. * [Repository and compose layout](decisions/repo-and-compose-layout.md) - The Dockerfiles live with the app; the stack is assembled in `Local_Development`. * [Mockup layout](decisions/mockup-layout.md) - One `DESIGN.md` per screen, with the screenshot and the source embedded. diff --git a/OKF_Nuxt/log.md b/OKF_Nuxt/log.md index 13e598d..44f6521 100644 --- a/OKF_Nuxt/log.md +++ b/OKF_Nuxt/log.md @@ -1,5 +1,10 @@ # Update Log +## 2026-10-18 (evening — release PR unblocked) +* **Decision**: Recorded the [production image shape](decisions/production-image.md) - multi-stage, digest-pinned `node:26-slim`, non-root, healthchecked runnable Node server. Built and served locally: HTTP 200, uid 1000, healthcheck healthy. This decides the question that had kept `Dockerfile` empty (and failing the droast job with `DF071`). +* **Decision**: Recorded the [vulnerability audit policy](decisions/vulnerability-audit-policy.md) - blocking audit with two reviewed ignores (`node-forge`, `braces`: no patched release exists; both build-time-only paths under nitropack). Learned en route: pnpm 11 ignores the `pnpm` field in `package.json` - settings live in `pnpm-workspace.yaml`. +* **Update**: Added both decisions to the [decisions index](decisions/index.md). + ## 2026-10-18 (later — CI/CD and releases) * **Creation**: Recorded the [PR pipeline layering](decisions/pr-pipeline-layering.md) — three layers (pre-commit, Gitea Actions, AI review), the cost rule that assigns checks to layers, and the failure modes the pipeline was designed against. * **Creation**: Recorded the [AI review setup](decisions/ai-review-setup.md): the `opencode-go` provider prefix (the wrong one failed every run with "Insufficient account funds"), the v2 installer (v1 cannot resolve model variants), env-only auth after the prompt-injection finding, the read-only permission set, and the verdict line as the posting gate. diff --git a/OKF_Nuxt/open-questions.md b/OKF_Nuxt/open-questions.md index 5720ccd..db3f181 100644 --- a/OKF_Nuxt/open-questions.md +++ b/OKF_Nuxt/open-questions.md @@ -9,14 +9,16 @@ generated: { by: opencode-go/glm-5.3-flash, at: 2026-10-18T12:41:52Z } | Question | Needed by | Default if nobody decides | |---|---|---| -| Shape of the production image: a runnable Node server, or static `.output/public/` files for the gateway to embed | the next Dockerfile step | None. The empty `Dockerfile` stays empty — and until it holds real instructions, the droast job will fail on it. | +| ~~Shape of the production image~~ - **decided**: runnable Node server, see [production image](decisions/production-image.md) | done | — | | How the compose service mounts the source: the whole repository plus a volume for `node_modules`, or only the directories that get edited | finishing `Local_Development/docker-compose.yml` | None. The compose file is not yet valid. | -| Which pnpm version the production image pins | writing the production image | The same as dev, 11.26.0. | +| Which pnpm version the production image pins | ~~writing the production image~~ **decided**: 11.26.0, same as dev ([production image](decisions/production-image.md)) | done | +| How the gateway serves the site now that the production image is an SSR Node server (proxy to the server, instead of embedding static files) | updating the sibling `OKF_CV_Website` decision `static-nuxt-in-gateway` | Proxy to the server. | | Whether these decisions stay in this bundle or fold into the sibling `OKF_CV_Website` bundle, which already describes the frontend at design level | after the production image exists | None. | | When and how often Snyk runs once re-enabled: weekly schedule, ready-for-review gate, or per-push | re-enabling the snyk job | Stay disabled. | | Whether the AI review job should gate merges (required status check on the verdict) or stay advisory | branch protection setup | Advisory. The review comment is information; blocking merges on an AI verdict is a policy choice, not a technical one. | | How the opencode CLI version in CI gets upgraded: manually bump the pinned 2.0.32, or automate when a new major appears | first review failure after an opencode release | Manual bump. Pinning exists so upgrades are decisions. | | Whether the Go plan's per-model usage windows ($3 per 5 hours for DeepSeek V4 Pro) survive real review frequency, or the review model must move to `deepseek-v4.1-flash` ($80 window) | first quota-limited review | Switch to flash. | +| Removing the two reviewed audit ignores when `node-forge` or `braces` ship patched releases | next dependency update round | Watch for new releases. | # The mount trade-off, in detail diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index e6bf04f..018ad96 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -1,6 +1,16 @@ allowBuilds: esbuild: true unrs-resolver: true +auditConfig: + # Reviewed ignores for advisories with NO patched release (verified against + # the advisory database and npm registries on 2026-10-18: node-forge 1.4.0 + # and braces 3.0.3 are the newest published versions). Both packages are + # build-time-only paths under nitropack (listhen dev-cert generation, + # globby file globbing) - not in the running server's bundle. Remove an + # entry when a patched version ships. + ignoreGhsas: + - GHSA-86w9-cpqp-85rv + - GHSA-vfj7-8cjw-p6xm minimumReleaseAgeExclude: - '@rollup/rollup-darwin-x64@4.64.8' - '@rollup/rollup-freebsd-arm64@4.64.8'