From 8b6bcb6d70d123dda551f08ef2c05dc3d50733f2 Mon Sep 17 00:00:00 2001 From: Noel Sabia Date: Sun, 18 Oct 2026 16:53:16 +0200 Subject: [PATCH 01/12] fix(ci): use opencode-go plan model for AI review The 'opencode' provider prefix points at OpenCode Zen (pay-per-call, no funds), which failed every review run with 'Insufficient account funds'. The opencode-go $10 plan covers deepseek-v4-pro with high and max variants - use opencode-go/deepseek-v4-pro#max. --- .gitea/workflows/pr-checker.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/pr-checker.yml b/.gitea/workflows/pr-checker.yml index ad840ff..fff653a 100644 --- a/.gitea/workflows/pr-checker.yml +++ b/.gitea/workflows/pr-checker.yml @@ -204,14 +204,16 @@ jobs: env: OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }} run: | - # deepseek-v4-pro#max: flagship reasoning model at maximum thinking - # budget. Requires funds on the opencode account. - # Cheaper fallbacks: opencode/deepseek-v4.1-flash, or remove "#max". + # opencode-go/deepseek-v4-pro#max: flagship reasoning model at + # maximum thinking budget - included in the opencode-go $10 plan + # (variants: high, max). NOTE the provider prefix must be + # "opencode-go", NOT "opencode" (Zen is a different, pay-per-call + # provider and fails with 'Insufficient account funds'). # Output is redirected (not piped through tee): if opencode fails, # the job must fail here so the error log is never posted as a # "review" comment. opencode run \ - --model opencode/deepseek-v4-pro#max \ + --model opencode-go/deepseek-v4-pro#max \ "You are a principal engineer performing a rigorous code review on a pull request. You have tool access: read repo files for context when the diff alone is ambiguous, but review ONLY code changed in this PR. -- 2.54.0 From 8f36f14720a4826fe4b4cebdf591994fa0961ae3 Mon Sep 17 00:00:00 2001 From: Noel Sabia Date: Sun, 18 Oct 2026 16:58:10 +0200 Subject: [PATCH 02/12] fix: remove leftover merge conflict marker from pr-checker.yml --- .gitea/workflows/pr-checker.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitea/workflows/pr-checker.yml b/.gitea/workflows/pr-checker.yml index d9e2621..fff653a 100644 --- a/.gitea/workflows/pr-checker.yml +++ b/.gitea/workflows/pr-checker.yml @@ -209,7 +209,6 @@ jobs: # (variants: high, max). NOTE the provider prefix must be # "opencode-go", NOT "opencode" (Zen is a different, pay-per-call # provider and fails with 'Insufficient account funds'). ->>>>>>> origin/main # Output is redirected (not piped through tee): if opencode fails, # the job must fail here so the error log is never posted as a # "review" comment. -- 2.54.0 From a6761fae9a2ba633dcfa6c577154f181a7539f4f Mon Sep 17 00:00:00 2001 From: Noel Sabia Date: Sun, 18 Oct 2026 17:04:15 +0200 Subject: [PATCH 03/12] ci: make dependency audit blocking, log opencode errors - audit no longer runs with continue-on-error: a failed audit must turn the pipeline red, not pass silently - opencode review runs with --print-logs so auth and provider errors (e.g. invalid API key vs missing Go subscription) appear in the job log instead of an opaque exit 1 --- .gitea/workflows/pr-checker.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/pr-checker.yml b/.gitea/workflows/pr-checker.yml index fff653a..2f671c3 100644 --- a/.gitea/workflows/pr-checker.yml +++ b/.gitea/workflows/pr-checker.yml @@ -109,7 +109,8 @@ jobs: - name: Audit dependencies for known vulnerabilities working-directory: ${{ env.APP_DIR }} run: pnpm audit --prod --audit-level moderate - continue-on-error: true # advisory: does not block the PR by default + # blocks the PR on vulnerabilities - flip to true only if a CVE fix + # is genuinely blocked, never to make red pipelines "go away" # ------------------------------------------------------- dockerfile lint -- dockerfile-lint: @@ -212,7 +213,10 @@ jobs: # Output is redirected (not piped through tee): if opencode fails, # the job must fail here so the error log is never posted as a # "review" comment. + # --print-logs: surface auth/provider errors in the CI log instead + # of failing with an opaque exit code opencode run \ + --print-logs \ --model opencode-go/deepseek-v4-pro#max \ "You are a principal engineer performing a rigorous code review on a pull request. You have tool access: read repo files for context when -- 2.54.0 From 5f1d64db9011ba65fb2a2d1032b4d7ae0e02d32e Mon Sep 17 00:00:00 2001 From: Noel Sabia Date: Sun, 18 Oct 2026 17:08:46 +0200 Subject: [PATCH 04/12] ci: bind opencode API key explicitly via opencode.json The headless CI container has no stored credentials, so auth depends entirely on the injected key. Generate an opencode.json at runtime that binds OPENCODE_API_KEY to the opencode-go provider explicitly, removing any dependence on env-var-to-provider mapping behavior. --- .gitea/workflows/pr-checker.yml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/pr-checker.yml b/.gitea/workflows/pr-checker.yml index 2f671c3..45f2515 100644 --- a/.gitea/workflows/pr-checker.yml +++ b/.gitea/workflows/pr-checker.yml @@ -210,9 +210,19 @@ jobs: # (variants: high, max). NOTE the provider prefix must be # "opencode-go", NOT "opencode" (Zen is a different, pay-per-call # provider and fails with 'Insufficient account funds'). - # Output is redirected (not piped through tee): if opencode fails, - # the job must fail here so the error log is never posted as a - # "review" comment. + # + # Belt and suspenders on auth: OPENCODE_API_KEY is exported for + # env-based pickup, AND an opencode.json is generated that binds + # the key to the opencode-go provider explicitly - so headless CI + # never depends on env-var mapping behavior. + printf '{ + "$schema": "https://opencode.ai/config.json", + "provider": { + "opencode-go": { + "options": { "apiKey": "%s" } + } + } + }' "$OPENCODE_API_KEY" > opencode.json # --print-logs: surface auth/provider errors in the CI log instead # of failing with an opaque exit code opencode run \ -- 2.54.0 From cf6f209ebf03c3a4faf4e32971ba036d60ddb36b Mon Sep 17 00:00:00 2001 From: Noel Sabia Date: Sun, 18 Oct 2026 17:11:31 +0200 Subject: [PATCH 05/12] fix(ci): make droast job actually run The dockerfile-lint job skipped on every PR despite Dockerfiles existing: the act runner's hashFiles() evaluation returned empty. Replace it with an explicit file-discovery step. Also run the droast binary in node:22-bookworm (arch-aware install) instead of the vendor image, which ships no node and would fail actions/checkout with exit 127 - same failure mode as the gitleaks image. --- .gitea/workflows/pr-checker.yml | 39 +++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/pr-checker.yml b/.gitea/workflows/pr-checker.yml index 45f2515..c7c65cc 100644 --- a/.gitea/workflows/pr-checker.yml +++ b/.gitea/workflows/pr-checker.yml @@ -116,14 +116,45 @@ jobs: dockerfile-lint: name: Dockerfile lint (droast) runs-on: ubuntu-latest - container: - image: immanuwell/droast:1.7.0 - # skips until the repo contains a Dockerfile - if: ${{ hashFiles('**/Dockerfile', '**/Dockerfile.*', '**/Containerfile') != '' }} + # droast's own container image ships no node (actions/checkout would + # fail with exit 127 - same as the gitleaks image), so run the droast + # binary in the multi-arch node image instead + container: node:22-bookworm steps: - uses: actions/checkout@v4 + - name: Install droast + run: | + case "$(uname -m)" in + x86_64) DROAST_ASSET=droast-linux-x86_64 ;; + aarch64) DROAST_ASSET=droast-linux-arm64 ;; + *) echo "unsupported arch: $(uname -m)" && exit 1 ;; + esac + curl -fsSL -o /usr/local/bin/droast \ + "https://github.com/immanuwell/dockerfile-roast/releases/download/1.7.0/${DROAST_ASSET}" + chmod +x /usr/local/bin/droast + droast --version + + - name: Discover Dockerfiles + id: discover + # shell check instead of hashFiles: the act runner's hashFiles + # evaluation returned empty and silently skipped the job even when + # Dockerfiles existed + run: | + found="$(find . \ + -path ./.git -prune -o -path ./node_modules -prune -o \ + -type f \( -iname 'Dockerfile*' -o -iname '*dockerfile' -o -iname 'Containerfile*' \) \ + -print | head -n 1)" + if [ -n "$found" ]; then + echo "found=true" >> "$GITHUB_OUTPUT" + echo "Dockerfile found: $found" + else + echo "found=false" >> "$GITHUB_OUTPUT" + echo "No Dockerfile in repo - nothing to lint" + fi + - name: Lint Dockerfile(s) + if: ${{ steps.discover.outputs.found == 'true' }} run: | # --no-roast = technical output for CI; --min-severity warning so # info-level findings don't block the PR -- 2.54.0 From 783c9ccda369fe5ec05ea5085488998de125045c Mon Sep 17 00:00:00 2001 From: Noel Sabia Date: Sun, 18 Oct 2026 17:18:54 +0200 Subject: [PATCH 06/12] fix(ci): install opencode v2 for the review job The classic installer (opencode.ai/install) ships only OpenCode 1.x - v1.19.3 on arm64 - which cannot resolve model variants and failed with ProviderModelNotFoundError for deepseek-v4-pro#max. Use the v2 installer (currently v2.0.32, same version as local dev); verified working in a fresh arm64 container with key-only auth. --- .gitea/workflows/pr-checker.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/pr-checker.yml b/.gitea/workflows/pr-checker.yml index c7c65cc..2881863 100644 --- a/.gitea/workflows/pr-checker.yml +++ b/.gitea/workflows/pr-checker.yml @@ -215,10 +215,10 @@ jobs: fetch-depth: 0 - name: Install opencode CLI - run: curl -fsSL https://opencode.ai/install | bash - env: - # pin the version for reproducible CI, e.g. v1.0.0 - OPENCODE_VERSION: latest + run: curl -fsSL https://opencode.ai/v2/install | bash + # v2 installer is required: the classic /install URL ships only + # OpenCode 1.x (resolved to v1.19.3 on arm64), which cannot resolve + # model variants like "#max" and failed with ProviderModelNotFoundError - name: Get PR diff run: | -- 2.54.0 From f8d128705faa9493202cf724ae0a451d4dc6d1e5 Mon Sep 17 00:00:00 2001 From: Noel Sabia Date: Sun, 18 Oct 2026 17:34:17 +0200 Subject: [PATCH 07/12] fix(ci): deny write tools, never swallow review errors - deny edit/bash/webfetch in the generated opencode.json: headless permission prompts are the most likely cause of the review agent working silently for minutes and then dying; denying write tools also makes the reviewer provably read-only - capture the exit code without triggering 'set -e' ('|| EXIT_CODE=$?') so the captured output is always printed before failing - the previous version aborted before 'cat' and produced silent failures --- .gitea/workflows/pr-checker.yml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/pr-checker.yml b/.gitea/workflows/pr-checker.yml index 2881863..8eb3472 100644 --- a/.gitea/workflows/pr-checker.yml +++ b/.gitea/workflows/pr-checker.yml @@ -252,10 +252,19 @@ jobs: "opencode-go": { "options": { "apiKey": "%s" } } + }, + "permission": { + "edit": "deny", + "bash": "deny", + "webfetch": "deny" } }' "$OPENCODE_API_KEY" > opencode.json # --print-logs: surface auth/provider errors in the CI log instead # of failing with an opaque exit code + # Read-only agent: denying edit/bash/webfetch means no headless + # permission prompts can hang or kill the run, and the reviewer + # physically cannot modify the repo. + EXIT_CODE=0 opencode run \ --print-logs \ --model opencode-go/deepseek-v4-pro#max \ @@ -325,12 +334,12 @@ jobs: End your response with a final verdict line, exactly one of: VERDICT: APPROVE (no BLOCKER findings) VERDICT: REQUEST_CHANGES (at least one BLOCKER)" \ - > /tmp/review.md 2>&1 - EXIT_CODE=$? + > /tmp/review.md 2>&1 || EXIT_CODE=$? + # always show the output - never swallow the error text cat /tmp/review.md - if [ $EXIT_CODE -ne 0 ]; then + if [ "$EXIT_CODE" -ne 0 ]; then echo "::error::opencode review failed (exit ${EXIT_CODE}) - NOT posting this output as a review comment" - exit $EXIT_CODE + exit "$EXIT_CODE" fi - name: Post review as PR comment -- 2.54.0 From 85f488a94dd8796ea5f11c292edddd32e21398cd Mon Sep 17 00:00:00 2001 From: Noel Sabia Date: Sun, 18 Oct 2026 17:54:06 +0200 Subject: [PATCH 08/12] fix(ci): address AI review findings (credentials, supply chain) - [BLOCKER] remove opencode.json from the checkout: it held the API key in plaintext, readable by the review agent, and a malicious PR diff could prompt-inject the agent into quoting it in the publicly visible review comment. Env-only auth (verified headless). The permission config moves to $HOME/.config/opencode - outside the checkout and secret-free. - [WARN] verify the droast binary against the publisher's sha256sums.txt of the same pinned release - [WARN] pin the opencode v2 installer to 2.0.32 Findings validated with the validate-pr-review skill; findings 4/5 are moot with the blocker fix. --- .gitea/workflows/pr-checker.yml | 38 ++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/.gitea/workflows/pr-checker.yml b/.gitea/workflows/pr-checker.yml index 8eb3472..062d693 100644 --- a/.gitea/workflows/pr-checker.yml +++ b/.gitea/workflows/pr-checker.yml @@ -132,8 +132,11 @@ jobs: esac curl -fsSL -o /usr/local/bin/droast \ "https://github.com/immanuwell/dockerfile-roast/releases/download/1.7.0/${DROAST_ASSET}" - chmod +x /usr/local/bin/droast - droast --version + # verify against the publisher's checksum file of the same pinned + # release (upstream sha256sums.txt matches our own verification) + curl -fsSL -o /tmp/droast-sha256sums.txt \ + "https://github.com/immanuwell/dockerfile-roast/releases/download/1.7.0/sha256sums.txt" + echo "$(grep "${DROAST_ASSET}\$" /tmp/droast-sha256sums.txt)" | (cd /usr/local/bin && sha256sum -c -) - name: Discover Dockerfiles id: discover @@ -215,10 +218,12 @@ jobs: fetch-depth: 0 - name: Install opencode CLI - run: curl -fsSL https://opencode.ai/v2/install | bash + run: curl -fsSL https://opencode.ai/v2/install | bash -s -- -v 2.0.32 # v2 installer is required: the classic /install URL ships only # OpenCode 1.x (resolved to v1.19.3 on arm64), which cannot resolve - # model variants like "#max" and failed with ProviderModelNotFoundError + # model variants like "#max" and failed with ProviderModelNotFoundError. + # Version pinned (-v 2.0.32) so a breaking v2 release cannot fail + # the job mid-PR; bump deliberately, not automatically. - name: Get PR diff run: | @@ -242,28 +247,27 @@ jobs: # "opencode-go", NOT "opencode" (Zen is a different, pay-per-call # provider and fails with 'Insufficient account funds'). # - # Belt and suspenders on auth: OPENCODE_API_KEY is exported for - # env-based pickup, AND an opencode.json is generated that binds - # the key to the opencode-go provider explicitly - so headless CI - # never depends on env-var mapping behavior. + # Auth is env-only: the CLI picks up OPENCODE_API_KEY from the + # environment (verified headless). Deliberately NO opencode.json: + # a config file in the checkout would hold the API key in + # plaintext, readable by the agent - a malicious PR diff could + # prompt-inject the agent into quoting the key in the review + # comment (publicly visible). Env vars are invisible to file reads. + # Permissions live in a global config OUTSIDE the checkout (no + # secrets in it, so nothing can leak): denying edit/bash/webfetch + # means no headless permission prompts can hang or kill the run, + # and the reviewer physically cannot modify the repo. + mkdir -p "$HOME/.config/opencode" printf '{ "$schema": "https://opencode.ai/config.json", - "provider": { - "opencode-go": { - "options": { "apiKey": "%s" } - } - }, "permission": { "edit": "deny", "bash": "deny", "webfetch": "deny" } - }' "$OPENCODE_API_KEY" > opencode.json + }' > "$HOME/.config/opencode/opencode.json" # --print-logs: surface auth/provider errors in the CI log instead # of failing with an opaque exit code - # Read-only agent: denying edit/bash/webfetch means no headless - # permission prompts can hang or kill the run, and the reviewer - # physically cannot modify the repo. EXIT_CODE=0 opencode run \ --print-logs \ -- 2.54.0 From a3e6aef901086f5f8b416e2aa7d29596517f9550 Mon Sep 17 00:00:00 2001 From: Noel Sabia Date: Sun, 18 Oct 2026 18:01:13 +0200 Subject: [PATCH 09/12] fix(ci): apply review findings round two - droast: chmod +x was lost in the checksum rewrite (would have failed with exit 126); checksums now pinned in the workflow instead of trust-on-first-use - permission config migrated to the OpenCode v2 schema (permissions array, bash renamed shell, websearch and external_directory denied) - posting gate is now the output contract (verdict line present) instead of the exit code: opencode can exit 1 on benign tool denials after a completed review - find -print -quit instead of piping into head (SIGPIPE, exit 141) - audit comment now says to re-add continue-on-error --- .gitea/workflows/pr-checker.yml | 49 ++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 16 deletions(-) diff --git a/.gitea/workflows/pr-checker.yml b/.gitea/workflows/pr-checker.yml index 062d693..553a9ca 100644 --- a/.gitea/workflows/pr-checker.yml +++ b/.gitea/workflows/pr-checker.yml @@ -126,17 +126,18 @@ jobs: - name: Install droast run: | case "$(uname -m)" in - x86_64) DROAST_ASSET=droast-linux-x86_64 ;; - aarch64) DROAST_ASSET=droast-linux-arm64 ;; + x86_64) DROAST_ASSET=droast-linux-x86_64; DROAST_SHA=cadb963a040ba2e68641af764f794e5d4fb3371bb9b92255fa5027060b08ea6e ;; + aarch64) DROAST_ASSET=droast-linux-arm64; DROAST_SHA=0800e80d11f668615fc87750f58809b56bedca83ec6d8a539daa56f42da64bc3 ;; *) echo "unsupported arch: $(uname -m)" && exit 1 ;; esac curl -fsSL -o /usr/local/bin/droast \ "https://github.com/immanuwell/dockerfile-roast/releases/download/1.7.0/${DROAST_ASSET}" - # verify against the publisher's checksum file of the same pinned - # release (upstream sha256sums.txt matches our own verification) - curl -fsSL -o /tmp/droast-sha256sums.txt \ - "https://github.com/immanuwell/dockerfile-roast/releases/download/1.7.0/sha256sums.txt" - echo "$(grep "${DROAST_ASSET}\$" /tmp/droast-sha256sums.txt)" | (cd /usr/local/bin && sha256sum -c -) + # verify against the pinned hash checked into this workflow + # (fetching the checksum from the same release as the binary + # would be trust-on-first-use and prove nothing) + echo "${DROAST_SHA} /usr/local/bin/droast" | sha256sum -c - + chmod +x /usr/local/bin/droast + droast --version - name: Discover Dockerfiles id: discover @@ -144,10 +145,12 @@ jobs: # evaluation returned empty and silently skipped the job even when # Dockerfiles existed run: | + # Discovery: -print -quit instead of `| head -n 1` - head can + # SIGPIPE find (exit 141) when multiple Dockerfiles match found="$(find . \ -path ./.git -prune -o -path ./node_modules -prune -o \ -type f \( -iname 'Dockerfile*' -o -iname '*dockerfile' -o -iname 'Containerfile*' \) \ - -print | head -n 1)" + -print -quit)" if [ -n "$found" ]; then echo "found=true" >> "$GITHUB_OUTPUT" echo "Dockerfile found: $found" @@ -258,13 +261,19 @@ jobs: # means no headless permission prompts can hang or kill the run, # and the reviewer physically cannot modify the repo. mkdir -p "$HOME/.config/opencode" + # OpenCode v2 permission schema: ordered array of + # {action, resource, effect}; "bash" was renamed "shell" in v2. + # websearch is a distinct action from webfetch - deny both, plus + # external directories. printf '{ "$schema": "https://opencode.ai/config.json", - "permission": { - "edit": "deny", - "bash": "deny", - "webfetch": "deny" - } + "permission": [ + { "action": "edit", "resource": "*", "effect": "deny" }, + { "action": "shell", "resource": "*", "effect": "deny" }, + { "action": "webfetch", "resource": "*", "effect": "deny" }, + { "action": "websearch", "resource": "*", "effect": "deny" }, + { "action": "external_directory", "resource": "*", "effect": "deny" } + ] }' > "$HOME/.config/opencode/opencode.json" # --print-logs: surface auth/provider errors in the CI log instead # of failing with an opaque exit code @@ -341,9 +350,17 @@ jobs: > /tmp/review.md 2>&1 || EXIT_CODE=$? # always show the output - never swallow the error text cat /tmp/review.md - if [ "$EXIT_CODE" -ne 0 ]; then - echo "::error::opencode review failed (exit ${EXIT_CODE}) - NOT posting this output as a review comment" - exit "$EXIT_CODE" + # The posting gate is the OUTPUT CONTRACT, not the exit code: + # a completed review always ends with a VERDICT line - error + # dumps never do. opencode can exit 1 on benign tool denials + # even after a full review, so a present verdict means post; + # anything else means the review did not complete. + if grep -qE '^VERDICT: (APPROVE|REQUEST_CHANGES)' /tmp/review.md; then + [ "$EXIT_CODE" -ne 0 ] && echo "::warning::opencode exited ${EXIT_CODE} but produced a valid verdict - posting review" + echo "Review completed with verdict." + else + echo "::error::opencode produced no valid review (exit ${EXIT_CODE:-1}) - NOT posting this output as a review comment" + exit "${EXIT_CODE:-1}" fi - name: Post review as PR comment -- 2.54.0 From 9987d6b8e4a2200d6130cc97e88ebabd4aed5d76 Mon Sep 17 00:00:00 2001 From: Noel Sabia Date: Sun, 18 Oct 2026 18:09:45 +0200 Subject: [PATCH 10/12] chore: add release-please configuration (from release_please_advanced) - release-please-config.json: node release type, root package, plain v-tags, default versioning - .release-please-manifest.json: track current version (1.0.0) - package.json: add version field required by the node release type - release-please.yml: use the config/manifest files --- .gitea/workflows/release-please.yml | 3 ++- .release-please-manifest.json | 3 +++ package.json | 1 + release-please-config.json | 15 +++++++++++++++ 4 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 .release-please-manifest.json create mode 100644 release-please-config.json diff --git a/.gitea/workflows/release-please.yml b/.gitea/workflows/release-please.yml index 2f8395a..9f874d2 100644 --- a/.gitea/workflows/release-please.yml +++ b/.gitea/workflows/release-please.yml @@ -16,4 +16,5 @@ jobs: - uses: joaquinjsb/gitea-release-please-action@v4 with: token: ${{ secrets.RELEASE_PLEASE_TOKEN_CV_SITE_NUXT }} - release-type: simple + config-file: release-please-config.json + manifest-file: .release-please-manifest.json diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000..e18ee07 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "0.0.0" +} diff --git a/package.json b/package.json index bb958d4..fb8ad3e 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,6 @@ { "name": "nuxt-app", + "version": "1.0.0", "type": "module", "private": true, "scripts": { diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..052b86e --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,15 @@ +{ + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", + "release-type": "node", + "include-component-in-tag": false, + "separate-pull-requests": false, + "packages": { + ".": { + "package-name": "CV_Site_Frontend", + "changelog-path": "CHANGELOG.md", + "extra-files": [], + "versioning": "default" + } + }, + "plugins": [] +} -- 2.54.0 From bb0ab03a97acfea43c3688fb16d7ed68f8208c04 Mon Sep 17 00:00:00 2001 From: Noel Sabia Date: Sun, 18 Oct 2026 18:09:45 +0200 Subject: [PATCH 11/12] docs: add OKF_Nuxt decision records and log --- OKF_Nuxt/decisions/build-context-filter.md | 76 ++++++++++++++++ OKF_Nuxt/decisions/build-layer-order.md | 57 ++++++++++++ OKF_Nuxt/decisions/dev-container-shape.md | 89 +++++++++++++++++++ OKF_Nuxt/decisions/index.md | 7 ++ OKF_Nuxt/decisions/mockup-layout.md | 55 ++++++++++++ OKF_Nuxt/decisions/repo-and-compose-layout.md | 44 +++++++++ OKF_Nuxt/index.md | 16 ++++ OKF_Nuxt/log.md | 8 ++ OKF_Nuxt/open-questions.md | 38 ++++++++ 9 files changed, 390 insertions(+) create mode 100644 OKF_Nuxt/decisions/build-context-filter.md create mode 100644 OKF_Nuxt/decisions/build-layer-order.md create mode 100644 OKF_Nuxt/decisions/dev-container-shape.md create mode 100644 OKF_Nuxt/decisions/index.md create mode 100644 OKF_Nuxt/decisions/mockup-layout.md create mode 100644 OKF_Nuxt/decisions/repo-and-compose-layout.md create mode 100644 OKF_Nuxt/index.md create mode 100644 OKF_Nuxt/log.md create mode 100644 OKF_Nuxt/open-questions.md diff --git a/OKF_Nuxt/decisions/build-context-filter.md b/OKF_Nuxt/decisions/build-context-filter.md new file mode 100644 index 0000000..c433c54 --- /dev/null +++ b/OKF_Nuxt/decisions/build-context-filter.md @@ -0,0 +1,76 @@ +--- +type: Decision +title: Build context filter +description: The .dockerignore keeps secrets and noise out of the build context, but must never exclude a path the Dockerfile copies. +tags: [decision, docker, dockerignore] +status: stable +generated: { by: opencode/deepseek-v4.1-flash, at: 2026-10-18T12:41:52Z } +verified: { by: human:noel, at: 2026-10-18T12:41:52Z } +sources: + - id: docker-context + resource: https://docs.docker.com/build/building/context/ + title: Docker build context and .dockerignore files +--- + +# Decision + +Two rules, in this order: + +1. **Secrets never enter the build context** — `.env`, `.env.*` (with + `!.env.example` as an exception), `*.pem`, `*.key`, `.npmrc`. +2. **Noise stays out** — `node_modules`, `.nuxt`, `.output`, `.nitro`, `.data`, + `.cache`, `dist`, `*.log`, `coverage`, plus repo and editor metadata. + +And one rule that overrides both: **nothing the Dockerfile copies may appear in +the file.** The manifests, `nuxt.config.ts`, `app/`, `public/` and `tsconfig.json` +are deliberately absent. + +# Why + +`.dockerignore` does not decide what lands in the image; it decides what is sent +to the builder as the build context. What lands in the image is decided by `COPY` +and `RUN`. So the question is never "is this file dangerous to include" but "does +any instruction need this file, and is sending it costing something". + +That is what makes the two jobs conflict. A broad list is the right instinct when +the Dockerfile says `COPY . .`, because the list is then the only thing standing +between the working tree and the image. Explicitly copying named manifests +inverts it: the list stops protecting and starts subtracting files the build +asks for. + +# The failure mode + +Excluding a `COPY` target does not silently skip the file. It warns, then fails +the build. Measured on a scratch context containing only `package.json` and +`pnpm-workspace.yaml`, with `pnpm-workspace.yaml` in the ignore file: + +``` + - CopyIgnoredFile: Attempting to Copy file "pnpm-workspace.yaml" that is excluded by .dockerignore (line 2) +ERROR: failed to build: failed to solve: failed to compute cache key: +failed to calculate checksum of ref ...: "/pnpm-workspace.yaml": not found +``` + +The warning names the offending line of `.dockerignore`, which is the useful part: +the failure otherwise reads like a typo in the Dockerfile. + +`pnpm-workspace.yaml` is worth calling out because in pnpm 11 it is not only +workspace globs — it carries pnpm settings such as `allowBuilds` and +`minimumReleaseAgeExclude`, so excluding it from a build changes install +behaviour as well as breaking the copy. + +# Consequences + +* `.npmrc` sits under secrets, so registry configuration has to reach a build + through a build argument rather than the file. +* The excluded `Dockerfile`, `Dockerfile.*` and `.dockerignore` entries are safe: + those files are still sent to the builder because the build needs them, they + simply cannot be copied into the image. +* For the dev image the context is three manifests, so the rest of the list does + nothing there. The size effect it is meant to have lands in an image that does + copy the source. + +# Evidence + +The second dev build transferred a context of 108 bytes, which is the three +manifests and nothing else. The failure text above was reproduced in a scratch +context so the repository was not modified. diff --git a/OKF_Nuxt/decisions/build-layer-order.md b/OKF_Nuxt/decisions/build-layer-order.md new file mode 100644 index 0000000..bc08bba --- /dev/null +++ b/OKF_Nuxt/decisions/build-layer-order.md @@ -0,0 +1,57 @@ +--- +type: Decision +title: Build layer order +description: Manifests are copied and installed before any source, so a source edit cannot invalidate the dependency install. +tags: [decision, docker, caching] +status: stable +generated: { by: opencode/deepseek-v4.1-flash, at: 2026-10-18T12:41:52Z } +verified: { by: human:noel, at: 2026-10-18T12:41:52Z } +sources: + - id: docker-cache + resource: https://docs.docker.com/build/cache/ + title: Docker build cache +--- + +# Decision + +Order the instructions so that the things that change rarely are installed +first, and the things that change constantly are copied last. + +1. Base image, then the toolchain (`pnpm`). +2. `COPY` the manifests only — `package.json`, `pnpm-lock.yaml`, `pnpm-workspace.yaml`. +3. `pnpm install --frozen-lockfile`. +4. (In an image that copies source at all) `COPY` the source, then build. + +# Why + +Each instruction is a layer, and a change in one layer invalidates that layer and +every layer after it. The install is the slow step, so anything that changes +often — the source — has to sit after it. Copying the whole source before +installing would make every source edit re-run the install, which is exactly the +cost the ordering is meant to avoid. + +# What invalidates what + +| Change | Effect | +|---|---| +| Edit `app/app.vue` | Nothing. In the dev image the source is never copied, so no layer depends on it. | +| Edit `package.json`, `pnpm-lock.yaml` or `pnpm-workspace.yaml` | The `COPY` of the manifests and the install after it re-run; earlier layers stay cached. | +| Change the pinned base image or the `pnpm` version | Everything from that instruction onward re-runs. | + +# Evidence + +The second consecutive `docker build -f Dockerfile.dev` reported every layer as +`CACHED`, and the context transfer was 108 bytes — it contains only the three +manifests, so no source edit can reach any layer. + +# Not chosen + +An earlier draft of the dev file ended with `COPY . . --cache` and +`pnpm build`. The `COPY` instruction has no `--cache` flag, so that line is a +build error, and building the application into a dev image works against running +the dev server from a mounted source. + +# Revisit when + +The project gains a second package with its own manifest, which changes what +belongs in the manifests-only copy. diff --git a/OKF_Nuxt/decisions/dev-container-shape.md b/OKF_Nuxt/decisions/dev-container-shape.md new file mode 100644 index 0000000..3969323 --- /dev/null +++ b/OKF_Nuxt/decisions/dev-container-shape.md @@ -0,0 +1,89 @@ +--- +type: Decision +title: Dev container shape +description: The Nuxt source is bind-mounted into a container that already holds the toolchain and the dependencies, and the dev server runs as the image's node user. +tags: [decision, docker, nuxt, development] +status: stable +generated: { by: opencode/deepseek-v4.1-flash, at: 2026-10-18T12:41:52Z } +verified: { by: human:noel, at: 2026-10-18T12:41:52Z } +sources: + - id: node-image + resource: docker.io/library/node:26-slim@sha256:d62f13676d530f7edf97782729df69713c8ccfe6631e7f62f9ccab65968719a8 + title: Node 26 slim base image +--- + +# Decision + +`Dockerfile.dev` is a prepared runtime, not a build of the application. It holds +the toolchain and the installed dependencies. The source arrives at run time as a +bind mount, and the container runs the Nuxt dev server. There is no `COPY . .` and +no build step in the dev image. + +# Why + +The alternative is to copy the source into the image and rebuild on every edit, +which makes each edit cost a full image build. With the source mounted, an edit is +a file write and the dev server's own reload does the rest. The image stops being +something you rebuild and becomes something you run. + +# Shape + +```dockerfile +FROM node:26-slim@sha256:d62f13676d530f7edf97782729df69713c8ccfe6631e7f62f9ccab65968719a8 + +# Node no longer bundles pnpm (corepack and pnpm are both absent from this +# image), so install it. First instruction, so later changes reuse the layer. +RUN npm install -g pnpm@11.26.0 + +# The bind mount lands here at run time, owned by the image's `node` user. +# Its uid 1000 matches the host uid, so files it writes stay yours. +RUN mkdir -p /app && chown node:node /app +USER node +WORKDIR /app + +# Manifests only: this layer and the install below survive every source edit +# and re-run only when a manifest changes. +COPY --chown=node:node package.json pnpm-lock.yaml pnpm-workspace.yaml ./ +RUN pnpm install --frozen-lockfile + +EXPOSE 3000 +CMD ["pnpm", "run", "dev", "--", "--host", "0.0.0.0"] +``` + +| Piece | Choice | Why | +|---|---|---| +| Base image | `node:26-slim`, pinned by digest | The digest makes the build reproducible; the checked digest resolves to Node v26.12.0. | +| pnpm | Installed explicitly, pinned to 11.26.0 | Neither `corepack` nor `pnpm` is present in the image. The pin matches the host version, so the same lockfile format is used on both sides. | +| User | The image's `node` user, uid 1000 | The host uid is also 1000. Files the dev server writes into the mounted repo stay owned by Noel instead of becoming root-owned. This is not a security measure. | +| `node_modules` | Anonymous volume at `/app/node_modules` | The bind mount replaces all of `/app`, which would otherwise hide the dependencies installed in the image. | +| Command | `pnpm run dev -- --host 0.0.0.0` | The dev server would otherwise listen on localhost inside the container and be unreachable from the host. The `--` passes the flag through pnpm to the `dev` script rather than letting pnpm interpret it. | + +# Evidence + +| Command | Result | +|---|---| +| `docker build -f Dockerfile.dev -t cv-site-nuxt:dev .` | Builds. `esbuild`'s postinstall ran, so the `allowBuilds` setting in `pnpm-workspace.yaml` is honoured. `pnpm install` reported "Lockfile passes supply-chain policies (593 entries)". | +| Same build run a second time | Every layer `CACHED`. | +| `docker run -v :/app -v /app/node_modules -p 13000:3000 cv-site-nuxt:dev` | `HTTP 200` from the host after 4 seconds; server reported "Ready in 2.02s". | +| `ls -A /app/node_modules` inside that container | 9 entries (`nuxt`, `vue`, `vue-router`, `.pnpm`, …) — the anonymous volume is populated from the image rather than starting empty. | +| Ownership of `.nuxt` on the host after that run | `noel:noel`, so the uid-1000 choice holds. | + +# Side effects on the host + +The bind mount means Docker resolves the mount point for the `node_modules` +volume through the host directory, so a first run leaves an empty, root-owned +`node_modules` in the repository. It deletes without sudo, and if the directory +already exists the ownership is left alone — a pre-created directory stays +`noel:noel`. + +# Not verified + +* `docker compose up --build -V` as the remedy for a stale anonymous volume after + a dependency change was not tested. +* That a root-owned `node_modules` breaks a host-side `pnpm install` is inferred + from the permissions, not measured. + +# Revisit when + +* The container runs on a machine whose uid is not 1000. +* The dev server needs a host port other than 3000. diff --git a/OKF_Nuxt/decisions/index.md b/OKF_Nuxt/decisions/index.md new file mode 100644 index 0000000..d49f20f --- /dev/null +++ b/OKF_Nuxt/decisions/index.md @@ -0,0 +1,7 @@ +# Decisions + +* [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. +* [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/mockup-layout.md b/OKF_Nuxt/decisions/mockup-layout.md new file mode 100644 index 0000000..5070da3 --- /dev/null +++ b/OKF_Nuxt/decisions/mockup-layout.md @@ -0,0 +1,55 @@ +--- +type: Decision +title: Mockup layout +description: Every mockup screen folder holds DESIGN.md, code.html and screen.png, with the screenshot and the full source embedded in the markdown. +tags: [decision, design, mockups] +status: stable +generated: { by: opencode/deepseek-v4.1-flash, at: 2026-10-18T12:41:52Z } +verified: { by: human:noel, at: 2026-10-18T12:41:52Z } +sources: + - id: stitch-export + resource: Stitch export "resilient_systems_engineer_portfolio", seven screens + title: Stitch export used for the mockups +--- + +# Decision + +Each screen is one folder holding three files, all at the same level: + +| File | Role | +|---|---| +| `DESIGN.md` | The screen as a document: frontmatter, the screenshot rendered inline, then the full source in a fenced block. | +| `code.html` | The screen's source, unchanged. | +| `screen.png` | The rendered screenshot, kept separately so it can be opened directly. | + +The export's folder names were replaced with short, consistent ones: + +| Export name | Folder | +|---|---| +| `noel_sabia_homepage_cv_overview` | `homepage` | +| `noel_sabia_overview_mobile` | `homepage_mobile` | +| `noel_sabia_dev_view_technical_telemetry` | `dev_view` | +| `noel_sabia_dev_view_mobile` | `dev_view_mobile` | +| `noel_sabia_life_map` | `life_map` | +| `noel_sabia_life_map_mobile` | `life_map_mobile` | +| `noel_sabia_infrastructure_ai_resilience` | `design_system` | + +# Why + +A screen should be readable as one document without opening anything else, which +is what embedding the screenshot and the source gives. Keeping `screen.png` beside +the markdown as well is for looking at the picture on its own, without reading the +document around it. + +The frontmatter on `DESIGN.md` — `type`, `title`, `description`, `tags`, +`status` — is also valid concept frontmatter, so these files are readable as +concepts if the mockups are ever folded into a knowledge bundle. + +# Notes + +* The export shipped `DESIGN.md` and nothing else for the infrastructure folder. + That folder is the design-token document, not a screen, so it deliberately has + no `code.html` and no `screen.png`. +* A second, byte-identical copy of the export was deleted. Equality was checked + file by file with `cmp` across all 13 files before anything was removed. +* Committed as `docs(design): embed screenshot and source into per-screen DESIGN.md`. diff --git a/OKF_Nuxt/decisions/repo-and-compose-layout.md b/OKF_Nuxt/decisions/repo-and-compose-layout.md new file mode 100644 index 0000000..bf5a2cf --- /dev/null +++ b/OKF_Nuxt/decisions/repo-and-compose-layout.md @@ -0,0 +1,44 @@ +--- +type: Decision +title: Repository and compose layout +description: Each application repository owns its Dockerfiles; Local_Development holds the compose file that assembles the stack. +tags: [decision, docker, compose, repositories] +status: stable +generated: { by: opencode/deepseek-v4.1-flash, at: 2026-10-18T12:41:52Z } +sources: + - id: okf-spec + resource: https://github.com/GoogleCloudPlatform/knowledge-catalog/blob/main/okf/SPEC.md + title: Open Knowledge Format specification, version 0.2 +--- + +# Decision + +* `CV_Site_Nuxt/` owns its images: `Dockerfile.dev` and `Dockerfile` live with the + application they build. +* `Local_Development/` is the stack entry point. Its `docker-compose.yml` builds + the application by relative path (`../CV_Site_Nuxt`) rather than duplicating any + build definition. +* The design mockups live in `Local_Development/design/`. +* This knowledge bundle lives inside the application repository it describes, + which the format allows for a bundle kept as a subdirectory of a larger + repository. + +# Why + +A Dockerfile is part of the application, not part of the environment that runs +it. Keeping it with the app means the image definition is versioned, reviewed and +released with the code it builds, and the compose file stays a thin description +of how the pieces are wired together for local work. + +# Consequences + +* The compose file cannot be built from a checkout of `Local_Development/` alone; + it needs the sibling application repository present. +* Adding a service means adding a compose entry that points at another + repository's Dockerfile. + +# State + +The compose file is being written and is not yet valid: the build key is +malformed and the port entry is empty. The shape of the mount it will use is still +an [open question](/open-questions.md). diff --git a/OKF_Nuxt/index.md b/OKF_Nuxt/index.md new file mode 100644 index 0000000..efd25ad --- /dev/null +++ b/OKF_Nuxt/index.md @@ -0,0 +1,16 @@ +--- +okf_version: "0.2" +--- + +# Start here + +* [Open questions](open-questions.md) - What is still undecided for the Nuxt site. +* [Update log](log.md) - History of changes to this bundle. + +# Decisions + +* [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. +* [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 new file mode 100644 index 0000000..0d9f6fc --- /dev/null +++ b/OKF_Nuxt/log.md @@ -0,0 +1,8 @@ +# Update Log + +## 2026-10-18 +* **Creation**: Established the Nuxt bundle [index](/index.md) and the [decisions](/decisions/index.md) index. +* **Decision**: Recorded the [dev container shape](/decisions/dev-container-shape.md) — source bind-mounted, dependencies in the image, run as the image's `node` user. +* **Decision**: Recorded [build layer order](/decisions/build-layer-order.md) and the [build context filter](/decisions/build-context-filter.md), including the measured failure when a `COPY` target is excluded. +* **Decision**: Recorded the [repository and compose layout](/decisions/repo-and-compose-layout.md) and the [mockup layout](/decisions/mockup-layout.md). +* **Creation**: Added [open questions](/open-questions.md), including the shape of the production image. diff --git a/OKF_Nuxt/open-questions.md b/OKF_Nuxt/open-questions.md new file mode 100644 index 0000000..92f5d19 --- /dev/null +++ b/OKF_Nuxt/open-questions.md @@ -0,0 +1,38 @@ +--- +type: Open Questions +title: Open questions +description: Decisions still to make for the Nuxt site, with what needs each answer. +tags: [decision, open] +status: draft +generated: { by: opencode/deepseek-v4.1-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. | +| 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. | +| 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. | + +# The mount trade-off, in detail + +Measured on the whole-repository mount: + +* An anonymous volume is created once. After a dependency change the stale + contents persist unless the volume is renewed, and the renewal command has not + been tested. +* Docker creates an empty, root-owned `node_modules` directory in the repository + on the first run, unless that directory already exists. + +The alternative — mounting only the directories that get edited — removes the +volume, the renewal step and the root-owned directory entirely, and keeps `.nuxt` +inside the container rather than in the working tree. It costs one compose line +per top-level directory, so a new directory silently fails to appear in the +container until the compose file is updated. + +# Related + +The Nuxt frontend is described at design level in `OKF_CV_Website`, in +`architecture/frontend.md` and `decisions/static-nuxt-in-gateway.md`. Those +documents state that the site is generated to static files and embedded in the +gateway image, which is an input to the production-image question above. -- 2.54.0 From 3e68e630dff92a7abd791b7a8808eb682f37a060 Mon Sep 17 00:00:00 2001 From: Noel Sabia Date: Sun, 18 Oct 2026 18:24:06 +0200 Subject: [PATCH 12/12] fix(ci): close the fail-open gate, enforce read-only sandbox Findings validated from review comments 71 and 75: - [BLOCKER] the no-verdict branch exited \${EXIT_CODE:-1} which is 0 when opencode succeeded without a verdict - job went green and the post step published non-review output. The else branch now exits 1 unconditionally, the verdict is anchored to the last five lines (the prompt itself contains VERDICT lines), and the post step re-verifies the contract before posting. - [BLOCKER] the v1 'permission' object is ignored by the opencode v2 CLI - shell commands executed in both review runs despite deny. The config now uses the v2 'permissions' array with 'shell' as the action name, denying edit/shell/webfetch/websearch/external_directory. - hygiene: droast linting prunes node_modules, audit comment names the exact key to re-add, shell blocks verified with sh -n. --- .gitea/workflows/pr-checker.yml | 47 ++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/.gitea/workflows/pr-checker.yml b/.gitea/workflows/pr-checker.yml index 553a9ca..65aa5b6 100644 --- a/.gitea/workflows/pr-checker.yml +++ b/.gitea/workflows/pr-checker.yml @@ -109,8 +109,9 @@ jobs: - name: Audit dependencies for known vulnerabilities working-directory: ${{ env.APP_DIR }} run: pnpm audit --prod --audit-level moderate - # blocks the PR on vulnerabilities - flip to true only if a CVE fix - # is genuinely blocked, never to make red pipelines "go away" + # blocks the PR on vulnerabilities - re-add `continue-on-error: true` + # here only if a CVE fix is genuinely blocked upstream, never to + # make a red pipeline green # ------------------------------------------------------- dockerfile lint -- dockerfile-lint: @@ -164,7 +165,13 @@ jobs: run: | # --no-roast = technical output for CI; --min-severity warning so # info-level findings don't block the PR - droast --no-roast --min-severity warning . + # lint exactly the tree the discovery step sees: prune node_modules + # and .git so vendored Dockerfiles in dependencies cannot produce + # findings on third-party code + find . \ + -path ./.git -prune -o -path ./node_modules -prune -o \ + -type f \( -iname 'Dockerfile*' -o -iname '*dockerfile' -o -iname 'Containerfile*' \) \ + -print0 | xargs -0 -r droast --no-roast --min-severity warning # ------------------------------------------------------- snyk security ---- # DISABLED: Snyk free plan only includes ~100 test credits/month, which the @@ -257,17 +264,19 @@ jobs: # prompt-inject the agent into quoting the key in the review # comment (publicly visible). Env vars are invisible to file reads. # Permissions live in a global config OUTSIDE the checkout (no - # secrets in it, so nothing can leak): denying edit/bash/webfetch - # means no headless permission prompts can hang or kill the run, - # and the reviewer physically cannot modify the repo. - mkdir -p "$HOME/.config/opencode" - # OpenCode v2 permission schema: ordered array of + # secrets in it, so nothing can leak). OpenCode v2 schema: the + # field is "permissions" (plural) - an ordered array of # {action, resource, effect}; "bash" was renamed "shell" in v2. - # websearch is a distinct action from webfetch - deny both, plus - # external directories. + # The singular v1 "permission" object is ignored by the v2 CLI + # (verified empirically: shell commands executed despite deny). + # Denying shell/edit/webfetch/websearch/external_directory means + # no headless permission prompts can hang or kill the run, and + # the reviewer physically cannot modify the repo or browse + # attacker-controlled URLs. + mkdir -p "$HOME/.config/opencode" printf '{ "$schema": "https://opencode.ai/config.json", - "permission": [ + "permissions": [ { "action": "edit", "resource": "*", "effect": "deny" }, { "action": "shell", "resource": "*", "effect": "deny" }, { "action": "webfetch", "resource": "*", "effect": "deny" }, @@ -355,12 +364,18 @@ jobs: # dumps never do. opencode can exit 1 on benign tool denials # even after a full review, so a present verdict means post; # anything else means the review did not complete. - if grep -qE '^VERDICT: (APPROVE|REQUEST_CHANGES)' /tmp/review.md; then + # Anchored to the tail: the prompt itself contains VERDICT + # lines, so scanning the whole file could pass on echoed + # prompt text or injected quotes - only the last lines count. + if tail -n 5 /tmp/review.md | grep -qE '^VERDICT: (APPROVE|REQUEST_CHANGES)'; then [ "$EXIT_CODE" -ne 0 ] && echo "::warning::opencode exited ${EXIT_CODE} but produced a valid verdict - posting review" echo "Review completed with verdict." else + # fail closed: no verdict = no review. exit 1 unconditionally - + # falling back to EXIT_CODE would exit 0 when opencode succeeded + # but produced no review, and the job would go green. echo "::error::opencode produced no valid review (exit ${EXIT_CODE:-1}) - NOT posting this output as a review comment" - exit "${EXIT_CODE:-1}" + exit 1 fi - name: Post review as PR comment @@ -371,6 +386,12 @@ jobs: REPO: ${{ github.repository }} # Gitea sets GITHUB_API_URL, e.g. https://gitea.example.com/api/v1 run: | + # re-verify the output contract here: never post anything that is + # not a completed review, regardless of how the previous step ended + if ! tail -n 5 /tmp/review.md | grep -qE '^VERDICT: (APPROVE|REQUEST_CHANGES)'; then + echo "::error::no verdict in review output - nothing to post" + exit 1 + fi # jq is not in the node image - use node for JSON encoding BODY=$(node -e 'process.stdout.write(JSON.stringify(require("fs").readFileSync("/tmp/review.md","utf8")))') HTTP_CODE=$(curl -s -o /tmp/comment-response.json -w "%{http_code}" \ -- 2.54.0