Files
DeepSeek-TUI/.github/workflows/release-candidate.yml
CodeWhale Bot f9519454ca fix(ci): close the CodeQL cache-poisoning Highs in the release workflows
All 19 open actions/cache-poisoning/poisonable-step alerts (#88-#106) sit in
release.yml, release-candidate.yml and release-artifacts.yml: jobs interpolated
the caller SHA into ref/caches and let setup-node's implicit npm cache key on
run identity. Now caller source_sha is pinned against github.sha by a pin job
(refusing any retarget), checkout and build identity use GITHUB_SHA through
env indirection instead of template interpolation, rust-cache keys use stable
prefix-key values, and setup-node's implicit package cache is off where it
cannot be keyed safely.

Also carries the CodeQL #107 fix from the same lane: catalog_models_dev.py
prints remote limit values as numbers/null/redacted only and drops query and
fragment material from source URLs before logging.

Harvested from #5401 (workflow+script files; CHANGELOG edit intentionally
excluded here and lands with the release branch; GHSA advisory text split to
a later PR as advised).

No-Issue: CodeQL alert remediation (alerts #88-#107); no single user-facing issue tracks these

Signed-off-by: Hunter Bown <hunter@hmbown.com>
2026-08-16 22:52:15 -07:00

119 lines
4.4 KiB
YAML

name: Release candidate
# Safe pre-publication artifact proof. This workflow never creates a tag or
# release and never writes to a registry, container repository, tap, or deploy.
on:
workflow_dispatch:
inputs:
expected_sha:
description: Exact 40-character commit selected by --ref (must match the dispatch SHA)
required: true
type: string
permissions:
contents: read
concurrency:
group: release-candidate-${{ github.sha }}
cancel-in-progress: false
jobs:
resolve:
name: Resolve exact candidate source
runs-on: ubuntu-latest
outputs:
sha: ${{ steps.source.outputs.sha }}
version: ${{ steps.source.outputs.version }}
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
with:
fetch-depth: 0
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 20
package-manager-cache: false
- uses: dtolnay/rust-toolchain@6c977a6ca4077a0ceb28ffbe03f59d46e9ac8772 # stable 2026-07-18
with:
toolchain: stable
- name: Match dispatch to the requested commit
id: source
shell: bash
env:
EXPECTED_SHA: ${{ inputs.expected_sha }}
run: |
set -euo pipefail
if [[ "${#EXPECTED_SHA}" -ne 40 || "${EXPECTED_SHA}" =~ [^0-9a-fA-F] ]]; then
echo "::error::expected_sha must be a full 40-character commit SHA." >&2
exit 1
fi
actual="$(git rev-parse HEAD)"
expected_normalized="$(printf '%s' "${EXPECTED_SHA}" | tr '[:upper:]' '[:lower:]')"
if [[ "${actual}" != "${expected_normalized}" ]]; then
echo "::error::Dispatch resolved to ${actual}, not requested ${EXPECTED_SHA}." >&2
exit 1
fi
workspace_version="$(grep -E '^version = "' Cargo.toml | head -n1 | sed -E 's/^version = "([^"]+)".*/\1/')"
npm_version="$(node -p "require('./npm/codewhale/package.json').version")"
binary_version="$(node -p "require('./npm/codewhale/package.json').codewhaleBinaryVersion")"
if [[ "${workspace_version}" != "${npm_version}" ]]; then
echo "::error::Candidate version drift: workspace=${workspace_version}, npm=${npm_version}, binary=${binary_version}." >&2
exit 1
fi
if [[ "${workspace_version}" != "${binary_version}" ]]; then
echo "::error::Candidate version drift: workspace=${workspace_version}, npm=${npm_version}, binary=${binary_version}." >&2
exit 1
fi
echo "sha=${actual}" >> "${GITHUB_OUTPUT}"
echo "version=${workspace_version}" >> "${GITHUB_OUTPUT}"
- name: Check version and OHOS release contracts
run: |
./scripts/release/check-versions.sh
./scripts/release/check-ohos-deps.sh
- name: Reconfirm clean source snapshot
run: git diff --exit-code
web:
name: Verify exact candidate web surface
needs: resolve
if: ${{ !cancelled() && needs.resolve.result == 'success' }}
runs-on: ubuntu-latest
defaults:
run:
working-directory: web
steps:
# resolve already proved expected_sha equals GITHUB_SHA. Do not
# interpolate that SHA into checkout or the npm cache key.
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 22
cache: npm
cache-dependency-path: web/package-lock.json
- name: Install web dependencies
run: npm ci
- name: Check public facts drift
run: npm run check:facts
- name: Generate derived facts
run: npm run prebuild
- name: Check public docs parity
run: npm run check:docs
- name: Run web tests
run: npm test
- name: Run web lint
run: npm run lint
- name: Run web type check
run: npx tsc --noEmit
- name: Build production web surface
run: npm run build
artifacts:
needs: [resolve, web]
if: ${{ !cancelled() && needs.resolve.result == 'success' && needs.web.result == 'success' }}
uses: ./.github/workflows/release-artifacts.yml
with:
source_sha: ${{ needs.resolve.outputs.sha }}
version: ${{ needs.resolve.outputs.version }}
retention_days: 7