Repository navigation
build(deps): pin wrangler so the preview deploy uses the lockfile version - #993
Conversation
…sion The Cloudflare Pages preview job runs wrangler through cloudflare/wrangler-action without a wranglerVersion input. When wrangler is absent from the project the action installs whatever the registry currently serves, so the deploy step resolves an unpinned package at run time. Declaring wrangler as an exact dev dependency means npm ci installs it from package-lock.json first and the action uses that existing installation, matching how projectbluefin/documentation already pins it. Assisted-by: Claude Fable 5.1 via GitHub Copilot CLI Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: sec-check <280983584+hivecommons-hive[bot]@users.noreply.github.com>
b60871c
ℹ️ Sentinel notice — informational; author is trusted (hive agent), merge is not blockedHive flagged this PR (author @hivecommons-hive[bot], head
Hive did not add the |
There was a problem hiding this comment.
Looks correct to me. Verified rather than inferred:
- Mechanism holds.
.github/workflows/preview.ymlrunsnpm ci(Install dependencies) beforecloudflare/wrangler-action@953926a…(v4.1.3), with nowranglerVersioninput. At that pinned SHA,src/wranglerAction.ts:137-142takes the!didUserProvideWranglerVersion && installedVersionbranch and logs "using pre-installed wrangler version" — it does not callnpm install wrangler@…(line 169-171) when the lockfile already provides one. So the deploy step will run4.157.0fromnode_modules/.bin. - Lockfile diff is what the body says. Parsed
packagesin base vs head: 0 entries removed, 83 added, exactly one existing entry changes version (node_modules/semver7.7.4 → 7.8.6). The 328 "deleted" lines are the@eslint/*blocks shifting down to make room for the alphabetically-earlier@cloudflare/*/@cspotcode/*entries, not removals. wranglerlands as"dev": true;package.jsonuses an exact version like every neighbouring devDependency.
No workflow change, so no new permissions. Checks are green (test, Audit GitHub Actions); preview is skipped as expected for a non-same-repo trigger condition.
Confidence: 5/5 (safe)
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
Danathar
left a comment
There was a problem hiding this comment.
Reviewed head b60871c: pins wrangler 4.157.0 as an exact devDependency so wrangler-action uses the lockfile copy; lockfile entries resolve from registry.npmjs.org (sampled, not read line by line); no workflow changes, production deploy does not use wrangler.
Summary: Every pull request to this website gets a temporary preview copy published to Cloudflare so reviewers can click through it. The step that publishes it borrows a command-line tool called wrangler, and until now it fetched whichever version of that tool happened to be newest at the moment the job ran, in the same job that holds the Cloudflare publishing credential. This change records one exact wrangler version in the project's dependency list, so the preview job installs the version we chose and reviewed, the same way the documentation site already does. Nothing about the preview itself changes.
What changes
package.json: addswrangler4.157.0as an exactdevDependency(same style as every other entry; 4.157.0 is past Renovate's 3-dayminimumReleaseAge, so Renovate will keep it current from here).package-lock.json: the resulting lockfile entries. 83 packages added, none removed; the only existing entry whose resolved version moved is the hoistedsemver(7.7.4 → 7.8.6), pulled up by wrangler's range.Why
.github/workflows/preview.ymlrunscloudflare/wrangler-actionwithout awranglerVersioninput. Per the action's README, when that input is omitted it uses an already-installed wrangler if one exists, otherwise it installs a default version from npm at run time. This repository did not ship wrangler, so each preview run resolved and executed an unpinned package whileCLOUDFLARE_API_TOKENwas in scope. (The previouscloudflare/pages-actionhad the same shape, so this is not a regression from #991 — the replacement just made the fix straightforward.)Because the job already runs
npm cibefore the deploy step, declaring wrangler in the lockfile is enough: the action findsnode_modules/.bin/wranglerand skips its own install. No workflow edit is needed, so this lands from this lane. The same approach is what projectbluefin/documentation adopted for its Cloudflare deploy (documentation#1074).This applies the accepted ruling on projectbluefin/utah#902 (pin build-time fetched tools to an exact, lockfile-verified version); an instance note is posted there rather than a separate issue here.
Verification
npm cifrom the updated lockfile, then./node_modules/.bin/wrangler --version→4.157.0.npm run test:run→ 112 files, 1549 passed, 1 skipped (unchanged).Filed by sec-check agent (ACMM L6 — full mode)
— hive: agent=sec-check backend=copilot model=claude-fable-5.1 copilot=1.0.88