Skip to content

bug: dev frontend image deletes package-lock.json and runs npm install — every dev build floats the whole dependency tree #4435

Closed

Description

@pavshulin

Summary

The dev frontend image deletes the lockfile before installing:

# docker/frontend/Dockerfile:9
RUN rm -f package-lock.json && npm install

docker-compose.yml builds the frontend service from this file, so every dev-stack build resolves every semver range to whatever is newest on the registry at that moment. src/frontend/package-lock.json is ignored.

Context

  • Origin. 7c6469742 (2026-01-28, "fix: Frontend Docker build for cross-platform native binaries") replaced npm ci with the line above. It worked around the npm optional-dependency problem: a lockfile generated on macOS arm64 could lack the linux build of native packages (rollup), so npm ci failed inside the container.
  • Prod was hardened later, dev was not. docker/frontend/Dockerfile.prod:14 runs npm ci (comment cites CSO M4). The dev file kept the workaround.
  • Not affected: published images (publish-images.yml), docker-compose.prod.yml, and deploy-dev.yml — all build from Dockerfile.prod. container-security.yml only renders the dev compose config, it does not build from it.

Measured on dev 13d32e22f, 2026-11-10, linux x64

rm lockfile && npm install (today) npm ci
Installed versions that differ from package-lock.json 119 of 447 lockfile entries 0 of 421
Versions published less than 14 days before the build about 90 2
Youngest installed version about 2 hours old 4.7 days old
Build ok ok, first try, no missing native binary

Versions under one day old in the floating build included axios, vite, rolldown and its linux binding, marked and lilconfig.

Why it matters

  1. Supply chain. A hijacked release inside any semver range in the tree is installed on the next dev build, with no review and no soak time. The dev container runs as root, has network access, and bind-mounts src/frontend read-write, so such a package can modify the contributor's checkout, and the JS it serves runs in the browser with the logged-in session. Registry signatures do not help here: a stolen maintainer account publishes validly signed packages.
  2. Dev and release test different code. A UI result on the dev stack is not evidence about the shipped bundle, because roughly a quarter of the dependency tree is at a different version.

No compromise was observed. This is exposure to the class, found while checking a fresh dev build against current npm incident indicators.

Acceptance Criteria

  • docker/frontend/Dockerfile installs with npm ci from the committed lockfile; the lockfile is not deleted or bypassed.
  • The dev frontend builds on linux x64, linux arm64 and from a macOS arm64 host (the case the January workaround was written for). If a native binary is missing on one of them, the fix goes into package-lock.json, not into bypassing it.
  • src/frontend/Dockerfile is removed. Nothing builds it (already noted as stale in docs/security-reports/cso-2026-09-30.json), and it also runs npm install with no lockfile.
  • A CI guard fails when a Dockerfile in the repo installs project dependencies with npm install instead of npm ci, or removes a lockfile. Pinned global tool installs (npm install -g <pkg>@<version>) are out of scope for the guard.

Technical Notes

  • Local workaround until this lands: change line 9 to RUN npm ci, then docker compose build --no-cache frontend && docker compose up -d --no-deps --force-recreate -V frontend. The -V matters: /app/node_modules is an anonymous volume and otherwise keeps the old tree.
  • 7c6469742 also added the rollup platform binaries to package.json as optional dependencies, which is probably why npm ci now succeeds on linux x64. Not verified on arm64.
  • Comparison method: diff node_modules/.package-lock.json in the running container against src/frontend/package-lock.json; publish age from the registry time field per installed version.

Activity

  1. added
    priority-p1
    type-bug
    theme-security
    status-ready
    on Nov 10, 2026
  2. removed
    status-ready
    on Nov 10, 2026
  3. obasilakis commented on Nov 10, 2026

    @obasilakis
    Contributor

    /claim

  4. added
    status-in-progress
    on Nov 10, 2026
  5. github-actions commented on Nov 10, 2026

    @github-actions

    Claimed by @obasilakis. Label status-in-progress added.

    Next steps:

    1. Create branch: feature/4435-<short-slug>
    2. Implement the feature
    3. Open a PR with Fixes #4435
  6. added
    status-in-dev
    and removed
    status-in-progress
    on Nov 11, 2026
  7. removed
    status-in-dev
    on Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

priority-p1theme-securitytype-bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions