Skip to content

ci(skills): pin clawhub CLI by hash via committed lockfile#268

Open
davida-ps wants to merge 1 commit into
mainfrom
fix/pin-clawhub-cli
Open

ci(skills): pin clawhub CLI by hash via committed lockfile#268
davida-ps wants to merge 1 commit into
mainfrom
fix/pin-clawhub-cli

Conversation

@davida-ps

@davida-ps davida-ps commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

User description

Summary

Fixes code-scanning alerts #25 and #26 (OSSF Scorecard PinnedDependenciesID, "npmCommand not pinned by hash"): the skill-release.yml workflow installed the clawhub CLI with npm install -g clawhub@0.7.0 in two jobs. Version pinning alone carries no integrity guarantee — a compromised registry entry for the same version would install silently.

Changes

  • .github/clawhub-cli/package.json + package-lock.json (new) — pins clawhub@0.7.0 and all 35 transitive dependencies with sha512 integrity hashes. To bump the CLI: edit the version in package.json, run npm install --package-lock-only in that directory, and commit both files.
  • .github/workflows/skill-release.yml — both Install clawhub CLI steps now run npm ci --prefix .github/clawhub-cli (hash-verified, lockfile-exact) and prepend the local node_modules/.bin to $GITHUB_PATH, so the later clawhub login / inspect / publish steps are unchanged. The publish-payload patch step resolves the module from the local node_modules instead of npm root -g. The now-redundant CLAWHUB_CLI_VERSION env was removed (the version lives in the lockfile).

Verification

  • npm ci from the committed lockfile installs a working CLI (clawhub -h reports v0.7.0) and exposes the clawhub bin in node_modules/.bin.
  • The publish.js patch target exists at the new local path and the changelog,\n…tags, pattern the patch step rewrites still matches.
  • All 36 lockfile entries carry integrity hashes (none missing).
  • node scripts/test-skill-release-workflow.mjs passes; ./scripts/prepare-to-push.sh passes.

🤖 Generated with Claude Code


Generated description

Below is a concise technical summary of the changes proposed in this PR:
Pin the clawhub CLI and all of its transitive packages via the committed .github/clawhub-cli manifests so npm ci brings in only hash-verified dependencies. Update the skill-release workflow to run npm ci --prefix .github/clawhub-cli, load the local binary into $GITHUB_PATH, and patch clawhub’s publish.js from that install location.

TopicDetails
CLI pinning Pin the clawhub CLI plus every downstream dependency with integrity hashes in the committed package.json/package-lock.json so npm ci can install a hash-verified CLI for the release workflow.
Modified files (2)
  • .github/clawhub-cli/package-lock.json
  • .github/clawhub-cli/package.json
Latest Contributors(1)
UserCommitDate
David.a@prompt.securityci(skills): pin clawhu...June 11, 2026
Release workflow Update the skill-release workflow to run npm ci --prefix .github/clawhub-cli, expose the local node_modules/.bin to later steps, and resolve/patch publish.js from that local install.
Modified files (1)
  • .github/workflows/skill-release.yml
Latest Contributors(2)
UserCommitDate
David.a@prompt.securityci(skills): pin clawhu...June 11, 2026
david.a@prompt.securityfix(skills): scan stag...June 10, 2026
Review this PR on Baz | Customize your next review

Scorecard flags the skill-release workflow's npm install of the clawhub
CLI (code-scanning alerts #25/#26): version pinning alone carries no
integrity guarantee. Install it with npm ci from a committed
package-lock.json instead, so every package (clawhub + 35 transitive
deps) is verified against its sha512 hash at install time.

The publish-payload patch step now resolves the module from the local
node_modules instead of npm root -g.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Comment on lines 1534 to +1538
- name: Install clawhub CLI
if: needs.release-tag.outputs.publish_clawhub == 'true' && env.CLAWHUB_TOKEN != ''
run: npm install -g clawhub@${CLAWHUB_CLI_VERSION}
run: |
npm ci --prefix .github/clawhub-cli
echo "${GITHUB_WORKSPACE}/.github/clawhub-cli/node_modules/.bin" >> "$GITHUB_PATH"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing CodeArtifact auth before npm ci --prefix .github/clawhub-cli (also at lines 1726-1729) means private tarballs can't be fetched — should we add an AWS CodeArtifact login step before each npm ci, and factor both into a shared reusable step to avoid duplication?

Severity web_search

Want Baz to fix this for you? Activate Fixer

Other fix methods

Fix in Cursor

Prompt for AI Agents
Before applying, verify this suggestion against the current code. In
.github/workflows/skill-release.yml, add an AWS CodeArtifact login step (or equivalent
that writes the required npm auth token to .npmrc) before each `npm ci --prefix
.github/clawhub-cli` run — once around lines 1534-1538 in the publish-clawhub job, and
once around lines 1726-1729 in the republish-clawhub job. Then refactor both the auth
step and the `npm ci` + PATH export into a single shared step/anchor, since the same
CodeArtifact domain/repo/region are used in both jobs.

Comment on lines 1544 to +1548
node <<'NODE'
const { execSync } = require("node:child_process");
const fs = require("node:fs");
const path = require("node:path");

const npmRoot = execSync("npm root -g", { encoding: "utf8" }).trim();
const npmRoot = path.join(process.env.GITHUB_WORKSPACE, ".github", "clawhub-cli", "node_modules");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The temporary patch clawhub publish payload Node script is duplicated in publish-clawhub and republish-clawhub; should we move it into .github/scripts/patch-clawhub.js and reuse it from both jobs?

Severity

Want Baz to fix this for you? Activate Fixer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant