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

@ -7,7 +7,6 @@ ENV PATH /app/node_modules/.bin:$PATH
# install and cache app dependencies
USER root
RUN npm install -g serve
COPY app/public /app/public
COPY app/src /app/src
COPY app/package.json app/package-lock.json app/tsconfig.json /app/

View file

@ -9,8 +9,10 @@ RUN apt update && apt install -y python3 python3-dev python3-venv curl unzip &&
RUN python3 -m venv /app/venv
RUN . /app/venv/bin/activate
# Install a newer singlefile and Readability.
RUN npm install -g single-file-cli@2.0.73 readability-extractor@0.0.6
# Install single-file and Readability from the committed lockfile. Not in /usr/src/app, which is browserless's own app.
COPY npm-tools/package.json npm-tools/package-lock.json /opt/npm-tools/
COPY scripts/install_npm_tools.sh /opt/install_npm_tools.sh
RUN /opt/install_npm_tools.sh /opt/npm-tools
# Install Deno; single-file-cli is designed for it (under node 18 it cannot reach the browser CDP
# on IPv6-enabled hosts and never exits). Match the version pinned in scripts/upgrade.sh.