fix: address second-round PR review (cleanup traps, host-key pinning, supply chain)
Latest review (Claude + Greptile) flagged three security/cleanup items on top of the previous fix commit. All three addressed below. publish-npm.sh: - Add `trap 'rm -rf "$WORK_DIR"' EXIT` immediately after `mktemp -d` so the tmpdir is cleaned up even when `pnpm build` or `npm publish` fails partway through (set -e would otherwise abort before the explicit rm at the end). - Remove redundant `pnpm build` before `npm publish` — the `prepublishOnly` script in package.json already runs the build. update-homebrew-tap.sh: - Combine `cleanup_ssh` + WORK_DIR cleanup into one EXIT trap so `git clone` / `git push` failures don't leak the tmpdir. - Pin GitHub's published SSH host keys (ed25519, ECDSA, RSA) into a temp `known_hosts` file instead of using `accept-new` + `/dev/null`. This closes the "trust any host key on first connect" gap. The pinned keys come from https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/githubs-ssh-key-fingerprints. release.yml: - Replace the curl|tar git-cliff install with `orhun/git-cliff-action@v4` (already used in publish-release). The action pins to a digest, so we no longer need to verify a tarball checksum manually. Removes a supply-chain attack surface where a tampered git-cliff binary could run during `prepare` (which has contents:write + pull-requests:write).
This commit is contained in:
@@ -66,13 +66,6 @@ jobs:
|
||||
with:
|
||||
node-version: "24"
|
||||
|
||||
- name: Install git-cliff
|
||||
run: |
|
||||
curl -sSL "https://github.com/orhun/git-cliff/releases/download/v2.6.1/git-cliff-2.6.1-x86_64-unknown-linux-gnu.tar.gz" \
|
||||
| tar -xz -C /tmp
|
||||
sudo mv /tmp/git-cliff-2.6.1/git-cliff /usr/local/bin/
|
||||
git-cliff --version
|
||||
|
||||
- name: Configure git identity
|
||||
run: |
|
||||
git config user.email "release-bot@kandev"
|
||||
@@ -155,9 +148,12 @@ jobs:
|
||||
pnpm -C apps install --no-frozen-lockfile
|
||||
|
||||
- name: Generate CHANGELOG
|
||||
uses: orhun/git-cliff-action@v4
|
||||
with:
|
||||
config: cliff.toml
|
||||
args: --tag ${{ steps.compute.outputs.tag }}
|
||||
env:
|
||||
TAG: ${{ steps.compute.outputs.tag }}
|
||||
run: git-cliff --tag "$TAG" -o CHANGELOG.md
|
||||
OUTPUT: CHANGELOG.md
|
||||
|
||||
- name: Create release PR + merge + tag (or dry-run)
|
||||
if: ${{ !inputs.dry_run }}
|
||||
|
||||
Reference in New Issue
Block a user