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 \