Repository navigation
Align npm and CI supply-chain posture with the docsy repo - #487
Merged
Merged
Conversation
chalin
force-pushed
the
chalin-m24-secure-npm-2026-0825
branch
2 times, most recently
from
August 25, 2026 17:05
fe2e344 to
d3b3093
Compare
On a stale or missing node_modules, a bare npx BIN silently falls back to the public registry and executes whatever holds that name. Plain bin names resolve through PATH only, which npm points at node_modules/.bin for package scripts.
Semver ranges let a fresh install float to whatever the registry serves that day; exact pins keep template clones reproducible (this repo commits no lockfile: the generated hugoautogen workspace embeds the checkout directory name, so a lock is not portable). The adm-zip override clears the GHSA-xcpc-8h2w-3j85 advisory reported through hugo-extended, matching the docsy repo's fix; npm audit is now clean.
Adopts the docsy repo's install posture: a committed .npmrc turns on strict-allow-scripts (unreviewed dependency install scripts fail the install; hugo-extended's binary download is the one approval) and engine-strict (older npm silently ignores allowScripts, so the engines floor fails closed). script-shell=bash keeps package scripts on one interpreter everywhere: under cmd.exe, the single-quoted test:site glob would no-match and silently run nothing.
Tag pins are mutable: a compromised action republishes the tag and every workflow using it runs the attacker's code. The dependabot cooldown keeps versions younger than 7 days out of update PRs (security updates bypass it), and the new github-actions ecosystem keeps the SHA pins fresh. Drops the bundler ecosystem: the repo has no Gemfile.
A version-qualified key is only trusted against the lockfile-recorded resolved URL; this repo commits no lockfile, so on CI installs (Netlify restores node_modules without a valid hidden lockfile) the pinned key cannot match and the install fails ESTRICTALLOWSCRIPTS. The exact pin in devDependencies already fixes the version; the policy key carries the approval.
hugo mod npm pack names the generated workspace after the checkout directory, which made the artifacts non-portable and forced them out of version control; update:docsy:pack now normalizes the name to a fixed value, making the generated set deterministic, so the lockfile and the hugoautogen workspace can be committed and installs are lock-exact and reproducible. Regeneration is idempotent and covered by the existing freshness guard; README documents the regenerate-and-commit expectation.
With the lockfile committed, npm ci replaces install in the links workflow (the npm cache key falls back to its lockfile default), and the hugo-extended approval can carry its version again: the strict allowScripts matcher trusts only the lockfile-recorded registry URL, which install paths now always have.
The allowScripts fail-closed mechanism is homed in the .npmrc comment; the README keeps only the consumer-facing floor. The name-normalization rationale, previously only in a commit message, gets its current-state home in the lockfile paragraph.
chalin
force-pushed
the
chalin-m24-secure-npm-2026-0825
branch
from
August 26, 2026 01:27
8a445f1 to
bb9149c
Compare
… Netlify installs lock-exact update:hugo now installs script-free and re-approves the new version via npm approve-scripts (which rewrites the version-pinned allowScripts key from the installed tree); without this, the next hugo-extended release fails ESTRICTALLOWSCRIPTS with no hint (found by adversarial review). Netlify's automatic install is constrained to resolution only (NPM_FLAGS) and the build commands run the real lock-exact install, matching the docsy repo's pattern; the hugo binary self-installs at first use.
update:hugo's inline approve-scripts turned whatever @latest resolved to into an approval with no review checkpoint (found by adversarial review). The update now stops after a script-free install; the separate approve:hugo step records the approval and refreshes the generated pack checksum. Aggregate updates and Dependabot skip hugo-extended, keeping the dependency and its version-pinned approval in sync; README documents the flow, the Dependabot-PR checksum refresh, and the Windows bash requirement.
…, gate message Exact-pins the adm-zip override (the one floating pin left; the lock already resolved 0.6.0). Scopes the Dependabot hugo-extended ignore to version updates so security updates still open PRs (a bare ignore suppresses those too). The drift-gate failure message now names both remediations (link cache vs generated manifests); it previously misdirected package.json-edit failures to the link-cache command. README states what the approval does and does not gate: the hugo binary self-installs at first use, so the review window excludes builds.
chalin
marked this pull request as ready for review
August 26, 2026 11:34
Re-ignores hugo_packagemeta.json, restoring the churn call made in docsy#472 (committing it in this branch reintroduced the tax: every package.json edit, Dependabot PRs included, staled the tracked checksum). The marker is npm-irrelevant (only the workspace manifest feeds npm ci), builds are warning-free without it, and installs regenerate it locally, where its staleness warning still works. Netlify's install moves into a _netlify:prepare script wrapped in the family clean-tree bracket, which catches NPM_FLAGS regressions.
install:safe names the script-free lock-exact install (the path _netlify:prepare and hardened consumers use); the README documents the silent failure mode that makes the committed manifest load-bearing: a script-free install without it exits 0 with no theme assets.
Netlify's Node-bundled default npm may be older than the floor that makes allowScripts enforcement real; the pin removes the dependence on what the build image bundles (as in opentelemetry.io).
The committed manifest exposed the unclaimed bare name hugoautogen on the public registry with nothing preventing an accidental publish (caught in review): a squatted name would poison audits and installs. The pack step now normalizes to @docsy/hugoautogen (owned scope) and reapplies private=true, both dropped by hugo mod npm pack on every regeneration; verified npm publish now skips the workspace.
…te, doc gaps The drift gate and Netlify bracket switch to docsy's is:clean shape (untracked-aware): git diff misses a new generated artifact a future Hugo could emit. Dependabot skips the theme-managed workspace deps, whose bumps the pack regeneration reverts (guaranteed-red PRs); README notes the security-update exception and the Dockerfile's independent Hugo and Dart Sass pins; the Netlify comment states the bracket's detect-not-prevent residual honestly; .npmrc restores the workspace-coverage clause.
This was referenced Aug 26, 2026
chalin
added a commit
to chalin/docsy-example
that referenced
this pull request
Sep 25, 2026
- Adds the npm release cooldown and the install-time script default-deny that docsy added in #2757/#2760, three days after docsy#487 copied the older file; the registry pin stays docsy's (publisher-only) - Pins Node to docsy's version: lts/* floated in CI and was invisible to Renovate's nvm manager
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Aligns this template with the supply-chain posture the docsy repo adopted for 0.17.0; what lands here is guidance-by-example for consumers who clone it.
npx: calls package-script bins by plain name; on a stale tree,npx BINsilently falls back to the public registry.npm auditis clean..npmrcpolicy, with hugo-extended as the one version-pinned approval; fails closed on npm versions that ignore the policy. Routes hugo updates through a two-step install-then-approve flow with a review checkpoint, excluded from automated bumps. Red/green tested: an unapproved install script fails the install.