serve, single-file and readability-extractor install from a committed lockfile (#912)

They were installed with `npm i -g`, which pinned only the three top-level versions and
resolved their 156 dependencies fresh from the registry, so a forged TLS certificate (as
the eMudhra key compromise allowed) could change code WROLPi runs on every archive.
npm-tools/package-lock.json pins every package with its sha512, and install_npm_tools.sh
runs `npm ci` and links the commands into /usr/local/bin for every install path, upgrades,
both images and the archive container.  The app container's unpinned, unused global serve
is removed.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
lrnselfreliance 2026-10-31 10:38:53 -06:00 • committed by Roland
parent ecdad6c3e0
commit d69f8317aa
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
12 changed files with 1838 additions and 32 deletions

View file

@ -21,9 +21,6 @@ EOF
# Create WROLPi user. This user will own the media directory, API, and App.
useradd -md /home/wrolpi wrolpi -s "$(command -v bash)"
# Install Node console commands.
npm i -g serve@12.0.1 single-file-cli@2.0.73 readability-extractor@0.0.6
# Install Deno runtime.
DENO_VERSION="v2.8.3"
DENO_SHA256="d4589cc1ffcbf1995c92a0127d932aaf832ac70cfdcc6d5b7bf38043cf303575"
@ -38,6 +35,9 @@ deno --version
git clone -b "${WROLPI_BRANCH:-release}" https://github.com/lrnselfreliance/wrolpi.git /opt/wrolpi
bash /opt/wrolpi-blobs/verify_wrolpi_commit.sh /opt/wrolpi HEAD /opt/wrolpi-blobs/roland@learningselfreliance.com.gpg
rm /opt/wrolpi-blobs/verify_wrolpi_commit.sh /opt/wrolpi-blobs/roland@learningselfreliance.com.gpg
# Install serve and the archiving tools from the committed lockfile.
/opt/wrolpi/scripts/install_npm_tools.sh
# `git config --global` needs HOME, which is empty when the build runs under
# systemd (the release poller service has no HOME); set it to root's home.
export HOME=/root